727 |
|
|
728 |
@deffn {Scheme Procedure} procedure->syntax code |
@deffn {Scheme Procedure} procedure->syntax code |
729 |
@deffnx {C Function} scm_makacro (code) |
@deffnx {C Function} scm_makacro (code) |
730 |
Return a @dfn{macro} which, when a symbol defined to this value |
Return a macro which, when a symbol defined to this value appears as the |
731 |
appears as the first symbol in an expression, returns the |
first symbol in an expression, returns the result of applying @var{code} |
732 |
result of applying @var{code} to the expression and the |
to the expression and the environment. |
|
environment. |
|
733 |
@end deffn |
@end deffn |
734 |
|
|
735 |
@deffn {Scheme Procedure} procedure->macro code |
@deffn {Scheme Procedure} procedure->macro code |
736 |
@deffnx {C Function} scm_makmacro (code) |
@deffnx {C Function} scm_makmacro (code) |
737 |
Return a @dfn{macro} which, when a symbol defined to this value |
Return a macro which, when a symbol defined to this value appears as the |
738 |
appears as the first symbol in an expression, evaluates the |
first symbol in an expression, evaluates the result of applying |
739 |
result of applying @var{code} to the expression and the |
@var{code} to the expression and the environment. For example: |
|
environment. For example: |
|
740 |
|
|
741 |
@lisp |
@lisp |
742 |
(define trace |
(define trace |
743 |
(procedure->macro |
(procedure->macro |
744 |
(lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x)))))) |
(lambda (x env) |
745 |
|
`(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x)))))) |
746 |
|
|
747 |
(trace @i{foo}) @equiv{} (set! @i{foo} (tracef @i{foo} '@i{foo})). |
(trace @i{foo}) |
748 |
|
@equiv{} |
749 |
|
(set! @i{foo} (tracef @i{foo} '@i{foo})). |
750 |
@end lisp |
@end lisp |
751 |
@end deffn |
@end deffn |
752 |
|
|