unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Decebal <CLDWesterhof@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Function pointer
Date: Tue, 14 Apr 2009 01:41:17 -0700 (PDT)	[thread overview]
Message-ID: <1ca52c6e-ca27-4ffe-aa95-27b9bbfebe61@z14g2000yqa.googlegroups.com> (raw)
In-Reply-To: pcoy6u3k6ij.fsf@math.ntnu.no

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	other threads:[~2009-04-14  8:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14  7:20 Function pointer Decebal
2009-04-14  8:02 ` Harald Hanche-Olsen
2009-04-14  8:41   ` Decebal [this message]
2009-04-14 14:37     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ca52c6e-ca27-4ffe-aa95-27b9bbfebe61@z14g2000yqa.googlegroups.com \
    --to=cldwesterhof@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).