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

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

Re: is this a bug?


From: Pascal Bourguignon
Subject: Re: is this a bug?
Date: Fri, 28 Mar 2008 23:10:19 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1.50 (gnu/linux)

David Roderick <angel_ov_north@tiscali.co.uk> writes:

> 9.2.4 Symbol Function Indirection
> ---------------------------------
>
>  -- Function: indirect-function function &optional noerror
>      This function returns the meaning of FUNCTION as a function.  If
>      FUNCTION is a symbol, then it finds FUNCTION's function definition
>      and starts over with that value.  If FUNCTION is not a symbol,
>      then it returns FUNCTION itself.
>
>      This function signals a `void-function' error if the final symbol
>      is unbound and optional argument NOERROR is `nil' or omitted.
>      Otherwise, if NOERROR is non-`nil', it returns `nil' if the final
>      symbol is unbound.
>
>      It signals a `cyclic-function-indirection' error if there is a
>      loop in the chain of symbols.
>
>      Here is how you could define `indirect-function' in Lisp:
>
>           (defun indirect-function (function)
>             (if (symbolp function)
>                 (indirect-function (symbol-function function))
>               function))
>
>
> shouldn't this be? 
>
>           (defun indirect-function (function)
>             (if (symbolp function)
>                 (symbol-function function)

That wouldn't be the same thing.

(setf (symbol-function 'c) (symbol-function 'car)
      (symbol-function 'b) (symbol-function 'c)
      (symbol-function 'a) (symbol-function 'b))

(indirect-function 'a) --> #<subr car> ; is more usefull than b

>               (function))

Is invalid, function is a special operator that takes one argument, a
symbol or a lambda form.


Note that in emacs lisp, function == quote, but is a hint for the
compiler that the argument of function shall be compiled.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

HANDLE WITH EXTREME CARE: This product contains minute electrically
charged particles moving at velocities in excess of five hundred
million miles per hour.


reply via email to

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