Helper functions for building streams in Racket

In Racket you can define streams which are kind of lazy lists. So here are a couple of helper functions for easier stream creation: ; returns stream (define (stream-builder seed current-element next-element) (letrec ([lazy-seq (lambda (x) (cons (current-element x) (lambda () (lazy-seq (next-element x)))))]) (lambda () (lazy-seq seed)))) ; returns stream built sequentially (define (seq-stream-builder seed current-element) (stream-builder seed »