guile-user
[Top][All Lists]
Advanced

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

Re: Need help with macro


From: Mike Gran
Subject: Re: Need help with macro
Date: Thu, 13 Dec 2018 10:15:19 -0800
User-agent: Mutt/1.10.1 (2018-07-13)

> 
> I think this would work:
> 
>   (define-syntax-rule (send self (method args ...))
>     (call-method self
>                  (symbol->string 'method)
>                  (list args ...)))
> 
> For example,
> 
>   (send date (set-dmy 1 1 2018))
> 
> will be expanded to
> 
>   (call-method date
>                (symbol->string 'set-dmy)
>                (list 1 1 2018))
> 
> which is equivalent to
> 
>   (call-method date "set-dmy" (list 1 1 2018))
> 

Thanks for your help!

-Mike Gran





reply via email to

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