[gambit-list] (define ((...) ...)
Marc Feeley
feeley at iro.umontreal.ca
Tue Aug 25 20:36:32 EDT 2009
Try the following, which does not require define-syntax:
(define-macro (define pattern . rest)
(if (pair? pattern)
`(define ,(car pattern) (##lambda ,(cdr pattern) , at rest))
`(##define ,pattern , at rest)))
(define (((f x) y) z)
(+ x y z))
(define g (f 1))
(define h (g 2))
(pp (h 10))
Marc
On 25-Aug-09, at 8:32 PM, Michele Zaffalon wrote:
> I suppose I have to start Gambit with gsi -:s. Still it doesn't work:
> invalid syntax.
>
> On Tue, Aug 25, 2009 at 7:50 PM, Eduardo Cavazos<wayo.cavazos at gmail.com
> > wrote:
>> Michele Zaffalon wrote:
>>
>>> Now, what doesn't (define ((L-free-particle mass) local) ... work
>>> with
>>> Gambit? What is missing?
>>
>> You can create a new version of 'define' which behaves that way:
>>
>> (define-syntax define*
>> (syntax-rules ()
>> ((_ ((x . f1) . f2) . b)
>> (define* (x . f1)
>> (lambda f2 . b)))
>> ((_ . r)
>> (define . r))))
>>
>> The SICM text should have an explanation of this particular notation.
>>
>> Thanks to Derick Eddington for the definition.
>>
>> Ed
>> _______________________________________________
>> Gambit-list mailing list
>> Gambit-list at iro.umontreal.ca
>> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
More information about the Gambit-list
mailing list