PasteRack.org
Paste # 99422
2016-02-09 16:26:24

Fork as a new paste.

Paste viewed 79 times.


Embed:

  1. #lang racket
  2.  
  3. (define (make-stream f n)
  4.   (stream-cons n (make-stream f (f n))))
  5.  
  6. (define naturals
  7.   (make-stream (curry + 1) 0))
  8.  
  9. (define odds
  10.   (make-stream (curry + 2) 1))
  11.  
  12. (stream-ref naturals 5)
  13. (stream-first naturals)

=>

5

0