chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] New to Scheme Macros


From: Alex Shinn
Subject: Re: [Chicken-users] New to Scheme Macros
Date: Thu, 23 Apr 2009 10:07:28 +0900
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin)

John Cowan <address@hidden> writes:

> Jim Ursetto scripsit:
>
>> > Explicit renaming macros look neat; the only kinda "bummer" thing is
>> > having to manually pull apart the components of the expression with
>> > car/cdr/etc. instead of the destructuring happening in a more
>> > automatic way. Of course, I imagine one could write a macro to do
>> > this... :)
>> 
>> Yes -- hence the matchable extension ;)
>
> Matchable is kind of heavyweight compared to destructuring-bind,
> although it can of course do the same job.

  (define-syntax bind
    (syntax-rules ()
      ((_ pat var body ...)
       (match-let ((pat var)) body ...))))

This is both more concise and more powerful than
destructuring-bind.

-- 
Alex




reply via email to

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