[plt-scheme] Re: Basic Scheme question: Do functions have to be defined

From: Guenther Schmidt (gue.schmidt at web.de)
Date: Mon Dec 15 09:11:11 EST 2003

Dear Mike,

thanks, I had only realized how silly the question actually was after I've clicked on the "Send" button.
A typical case of "speak before thinking" at around 3.00 am.

Best regards
Günther


Mike T. Machenry wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> This is true in both PLT and R5RS. Just to clarify though, they can be
> referenced before they are defined so long as they are not called (delayed
> by a lambda for example).
> 
> (define (f n)
>   (+ 1 (g n)))
> 
> (define (g x)
>   (+ 1 x))
> 
> (f 2)
> 
> Notice f *references* g before it's defined. This program works. It would not
> work if I did this
> 
> (define (f n)
>   (+ 1 (g n)))
> 
> (f 2)
> 
> (define (g x)
>   (+ 1 x))
> 
> Because (f 2) *calls* g before it's defined.
> 
> -mike
> 
> On Sun, Dec 14, 2003 at 11:43:16PM +0000, Guenther Schmidt wrote:
> 
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>>... *before* you can refer to them?
>>
>>It seems to be the way in PLT but is this set so also by R5RS?
>>
>>
>>Regards
>>Guenther
>>
> 
> 




Posted on the users mailing list.