<< Previous exercise (4.31) | Index | Next exercise (4.33) >>
; different examples ; in the normal interpreter, "this is car" is printed (define show-1 (cons-stream (begin (display 'this-is-car) 'this-is-car) (begin (display 'this-is-cdr) 'this-is-cdr))) ; in the lazy evaluation interpreter, it is not (define show-2 (cons (begin (display 'this-is-car) 'this-is-car) (begin (display 'this-is-cdr) 'this-is-cdr))) ; examples of applications ; in lazy evaluators, you don't have to worry about the order of definitions (define infinite-matrix-ones (cons ones infinite-matrix-ones)) (define ones (cons 1 ones)) (define (matrix-ref matrix x y) (list-ref (list-ref matrix x) y)) (matrix-ref infinite-matrix-ones 5011 10)
meteorgan