about summary refs log tree commit diff stats
path: root/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.5/show-stream.scm
blob: e9d42f3283189e04ffc8fa01740e209030095e7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(define (show-stream strm . args) ;2nd arg is how many
  (if (null? args)
      (ss1 strm 10 10)
      (ss1 strm (car args) (car args))))

(define ss show-stream)

(define (ss1 strm this all)
  (cond ((null? strm) '())
	((= this 0) '(...))
	((and (pair? strm) (procedure? (cdr strm)))
	 (cons (ss1 (stream-car strm) all all)
	       (ss1 (stream-cdr strm) (- this 1) all)))
	(else strm)))