This is the mail archive of the kawa@sources.redhat.com 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]

Calling define within define-syntax


Didn't this used to work?

    (define-syntax define*
      (syntax-rules ()
        ((define* (name arg ...) body ...)
         (define (name arg ... )
           (format #t "--- start ~S~%" name)
           (let ((res (begin body ...)))
             (format #t "--- end ~S~%" name)
             res)))))

    (define* (fact n)
      (if (< n 2)
          1
          (* n (fact (- n 1)))))

Now, when I compile I get: 

  Foo2.scm:19:1: define is only allowed in a <body>

where line 19 is where fact is defined.


Regards,
Chris Dean


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