unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Subject: Re: memoizing interpreter
Date: Sat, 31 Dec 2005 13:27:27 +0000	[thread overview]
Message-ID: <87sls9bdmo.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <20051230194134.2c4a6730.leonardolopespereira@gmail.com> (Leonardo Lopes Pereira's message of "Fri, 30 Dec 2005 19:41:34 -0300")

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


      reply	other threads:[~2005-12-31 13:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-30 22:41 memoizing interpreter Leonardo Lopes Pereira
2005-12-31 13:27 ` Neil Jerram [this message]

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=87sls9bdmo.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    /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).