Added documentation example of sequence/c for multiple-valued sequences.
This commit is contained in:
parent
fe3d4c9fe6
commit
126d8192ff
|
@ -201,9 +201,17 @@ for instance, a wrapped list is not guaranteed to satisfy @racket[list?].
|
||||||
#:eval the-eval
|
#:eval the-eval
|
||||||
(define/contract predicates
|
(define/contract predicates
|
||||||
(sequence/c (-> any/c boolean?))
|
(sequence/c (-> any/c boolean?))
|
||||||
(list integer? string->symbol))
|
(in-list (list integer?
|
||||||
|
string->symbol)))
|
||||||
(for ([P predicates])
|
(for ([P predicates])
|
||||||
(printf "~s\n" (P "cat")))
|
(printf "~s\n" (P "cat")))
|
||||||
|
(define/contract numbers&strings
|
||||||
|
(sequence/c number? string?)
|
||||||
|
(in-dict (list (cons 1 "one")
|
||||||
|
(cons 2 "two")
|
||||||
|
(cons 3 'three))))
|
||||||
|
(for ([(N S) numbers&strings])
|
||||||
|
(printf "~s: ~a\n" N S))
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user