guile-devel
[Top][All Lists]
Advanced

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

Re: Guile: What's wrong with this?


From: Mark H Weaver
Subject: Re: Guile: What's wrong with this?
Date: Wed, 04 Jan 2012 23:24:45 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

I wrote:
>   (define-syntax define
>     (lambda (x)
>       (with-syntax ((orig-define #'(@ (guile) define)))
>         (syntax-case x ()
>           ((_ (proc arg ...) e0 e1 ...)
>            #'(orig-define proc (lambda (arg ...) e0 e1 ...)))
>           ((_ v e)
>            (identifier? #'v)
>            (if (string? (syntax->datum #'e))
>                #'(orig-define v (string-copy e))
>                #'(orig-define v e)))))))

In case you're planning to use this, I just realized that this syntax
definition has a flaw: it won't handle cases like this:

  (define (map f . xs) ...)

To fix this flaw, change the two lines after syntax-case to:

>           ((_ (proc . args) e0 e1 ...)
>            #'(orig-define proc (lambda args e0 e1 ...)))

The other macro I provided has the same flaw, and the same fix applies.

      Mark



reply via email to

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