chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] macrolet


From: Graham Fawcett
Subject: Re: [Chicken-users] macrolet
Date: Fri, 7 Mar 2008 16:23:22 -0500

On Fri, Mar 7, 2008 at 3:56 PM, Lui Fungsin <address@hidden> wrote:
> Hi Graham,
>
>  Thanks for the reply. But it wouldn't do it for me because I'm trying
>  to capture a binding at macro expansion time, not run runtime.
>
>  Use case : (to support CL like (return-from) clause with call/cc)
>
>  (define-macro (defun name args . body)
>   (with-gensyms (return)
>    `(define ,name
>       (lambda ,args
>         (call/cc
>          (lambda (,return)
>            (macrolet ((return-from (proc value)
>                        ;; ignore proc name
>                        (,return value)))
>              ,@body)))))))

I've only looked at this for a second, but couldn't you just use
(lambda (return-from) ...) instead of (lambda (,return) ...)? If
you're nesting these environments, I could see that would be problem
-- naming the return-from context would be important -- but in a
single defun with a single call/cc, it's not such an issue.

I know it doesn't answer your question, it's just my two-cents
observation while I'm packing up to go home. :-)

Graham




reply via email to

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