chickadee » sicp » stream-map

stream-map proc sprocedure

Constructs a stream which is a proc-mapped s.

proc
The procedure to apply
s
The stream to apply to
(define (stream-map proc s)
  (if (stream-null? s)
    stream-null
    (cons-stream (proc (stream-car s)) (stream-map proc (stream-cdr s)))))