Ronald Legere <firstname.lastname@example.org> wrote:
| I was trying some very simple examples
| with define-macro and get the following error
| build-path: expects type <string or 'up or 'same> as 1st argument, given:
| #f; other arguments were: "C:\\"
| all I did was: (define-macro test 3)
| ... just define-macro is broken.
Well, if define-macro is "broken", the *only* thing that's broken
is the error message -- you're not using it correctly. From the
on-line manual (which you should be able to get to through the
Help Desk, I think):
Global macros are defined with define-macro:
(define-macro name procedure-expr)
When the macro is later ``applied,'' the (unevaluated) argument
S-expressions are passed to the procedure obtained from procedure-expr.
The result is a new S-expression that replaces the macro application
expression in its context. If procedure-expr evaluates to a
non-procedure, the exn:misc exception is raised.
And, indeed, when I try your example, I (correctly) get an error:
> (define-macro test 3)
define-macro: not a procedure
Compare this with using a procedure:
> (define-macro test (lambda () 3))
> (+ 21 (test))
p.s. Or pehaps were you trying to define an identifier macro instead?
for the details, but:
> (define-id-macro test 3)
> (+ 15 test)
Rob Warnock, 31-2-510 email@example.com
SGI Network Engineering <URL:http://reality.sgi.com/rpw3/>
1600 Amphitheatre Pkwy. Phone: 650-933-1673
Mountain View, CA 94043 PP-ASEL-IA