[racket-dev] Need a clarification on the implementation of stream-map
On Jul 8, 2012, at 7:25 AM, Daniel King wrote:
> (define (stream-map f s)
> (unless (procedure? f) (raise-argument-error 'stream-map "procedure?" f))
> (unless (stream? s) (raise-argument-error 'stream-map "stream?" s))
On a related note, the above kind of checks should really become real contracts. -- Matthias
> (let loop ([s s])
> (cond
> [(stream-empty? s) empty-stream]
> [else (stream-cons (call-with-values (lambda () (stream-first s)) f)
> (loop (stream-rest s)))])))