Hi Michele,

I realized after posting my version of named-let*, that you actually
*cannot* use it to accomplish all of what you want. For that you do need
loop to be a syntactic extension, as mentioned by Jorg.

For instance, my named-let* macro would not simplify the example you posted
earlier:

(let loop ((i (some-function)) (ch (string-ref buf (some-function))))
  (do-something)
  (if (some-condition-is-true)
    (loop (+ i 1)
          (string-ref buf (+ i 1)))))

The key issue underlying this is, when you call (loop), would you like to
call it with one or two arguments?

   -Patrick


On Wed, May 29, 2013 at 12:25 PM, Michele La Monaca <
mikele.chic...@lamonaca.net> wrote:

> On Wed, May 29, 2013 at 3:53 PM, Patrick Li <patrickli.2...@gmail.com>
> wrote:
> > If I understand the OP correctly, he wants let* to imitate this macro.
> >
> > (define-syntax named-let*
> >   (syntax-rules ()
> >     ((named-let* name ((var val) ...)
> >         body ...)
> >      (let* ((var val) ...)
> >        (let name ((var var) ...)
> >          body ...)))))
> >
>
> Exactly. Thanks for writing it down.
>
> Ciao,
> Michele
>
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to