SICP Chapter 3.5.3 http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-24.html#%_sec_3.5.3
In section Streams as signals
, SICP gives an audio-visual explanation of Implicit style of definition
-- by feedback loop. But I want to know how to exactly understand the diagram? What's the real advantage and is there any background knowledge?
Take another example, not in Scheme, but in Haskell:
fibs = fix (scanl (+) 0 . (1:))
fibs = fix ((0:) . scanl (+) 1)
We can also draw the signal-flow diagram for either. How can we take advantage of these graphs?
Thanks for advice and information!
For a real audiovisual explanation of the diagrams, why don't you take a look at the accompanying videos? They're in here, lectures 6A and 6B.
As for the "real advantage" of the diagrams, well, they're a visual representation of stream processing, no "background knowledge" is needed for understanding them, AFAIK the notation for these diagrams is part of the idiosyncrasies of SICP, by reading the book and watching the videos you'll know all there's to know about them.
To answer your question in the comments,
Prelude> let bs = 1:map (\n-> sum $ take (n+1) bs) ( map (`div`2) [1..])
Prelude> take 20 bs
[1,1,2,2,4,4,6,6,10,10,14,14,20,20,26,26,36,36,46,46]
Prelude> let as = 1:1:g 2 (drop 2 as) where g x ~(a:b) = x:x:g(x+a)b
Prelude> take 20 as
[1,1,2,2,4,4,6,6,10,10,14,14,20,20,26,26,36,36,46,46]
Prelude> take 20 $ map (\n-> sum $ take (n+1) as) $ map (`div`2) [0..]
[1,1,2,2,4,4,6,6,10,10,14,14,20,20,26,26,36,36,46,46]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With