From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: symbols and cells
Date: Thu, 15 May 2014 20:07:59 +0200 [thread overview]
Message-ID: <87mweioqyo.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: mailman.1410.1400173825.1147.help-gnu-emacs@gnu.org
Christopher Howard <cmhoward2@alaska.edu> writes:
> I'm still working through the earlier parts of the Elisp
> documentation, but I am curious: How does one define the variable cell
> and function cell for an /uninterned/ symbol? The docs indicate you
> can do this:
>
> (defvar sym (make-symbol "foo"))
>
> But how do you add a function or variable value to foo without
> interning it?
(require 'cl)
(setf (symbol-value sym) 42
(symbol-function sym) (lambda () 33))
(eval sym) --> 42
(eval (list sym)) --> 33
> On a related note, I'm curious about this perverse construction:
>
> (defvar sym1 (lambda (n) (+ 1 n)))
>
> Is it actually possible to call the the lambda somehow?
(funcall sym1 (symbol-value sym)) --> 43
--
__Pascal Bourguignon__
http://www.informatimago.com/
"Le mercure monte ? C'est le moment d'acheter !"
next parent reply other threads:[~2014-05-15 18:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1410.1400173825.1147.help-gnu-emacs@gnu.org>
2014-05-15 18:07 ` Pascal J. Bourguignon [this message]
2014-05-15 17:10 symbols and cells Christopher Howard
2014-05-15 20:16 ` Michael Heerdegen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mweioqyo.fsf@kuiper.lan.informatimago.com \
--to=pjb@informatimago.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.