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

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

Re: Purpose of dash # in elisp


From: Tassilo Horn
Subject: Re: Purpose of dash # in elisp
Date: Mon, 09 Nov 2009 11:53:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Nordlöw <address@hidden> writes:

> What purpose does # as a quote suffix?

You mean as prefix, e.g.

    (mapcar #'oddp '(1 2 3))

versus

    (mapcar 'oddp '(1 2 3))?

Both forms are completely equivalent (try disassembling them), but the
former is more common to a common lisp programmer, where you pass
function symbols with the `function' macro and its reader form #', and
other symbols that should not be evaled with `quote' (which is ').

If you stick to the convention to always use #' when passing a function
as arguments, the code might be a littlebit more explanatory, because
then you can see that a function is passed on a first glance.  On the
other hand, in elisp the reader won't error or warn if you use #' to
pass anything different, so this convention wouldn't be enforced
somehow.

Bye,
Tassilo





reply via email to

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