[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: is this a bug?
From: |
Barry Margolin |
Subject: |
Re: is this a bug? |
Date: |
Fri, 28 Mar 2008 23:02:34 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b2 (Intel Mac OS X) |
In article <ur6du1quj.fsf@tiscali.co.uk>,
David Roderick <angel_ov_north@tiscali.co.uk> wrote:
> 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)
> (function))
No, because the description says it "starts over with that value", not
"returns that value". It follows a chain of indirections, not just one
level.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE don't copy me on replies, I'll read them in the group ***