unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* memoizing interpreter
@ 2005-12-30 22:41 Leonardo Lopes Pereira
  2005-12-31 13:27 ` Neil Jerram
  0 siblings, 1 reply; 2+ messages in thread
From: Leonardo Lopes Pereira @ 2005-12-30 22:41 UTC (permalink / raw)


I read that guile is a "memoizing interpreter", what that means?


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: memoizing interpreter
  2005-12-30 22:41 memoizing interpreter Leonardo Lopes Pereira
@ 2005-12-31 13:27 ` Neil Jerram
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Jerram @ 2005-12-31 13:27 UTC (permalink / raw)


Leonardo Lopes Pereira <leonardolopespereira@gmail.com> writes:

> I read that guile is a "memoizing interpreter", what that means?

It means that when Guile evaluates a source code expression for the
first time, it changes ("memoizes") some parts of the expression so
that they will be quicker to evaluate when that expression is
evaluated again.

For example, in an expression like (display x), the identifiers
`display' and `x' refer to variables somewhere in the evaluation
environment.  The first time Guile evaluates (display x), it:

- locates the innermost slots in the environment with these
  identifiers

- modifies the expression to something like (<shortcut to slot for
  display> <shortcut to slot for x>) -- this is the memoization part

- uses the current values in those slots to complete the evaluation.

The next time Guile evaluates the same expression, the procedure is
quicker because it already has the shortcuts, so it just

- uses the current values in those slots to complete the evaluation.

This isn't the whole story of memoization.  Special forms like lambda,
define and let are more drastically modified to make them easier for
subsequent evaluations.  But I hope this explains the general idea.

Regards,
        Neil



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-12-31 13:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-30 22:41 memoizing interpreter Leonardo Lopes Pereira
2005-12-31 13:27 ` Neil Jerram

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).