Thank you for the examples and clarification.
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit
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
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
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
On Thu, 15 Dec 2016 06:03:54 -0800 (PST), NeverTooOldToCode
wrote:
>Racket Reference section 1.1.5 states: "Operations that create
>objects, such as vector, add to the set of objects" followed
>by a nice and instructive step-by-step evaluation example.
>Further on, lambda
5 matches
Mail list logo