diff options
author | rsiddharth <s@ricketyspace.net> | 2019-11-25 18:00:47 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2019-11-25 18:00:47 -0500 |
commit | 4d7236b35641840fcc518b24b8e8427ad65f665c (patch) | |
tree | 6868fbfeef0901c9521d1d062a417bad10bd8029 /net | |
parent | a3cc473443bae2420b7fa6460687eecd7b33a767 (diff) |
Add net/ricketyspace/ror/eleven/lazy.rkt
Diffstat (limited to 'net')
-rw-r--r-- | net/ricketyspace/ror/eleven/lazy.rkt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/ricketyspace/ror/eleven/lazy.rkt b/net/ricketyspace/ror/eleven/lazy.rkt new file mode 100644 index 0000000..6f54719 --- /dev/null +++ b/net/ricketyspace/ror/eleven/lazy.rkt @@ -0,0 +1,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))) |