[plt-scheme] Closures

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Nov 6 09:33:33 EST 2007

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


> 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

> 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  

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

Posted on the users mailing list.