From 86b781e5bf1e0a6307b31cae4467c547a8b4b61b Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Mon, 18 Apr 2011 17:27:07 -0600 Subject: [PATCH] show an example of define-fun-syntax and using the keywords (cherry picked from commit cdb63b9c77f0a96b4b479f309e9fa6808cbae367) --- collects/scribblings/foreign/types.scrbl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/collects/scribblings/foreign/types.scrbl b/collects/scribblings/foreign/types.scrbl index 485963cb2b..1216772024 100644 --- a/collects/scribblings/foreign/types.scrbl +++ b/collects/scribblings/foreign/types.scrbl @@ -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[_?]{