Add for/set and for*/set to Typed Racket.

This commit is contained in:
Sam Tobin-Hochstadt 2015-01-16 09:43:20 -05:00
parent e7d61bd982
commit 9a39c3e793
4 changed files with 10 additions and 1 deletions

View File

@ -147,6 +147,7 @@ preferred to use of @racket[define:].
@defidform[for*/last:]
@defidform[for*/list:]
@defidform[for*/lists:]
@defidform[for*/set:]
@defidform[for*/or:]
@defidform[for*/product:]
@defidform[for*/sum:]
@ -163,6 +164,7 @@ preferred to use of @racket[define:].
@defidform[for/last:]
@defidform[for/list:]
@defidform[for/lists:]
@defidform[for/set:]
@defidform[for/or:]
@defidform[for/product:]
@defidform[for/sum:]

View File

@ -237,6 +237,7 @@ variants.
@defform[(for/last type-ann-maybe (for-clause ...) expr ...+)]
@defform[(for/sum type-ann-maybe (for-clause ...) expr ...+)]
@defform[(for/product type-ann-maybe (for-clause ...) expr ...+)]
@defform[(for/set type-ann-maybe (for-clause ...) expr ...+)]
@defform[(for*/list type-ann-maybe (for-clause ...) expr ...+)]
@defform[(for*/hash type-ann-maybe (for-clause ...) expr ...+)]
@defform[(for*/hasheq type-ann-maybe (for-clause ...) expr ...+)]
@ -250,6 +251,7 @@ variants.
@defform[(for*/last type-ann-maybe (for-clause ...) expr ...+)]
@defform[(for*/sum type-ann-maybe (for-clause ...) expr ...+)]
@defform[(for*/product type-ann-maybe (for-clause ...) expr ...+)]
@defform[(for*/set type-ann-maybe (for-clause ...) expr ...+)]
]]{
These behave like their non-annotated counterparts, with the exception
that @racket[#:when] clauses can only appear as the last

View File

@ -66,6 +66,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
[for/first: for/first]
[for/last: for/last]
[for/fold: for/fold]
[for/set: for/set]
[for*: for*]
[for*/list: for*/list]
[for*/lists: for*/lists]
@ -80,6 +81,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
[for*/first: for*/first]
[for*/last: for*/last]
[for*/fold: for*/fold]
[for*/set: for*/set]
[-do do]
[-do do:]
[with-handlers: with-handlers]
@ -105,6 +107,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
"base-types-extra.rkt"
"case-lambda.rkt"
'struct-extraction
racket/set
racket/flonum ; for for/flvector and for*/flvector
racket/extflonum ; for for/extflvector and for*/extflvector
(for-label (only-in "base-types-extra.rkt" Values)
@ -1047,6 +1050,8 @@ This file defines two sorts of primitives. All of them are provided into any mod
...))]))
(define-for/acc:-variants
(for/sum: for/fold: for/sum #f + 0 #%expression)
(for/set: for/fold: for/set #f set-add (set) #%expression)
(for*/set: for*/fold: for*/set #t set-add (set) #%expression)
(for*/sum: for*/fold: for*/sum #t + 0 #%expression)
(for*/list: for*/fold: for*/list #t (lambda (x y) (cons y x)) null reverse)
(for/product: for/fold: for/product #f * 1 #%expression)

View File

@ -289,7 +289,7 @@
(except-in typed-racket/utils/utils private)
;; Needed for bindings of types and TR primitives in expressions
(except-in (base-env extra-procs prims base-types base-types-extra)
define lambda λ case-lambda)
define lambda λ case-lambda for/set for*/set)
;; For tests that rely on kw/opt properties
(prefix-in tr: (only-in (base-env prims) define lambda λ case-lambda))
;; Needed for the `let-name` syntax class before