Structure and Interpretation of Computer Programs by Harold Abelson; Gerald Jay Sussman; Julie Sussman

Structure and Interpretation of Computer Programs by Harold Abelson; Gerald Jay Sussman; Julie Sussman

Author:Harold Abelson; Gerald Jay Sussman; Julie Sussman
Language: eng
Format: mobi
ISBN: 0262011530
Publisher: MIT Press
Published: 2011-12-03T05:58:22+00:00


(define ones (cons-stream 1 ones))

This works much like the definition of a recursive procedure: ones is a pair whose car is 1 and whose cdr is a promise to evaluate ones. Evaluating the cdr gives us again a 1 and a promise to evaluate ones, and so on.

We can do more interesting things by manipulating streams with operations such as add-streams, which produces the elementwise sum of two given streams:62

(define (add-streams s1 s2)

(stream-map + s1 s2))

Now we can define the integers as follows:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.