Macros
======
[FIXME: This needs some more text on the difference between procedures,
macros and memoizing macros. Also, any definitions listed here should
be double-checked by someone who knows what's going on. Ask Mikael, Jim
or Aubrey for help. -twp]
- primitive: procedure->syntax code
Returns a "macro" which, when a symbol defined to this value
appears as the first symbol in an expression, returns the result
of applying CODE to the expression and the environment.
- primitive: procedure->macro code
Returns a "macro" which, when a symbol defined to this value
appears as the first symbol in an expression, evaluates the result
of applying CODE to the expression and the environment. The value
returned from CODE which has been passed to
`procedure->memoizing-macro' replaces the form passed to CODE.
For example:
(define trace
(procedure->macro
(lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
(trace foo) == (set! foo (tracef foo 'foo)).
- primitive: procedure->memoizing-macro code
Returns a "macro" which, when a symbol defined to this value
appears as the first symbol in an expression, evaluates the result
of applying PROC to the expression and the environment. The value
returned from PROC which has been passed to
`procedure->memoizing-macro' replaces the form passed to PROC.
For example:
(define trace
(procedure->macro
(lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
(trace foo) == (set! foo (tracef foo 'foo)).
- primitive: macro? obj
Return `#t' if OBJ is a regular macro, a memoizing macro or a
syntax transformer.
- primitive: macro-type m
Return one of the symbols `syntax', `macro' or `macro!', depending
on whether OBJ is a syntax tranformer, a regular macro, or a
memoizing macro, respectively. If OBJ is not a macro, `#f' is
returned.
- primitive: macro-name m
- primitive: macro-transformer m
- primitive: cons-source xorig x y
Create and return a new pair whose car and cdr are X and Y. Any
source properties associated with XORIG are also associated with
the new pair.