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

Re: lisp v. scheme macros



I was asked:

> Does this mean that DEFINE-SYNTAX with SYNTAX-RULES is in the default
> language for the CVS version? That was Doug's question, and it is
> R5RS.

Since others might care, too, I'm replying to the entire list:

----------------------------------------------------------------------
Welcome to MzScheme version 199.19, Copyright (c) 1995-2001 PLT
>
(define-syntax qua
  (lambda (exp)
    (syntax-case exp ()
     [(_ body) (syntax (quote body))])))
> (qua 1)
1
> (qua (a b))
(a b)
> (qua 1 2)
STDIN::121: qua: bad syntax in: (qua 1 2)
> 
(define-syntax qqua
  (syntax-rules ()
   [(_ body) `body]))
> (qqua (a b))
(a b)
> (qqua (a ,(+ 1 2)))
(a 3)
----------------------------------------------------------------------

Shriram