From e69f66fd00a859b1e507611a27a47d0f4816ddc7 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Thu, 21 Feb 2013 10:49:17 -0500 Subject: [PATCH] Add examples of function types with keyword arguments. --- .../typed-racket/scribblings/reference/types.scrbl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/collects/typed-racket/scribblings/reference/types.scrbl b/collects/typed-racket/scribblings/reference/types.scrbl index 75dd441ea8..194eb3bdcd 100644 --- a/collects/typed-racket/scribblings/reference/types.scrbl +++ b/collects/typed-racket/scribblings/reference/types.scrbl @@ -426,12 +426,19 @@ functions and continuation mark functions. second occurrence of @racket[...] is literal, and @racket[bound] must be an identifier denoting a type variable. In the fourth form, there must be only one @racket[dom] and @racket[pred] is the type - checked by the predicate. + checked by the predicate. @racket[dom] can include both mandatory and + optional keyword arguments. @ex[(λ: ([x : Number]) x) (λ: ([x : Number] . [y : String *]) (length y)) ormap - string?]} + string? + (:print-type file->string) + (: is-zero? : Number #:equality (Number Number -> Any) [#:zero Number] -> Any) + (define (is-zero? n #:equality equality #:zero [zero 0]) + (equality n zero)) + (is-zero? 2 #:equality =) + (is-zero? 2 #:equality eq? #:zero 2.0)]} @defidform[Procedure]{is the supertype of all function types.}