show an example of define-fun-syntax and using the keywords
(cherry picked from commit cdb63b9c77
)
This commit is contained in:
parent
35491070d0
commit
86b781e5bf
|
@ -659,8 +659,17 @@ with a function call.
|
|||
Binds @scheme[id] as a @tech{custom function type}. The type is
|
||||
expanded by applying the procedure produced by
|
||||
@scheme[transformer-expr] to a use of the @tech{custom function
|
||||
type}.}
|
||||
type}.
|
||||
|
||||
For instance, the following defines a new type that automatically coerces
|
||||
the input number to an inexact form which is compatible with the _float type.
|
||||
|
||||
@racketblock[
|
||||
(define-fun-syntax _float*
|
||||
(syntax-id-rules (_float*)
|
||||
[(_float*) (type: _float pre: (x => (+ 0.0 x)))]))
|
||||
|
||||
(_fun _float* -> _bool)]}
|
||||
|
||||
@defidform[_?]{
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user