chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Named let*


From: Jim Ursetto
Subject: Re: [Chicken-users] Named let*
Date: Wed, 29 May 2013 15:25:26 -0500

On May 29, 2013, at 3:20 PM, Patrick Li <address@hidden> wrote:

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?

This is why my solution takes one argument, and does not need named-let*: as the second argument is computed from the first, there is no reason to pass it into the loop procedure, as you would not do this when calling a procedure normally.  Passing in a second argument with an unused initial value just confuses things.

Jim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]