chickadee » sicp » stream-for-each

stream-for-each proc sprocedure

Applies proc to every element of s, consuming it.

proc
The procedure to apply
s
The stream to apply to
(define (stream-for-each proc s)
  (if (stream-null? s)
    'done
    (begin (proc (stream-car s)) (stream-for-each proc (stream-cdr s)))))