Re: [racket-users] Re: Operations that create objects

2016-12-16 Thread Gustavo Massaccesi
Two examples: #lang racket (define (create-function-that-show-number n) (display "*") (lambda () (displayln n))) ;Create the function (define f7 (create-function-that-show-number 7)) ;Use it (displayln "Hello") (f7) (displayln "World!") ;--- ;Something more complex

Re: [racket-users] Re: Operations that create objects

2016-12-16 Thread Philip McGrath
The outer function must return the inner function (or otherwise make it reachable, perhaps inside some data structure). For example: > (define (make-counter init) (define (counter) (set! init (add1 init)) init) (displayln "Making a counter!") counter) > (define count-from-f

Re: [racket-users] Re: Operations that create objects

2016-12-16 Thread Jan Hondebrink
Thank you so much. This is extremely helpful and instructive. One thing I don't understand: how do you call or access an inner function after its outer function has completed? On Fri, Dec 16, 2016 at 5:41 AM, George Neuner wrote: > On Thu, 15 Dec 2016 06:03:54 -0800 (PST), NeverTooOldToCode >