In section 3.5.4 , i saw this block:
(define (integral delayed-integrand initial-value dt)
(define int
(cons-stream initial-value
(let ((integrand (force delayed-integrand)))
(add-streams (scale-stream integrand dt)
int))))
int)
Normally if this was something like:
(define (stream-map proc s)
(if (stream-null? s)
the-empty-stream
(cons-stream (proc (stream-car s))
(stream-map proc (stream-cdr s)))))
The stream-cdr s
would be evaluated as (cons-stream (stream-car (cdr s)) delay<>)
even when the actual call would be in a delay. ie even though the stream-map function itself is delayed, the arguments are pre-computed.
Then why is let
not pre-computed?
What I think?
I think let
is a lambda function with no arguments, so its execution is delayed
Can someone please help me confirm this?