Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
;;; Collecting lambdas in a tail-recursive function.
|
||||
(define (build-list-of-functions n i list)
|
||||
(if (< i n)
|
||||
(build-list-of-functions n (+ i 1) (cons (lambda () (* (- n i) (- n i))) list))
|
||||
list))
|
||||
|
||||
(define list-of-functions (build-list-of-functions 10 1 '()))
|
||||
|
||||
(map (lambda (f) (f)) list-of-functions)
|
||||
|
||||
((list-ref list-of-functions 8))
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
'(1 4 9 16 25 36 49 64 81)
|
||||
81
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
(define list-of-functions (map (lambda (x) (lambda () (* x x))) (iota 0 1 10)))
|
||||
|
||||
; print the result
|
||||
(display
|
||||
(map (lambda (n) (n)) list-of-functions)
|
||||
(newline)
|
||||
Loading…
Add table
Add a link
Reference in a new issue