Dave Herman (dherman who is at ccs dot neu dot edu) sent me a very insightful 
email.  With his permission, I'm reposting it to the list, as I received it.  
It notes an error I made in discussing "and" and "or" in Scheme.

----- Start Forwarded Message -----
I am a fan of your work on "sweet-expressions". I think it has a lot of 
promise. (And the page is so well-written, too!)

One minor note on your recent blog entry about it. You claim that && and 
|| can be aliased to AND and OR, respectively, by writing:

(define && and)
(define || or)

This isn't quite true, at least in Scheme. Since AND and OR are not 
functions but rather special forms, you need macros for this.

(define-syntax &&
   (syntax-rules ()
     ((&& exprs ...)
      (and exprs ...))))

Or you could use a simple aliasing macro:

(define-syntax define-alias
   (syntax-rules ()
     ((define-alias x y)
      (define-syntax x
        (syntax-rules ()
          ((x exprs (... ...))
           (y exprs (... ...))))))))

(define-alias && and)
(define-alias || or)

(I'm not sure what the corresponding surface syntax for the above would 
be in the context of sweet-expressions.)

Dave


----- End Forwarded Message -----

(My thanks to Dave Herman.  My tests _had_ worked in Guile, which led me 
astray.  He correctly noted that some Schemes don't have a strict phase 
separation between macros
and evaluation.  Obviously, guile is one of them.)


Reply via email to