[racket] Newbie question about local

2013-11-13 Thread Manfred Lotz
(define (g) (define (f x) (* x x)) (f 2)) (define (h) (local [(define (f x) (* x x))] (f 2))) Both functions above work fine. Could anybody tell me what the difference is between those two functions where in one case I use local and in the other case I omit local? -- Thanks, Manf

Re: [racket] Newbie question about local

2013-11-13 Thread Matthias Felleisen
local is a teaching construct that ensures that the semantics of locally defined functions is 100% in sync with 'globally' defined functions. An experienced programmer may ignore local completely. -- Matthias On Nov 13, 2013, at 3:52 PM, Manfred Lotz wrote: > > (define (g) > (define (

Re: [racket] Newbie question about local

2013-11-13 Thread Greg Hendershott
> local is a teaching construct that ensures that the semantics of locally > defined functions is 100% in sync with 'globally' defined functions. An > experienced programmer may ignore local completely. I remember that when I was first learning Racket, `local` was a red herring for me. It was in

Re: [racket] Newbie question about local

2013-11-13 Thread Manfred Lotz
On Wed, 13 Nov 2013 22:26:33 -0500 Greg Hendershott wrote: > > local is a teaching construct that ensures that the semantics of > > locally defined functions is 100% in sync with 'globally' defined > > functions. An experienced programmer may ignore local completely. > > I remember that when I w