Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!nntp.club.cc.cmu.edu!goldenapple.srv.cs.cmu.edu!das-news2.harvard.edu!cam-news-feed3.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!howland.erols.net!ix.netcom.com!hbaker
From: hbaker@netcom.com (Henry Baker)
Subject: Re: dissecting closures
Content-Type: text/plain; charset=ISO-8859-1
Message-ID: <hbaker-0804972243140001@10.0.2.1>
Sender: hbaker@netcom4.netcom.com
Content-Transfer-Encoding: 8bit
Organization: nil
X-Newsreader: Yet Another NewsWatcher 2.2.0
References: <5ieu8a$mpg@hpaneqb4.an.hp.com>
Mime-Version: 1.0
Date: Wed, 9 Apr 1997 06:43:14 GMT
Lines: 24

In article <5ieu8a$mpg@hpaneqb4.an.hp.com>, Michael Aramini
<aramini@an.hp.com> wrote:

> Does Scheme provide functions for looking at the argument list and body
> of a closure?
> 
> I'm interested in doing this in order to be able to implement operators
> which take the definition of one function as input transform it into
> another function.  An example would be a function which takes the
> definition of a function which does numerical computation as input and
> returns a the definition a function which is the (symbolic) derivative
> of the input function.
> 
> Another application of looking at the innards of a closure would be to
> implement a pretty-print function capable of pretty printing function
> capable of pretty printing the definition of a function (instead of
> just printing it as #[procedure] ).

I think that this is an excellent idea.  At the very least, one would
like to 'map' through the values bound in the environments of closures.
Remember, a closure is simply a short-hand for a lazy substitution.  One
way to think about accessing a closure is that 'touching' it forces the
substitution to move down a level.  If you were to 'deep copy' such a value,
you could force the substitution to all levels.
