From: ludo@gnu.org (Ludovic Courtès)
To: guile-user@gnu.org
Cc: guile-devel@gnu.org
Subject: Re: Injecting variables into closures.
Date: Thu, 29 Nov 2007 17:02:13 +0100 [thread overview]
Message-ID: <87mysxca62.fsf@chbouib.org> (raw)
In-Reply-To: Pine.LNX.4.64.0711291552180.9048@ttleush
Hi,
"Kjetil S. Matheussen" <k.s.matheussen@notam02.no> writes:
> By the way. I'm quite surprised the environments consist
> of linked lists. Wouldn't it be much faster using hash
> tables instead? Perhaps the variables are cached or something?
Yes, variable references are "cached" ("memoized") so that actual
variable lookup occurs only once. So, for instance, in the following
piece of code:
(let ((x 1)(y 2))
(foo y))
the reference to "y" in "(foo y)" is replaced by an "iloc" that says
"this is a reference to the second variable in the first frame". When
that iloc is encountered, the variable's value is fetched by doing
(roughly) two `list-ref's: one to get the frame and then one to get the
variable within the frame.
Clearly, a vector-like data structure (i.e., with O(1) access to
individual elements) would help here.
Thanks,
Ludovic.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2007-11-29 16:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-29 14:04 Injecting variables into closures Kjetil S. Matheussen
2007-11-29 14:44 ` Kjetil S. Matheussen
2007-11-29 14:54 ` Kjetil S. Matheussen
2007-11-29 16:02 ` Ludovic Courtès [this message]
[not found] ` <877ik1dpyj.fsf@unknownlamer.org>
2007-11-29 15:52 ` Kjetil S. Matheussen
2007-11-29 15:53 ` Ludovic Courtès
[not found] <cmu-lmtpd-10256-1196356001-0@mail-imap2.uio.no>
2007-11-29 18:43 ` Kjetil S. Matheussen
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/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mysxca62.fsf@chbouib.org \
--to=ludo@gnu.org \
--cc=guile-devel@gnu.org \
--cc=guile-user@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).