> On 13 Dec 2021, at 21:04, Marco Antoniotti <marco.antonio...@unimib.it> 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.
> 

The inner define needs to receive the remainder of the body of the outer define 
as one of its arguments. Common Lisp’s defmacro sees only arguments passed 
directly to the macro itself, not whatever comes after the macro invocation.

The only way to solve that is that the outer define parses its body and looks 
for inner defines, and then rearranges the forms into the proper binding forms 
(letrec* in Scheme, let*/labels in Common Lisp, depending on which namespace 
you want to affect).

Pascal

Reply via email to