From: John L. Stein
Subject: How can i break compund func into simpler parts using define ?
Date:
Message-ID: <5c65sj$5kg@uni.library.ucla.edu>
From: "John L. Stein" <·····@seas.ucla.edu>
Newsgroups: comp.lang.scheme
Subject: using DEFINE to break complex function into simpler parts
Date: 22 Jan 1997 21:32:20 GMT
Organization: University of California, Los Angeles
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Message-ID: <··········@uni.library.ucla.edu>
The following works.
STk> (define (bite!)
(let ( (n 2) )
(lambda () (write n) )))
#[undefined]
STk> ((bite!))
2#[undefined]
STk>
But the following does'nt work.
Whats the difference ?
I attempt to break this function into two parts as follows.
STk> (define (bite!)
(let ( (n 2) )
(bit!)))
#[undefined]
STk> (define (bit!)
(lambda () (write n) ))
#[undefined]
STk> ((bite!))
*** Error:
unbound variable: n
STk>
Does'nt lambda inherit n = 2 from its parent environment
when ((bite!)) is called ? Isn't it as though the definition
of bit just gets plugged in place of bit ?
Is there another way to break this function into two parts ?
Thanks
-js
PS. Thanks for your previous help.