[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: good books on scheme?



I think one final problem is that SICP makes the point that there
are conflicting definitions of "closure".  Some of the books missing
the term "closure" from the index might have used a different term
so as not to confuse it with the "mathematical" definition, which
(from memory) says  something to the effect that a function that
acts on a set returns data from that same set -- which allows you
to apply functions to other functions.

Someone else can probably explain this better than I can.  I don't
have any of those books with me right now.

Can anyone clean up that mess of a paragraph above?

Thanks,

-Brent

> -----Original Message-----
> From: Michael Bogomolny [mailto:bogo@bigfoot.com]
> Sent: Tuesday, February 06, 2001 7:56 AM
> To: Tim Hanson
> Cc: plt-scheme@fast.cs.utah.edu
> Subject: Re: good books on scheme?
> 
> 
> a lambda expression (i.e. a procedure definition) returns a *closure*,
> capturing the environment in which it was defined so that it can
> execute in that environment when called.
> 
> example:
> (define (make-counter)
>   (let ((x 0))
>      (lambda () 
>         (set! x (add1 x))
>         x)))
> 
> make-counter returns a procedure that, when called, increments the
> value of its local variable x each time. Several procedures can be
> defined using make-counter, but each one has access to its own local
> x.
> 
> > (define counter1 (make-counter))
> > (define counter1 (make-counter))
> > (counter1)
> 1
> > (counter1)
> 2
> > (counter2)
> 1
> > (counter1)
> 3
> 
> 
> if you like "The Little Schemer" you should probably check out
> "essentials of programming languages" by Daniel Friedman, 
> Mitchell Wand, and
> Christopher Haynes. A new edition was just released by MIT Press. I
> haven't had a chance to evaluate it yet, though, so I can't comment on
> it's quality.
> 
> From a teaching perspective, Concrete Abstractions (Hailperin, Kaiser,
> Knight; Brooks/Cole Publishing Company) and Simply Scheme (Harvey and
> Wright; MIT Press) are both good books. However, they both fail the
> "closure test". Interesting enough, Essentials of Programming
> Languages *does* have it listed, though.
> 
> Also failing the "closure test" is the r5rs standards!
> 
> -bogo
> 
> 
> On Feb 06, 2001 11:59, Tim Hanson wrote:
> | hi, I read SICP a number of years ago and was mostly 
> delighted, in stark
> | contrast to a number of unimpressed reviewers cited in this 
> space in the past
> | couple weeks! :)
> | 
> | my scheme skills, however, have atrophied considerably in 
> the past few
> | years, during which time I've been paid to do more 
> "scripting" using ksh, awk,
> | perl, and more recently MS's "windows script host" and 
> "active server pages."
> | 
> | i tried to follow a recent discussion which mentioned tail 
> recursion and
> | closures. i remember tail recursion from SICP, but had 
> forgotten what a closure
> | is and I didn't find it in the index of my old copy (nor in 
> the index of "the
> | little schemer", the only other book on scheme I have. ah, 
> wait! the latter
> | has "apply-closure" and I find what I wanted to know: a 
> closure is "a
> | non-primitive function"?)
> | 
> | i was going to ask: can folks recommend good books on 
> scheme, including ones
> | that define "closure." i guess I can still ask that and can 
> also appeal to
> | the authors among you to include it in the index in your 
> next editions! :)
> | 
> | cheers,
> | 
> | Tim Hanson
> | 
> | -- 
> | Sent through GMX FreeMail - http://www.gmx.net
> | 
>