This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about define-syntax



I just tried the below in the version of Kawa I'm using, and it works in the REPL, after you change the define-for-syntax into a plain define.


On Feb 8, 2008, at 9:30 AM, Luis Casillas wrote:

(define-syntax func-with-pairs
(lambda (stx)
(syntax-case stx ()
((_ fn . rest)
(odd? (length (syntax-object->datum #'rest)))
(error "func-with-pairs must have an even number of arguments"))
((_ fn . rest)
(with-syntax ((conses (make-pair-list #'rest)))
(syntax
(fn . conses)))))))


;; Kawa doesn't have define-for-syntax; just use define
(define-for-syntax (make-pair-list stx)
  (syntax-case stx ()
    (()
     (syntax ()))
    ((a b . rest)
     (with-syntax ((rest-conses (make-pair-list #'rest)))
       (syntax
        ((cons a b) . rest-conses))))))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]