Next: iklib syntaxes bindings, Previous: iklib syntaxes defines, Up: iklib syntaxes [Index]
define-syntax
–like additional syntaxesVicare extends define-syntax
as defined by R6RS; it
additionally accepts the syntax:
(define-syntax (?name ?arg) ?body0 ?body …) → (define-syntax ?name (lambda (?arg) ?body0 ?body …))
and the syntax:
(define-syntax ?name) → (define-syntax ?name (syntax-rules ()))
Additionally, when the last form is used:
__who__
is bound to the quoted
?name.
__synner__
is bound to a function we can use
to raise syntax violation exceptions; the function looks as follows:
(case-define synner ((message) (syntax-violation (quote ?name) message ?arg #f)) ((message subform) (syntax-violation (quote ?name) message ?arg subform)))
Like define
but create an immutable binding.
(define-constant X 1) X ⇒ 1 (set! X 2) error→ &syntax
Convenience syntax to define a syntax-rules
transformer with a
single clause. Expand to:
(define-syntax-rule (?name ?pattern … . ?rest) ?body0 ?body …) → (define-syntax ?name (syntax-rules () ((_ ?pattern … . ?rest) (begin ?body0 ?body …))))
Define auxiliary syntaxes to be used as literal identifiers by
syntax-rules
, syntax-case
and similar macros; expand to:
(define-syntax ?name0 (syntax-rules ())) (define-syntax ?name (syntax-rules ())) …
Define a new binding for ?alias-id as an alias for ?old-id, which must be a bound identifier in the current lexical environment.
(let ((a 1)) (define-alias b a) b) ⇒ 1
Next: iklib syntaxes bindings, Previous: iklib syntaxes defines, Up: iklib syntaxes [Index]