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

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

Re: Function pointer


From: Decebal
Subject: Re: Function pointer
Date: Tue, 14 Apr 2009 01:41:17 -0700 (PDT)
User-agent: G2/1.0

On 14 apr, 10:02, Harald Hanche-Olsen <han...@math.ntnu.no> wrote:
> + Decebal <CLDWester...@gmail.com>:
> > The following works:
> >     (a-function)
> > but this does not work:
> >     (setq function 'a-function)
> >     (function)
> > this gives wrong number of arguments.
>
> Ah. So you're not after pointers, just a means of passing functions
> around. You should be aware, then, that symbols can have two values
> associated with them: The regular value, which is obtained by just using
> the symbol, and the function value, which is consulted if the symbol is
> in the function place of a for. You have assigned the symbol a-function
> to the symbol function above, but that symbol also has a function value,
> which you inadvertently used in the last line.
>
> The elisp manual explains this. Go to node Symbols, then sub-node Symbol
> Components.
>
> The very short answer to your question: Use funcall, as in
>     (funcall function)

Works likes a charm. Now I have the tools to build the 'little'
functionality I wanted. Thanks.


reply via email to

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