Scheme like question

Robert Goldman rpgoldman at sift.net
Mon Dec 13 20:41:49 UTC 2021


Maybe I'm missing the point of the question, but I'm not sure I 
understand why that internal `define` is not equivalent to a `let`.  It 
looks like the code is binding its value and then returning that value.  
Unless there's something going on here involving lazy evaluation or 
something?  Without knowing more about how `cons-stream`, `scale-stream` 
and `add-streams` work, it's hard to know.

Do you have a pointer into SICP (chapter, exercise number, etc.)?

On 13 Dec 2021, at 14:04, Marco Antoniotti wrote:

> Hi
>
> apologies for the stupid question.  I was reviewing some teaching 
> material
> and looked at the following Scheme (form SICP) code about "streams".
>
> (define (integral integrand initial-value dt)
>   (define int
>     (cons-stream initial-value
>                  (add-streams (scale-stream integrand dt)
>                               int)))
>   int)
>
> The question is how you'd rendered it in Common Lisp or how you would
> provide some macrology to mimic the inner define.  I know this has 
> been
> asked before...  I am sure somebody knows the answer.
>
> All the best
>
> -- 
> Marco Antoniotti, Professor                           tel. +39 - 02 64 
> 48
> 79 01
> DISCo, Università Milano Bicocca U14 2043   
> http://dcb.disco.unimib.it
> Viale Sarca 336
> I-20126 Milan (MI) ITALY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20211213/48f0160b/attachment.html>


More information about the pro mailing list