[racket] idiomatic way to take elements from a thunk?
WARNING: TOTALLY UNIMPORTANT QUESTION AHEAD.
I want to enumerate the first 10 values returned by a thunk. I came up with
(define thunk (lambda () 14))
(for/list ([i 10][e (in-producer thunk #f)]) e)
… but I feel like there must be some way to simply write (stream-take thunk 10). Am I missing something obvious?
John
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4800 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120919/705fc628/attachment.p7s>