blob: 6f54719d3b5b7170b86265358e05553e6130060d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#lang racket
(define (make-lazy+ i)
(lambda ()
(apply + (build-list (* 500 i) values))))
(define long-big-list (build-list 5000 make-lazy+))
(define (compute-every-1000th l)
(for/list ([thunk l]
[i (in-naturals)]
#:when (zero? (remainder i 1000)))
(thunk)))
(define (memoize.v2 suspended-c)
(define (hidden)
(define the-value (suspended-c))
(set! hidden (lambda () the-value))
the-value)
(lambda () (hidden)))
|