[plt-scheme] Closures

From: David Einstein (deinst at gmail.com)
Date: Tue Nov 6 12:35:07 EST 2007

On 11/6/07, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>
>
> On Nov 6, 2007, at 9:26 AM, Joel J. Adamson wrote:
>
> >
> >> The closure is a data representation that is just a struct with two
> >> fields:
> >>
> >>  -- one field that points to the environment of the function
> >> definition
> >>  -- another field that points to the code of the function definition
> >
> > How concrete are we talkin' here?  Are you saying the MzScheme
> > interpreter builds a struct
>
> Yes.
>
> > in the sense that I could manipulate it
> > with struct functions (if I knew what it was called)?
>
> You do have two operations in your language (Scheme) on closures:
>   [1] construction aka lambda (the true syntax of function defs)
>   [2] application (that is, function application)
>
> Your language does not give you access to the fields of the struct
> otherwise.
>
> > Are we starting to get at the "What's so great about Lisp?" here?
>
> It's the same for all rationally constructed interpreters, VMs, and
> compilers.


Sorry to butt in, but seeing that Joel is a biostatistician, I should
mention that R has closures.  (Rationally constructed is not the first
adjective that springs to mind when I think of R).
They have the canonical account implementation in the scoping demo, and you
can find other examples in the code.


> >> Time to read HtDP and PLAI now. -- Matthias
> >
> > I read the first chapter of PLAI last night, and I'm really enjoying
> > it.  I skimmed through much of HtDP, and found plenty of good
> > conceptual angles in it.  Perhaps I'll go back and read some of the
> > later chapters.  And you'll be happy to know I'm reading through the
> > Little Schemer for the second time.
>
> All of these are good books. HtDP is TLS/TLL for people who like
> words. Or I finally figured out how to respond to Dan :-)
>
> > Thanks for all your help --- this list is fantastic,
>
> You're welcome.
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20071106/818488e0/attachment.html>

Posted on the users mailing list.