This library provides a procedure wrap-expr/c for applying contracts to macro subexpressions.
procedure
expr[ #:arg?arg?#:positivepos-blame#:negativeneg-blame#:nameexpr-name#:macromacro-name#:contextcontextcontract-expr:syntax?expr:syntax?= 'from-macro= 'use-site
The other arguments have the same meaning as for expr/c .
#:name"the parameter argument"#:contextstx)])'(1 2 3)
> (myparameterize1(['whoops'something])'whatever)myparameterize1: contract violation
expected: parameter?
given: 'whoops
in: parameter?
macro argument contract on the parameter argument
contract from: top-level
blaming: top-level
(assuming the contract is correct)
at: eval:4:0
[(appfarg)#'f#:name"the function argument"#:contextstx)])#'(cfarg))]))6
app: broke its own contract
promised: number?
produced: 'apple
in: the 1st argument of
(-> number? number?)
macro argument contract on the function argument
contract from: 'mod
blaming: (quote mod)
(assuming the contract is correct)
at: eval:8:0
app: contract violation
expected: number?
given: 'pear
in: the range of
(-> number? number?)
macro argument contract on the function argument
contract from: 'mod
blaming: top-level
(assuming the contract is correct)
at: eval:9:0
Added in version 6.3 of package base.
Changed in version 7.2.0.3: Added the #:arg? keyword argument
and changed the default values and interpretation of the
#:positive and #:negative arguments.
Changed in version 7.3.0.3: Added the #:phase keyword argument.