help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to quote a list of functions?


From: Pascal J. Bourguignon
Subject: Re: How to quote a list of functions?
Date: Sun, 09 Aug 2015 03:23:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Michael Heerdegen <michael_heerdegen@web.de> writes:

> "Pascal J. Bourguignon" <pjb@informatimago.com> writes:
>
>> The difference, in emacs lisp, is when you compile a lambda form.
>
> AFAIK, there is also a difference for function names when compiling:
> using #'fun you enable checking whether `fun' is defined, using 'fun, it
> is not checked.  So it is preferable to use #' for symbols intended to
> be used as a function.

Agreed. 

However, my conclusion is that if you want to designate a list of
(global) functions, you can easily do it by having a literal list of
symbols naming those functions:

(defvar *trigs* '(sin cos tan))
(mapcar (lambda (f) (funcall f (/ pi 3))) *trigs*)
--> (0.8660254037844386 0.5000000000000001 1.7320508075688767)

I wouldn't lose sleep over:
(defvar *trigs* (list (function sin) (function cos) (function tan)))


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

[Prev in Thread] Current Thread [Next in Thread]