File tree Expand file tree Collapse file tree 3 files changed +14
-40
lines changed
typed-racket-doc/typed-racket/scribblings/reference
typed-racket-lib/typed-racket/base-env
typed-racket-test/succeed Expand file tree Collapse file tree 3 files changed +14
-40
lines changed Original file line number Diff line number Diff line change @@ -35,32 +35,22 @@ A polymorphic function, abstracted over the type variables
35
35
@racket[a]. The type variables @racket[a] are bound in both the types
36
36
of the formal, and in any type expressions in the @racket[body].}
37
37
38
- @defalias[pλ: plambda: "syntax " ]
39
-
40
38
@defform/subs[(opt-lambda: formals maybe-ret . body)
41
39
([formals ([v : t] ... [v : t default] ... )
42
40
([v : t] ... [v : t default] ... v : t *)
43
41
([v : t] ... [v : t default] ... v : t ooo bound)])]{
44
42
A function with optional arguments.}
45
43
46
- @defalias[opt-λ: opt-lambda: "syntax " ]
47
-
48
44
@defform*[[(popt-lambda: (a ... ) formals maybe-ret . body)
49
45
(popt-lambda: (a ... a ooo) formals maybe-ret . body)]]{
50
46
A polymorphic function with optional arguments.}
51
47
52
- @defalias[popt-λ: popt-lambda: "syntax " ]
53
-
54
48
@defalias[case-lambda: case-lambda "syntax " ]
55
49
56
- @defalias[case-λ: case-lambda: "syntax " ]
57
-
58
50
@defform*[[(pcase-lambda: (a ... ) [formals body] ... )
59
51
(pcase-lambda: (a ... b ooo) [formals body] ... )]]{
60
52
A polymorphic function of multiple arities.}
61
53
62
- @defalias[pcase-λ: pcase-lambda: "syntax " ]
63
-
64
54
@defform*[[
65
55
(let: ([v : t e] ... ) . body)
66
56
(let: loop : t0 ([v : t e] ... ) . body)]]{
Original file line number Diff line number Diff line change 18
18
(provide (rename-out [-case-lambda case-lambda ]
19
19
[-case-lambda case-lambda:]
20
20
[-case-lambda case-λ]
21
- [-case-lambda case-λ:]
22
- [pcase-lambda: pcase-λ:]
23
- [plambda: pλ:]
24
- [lambda: λ:]
25
- [popt-lambda: popt-λ:]
26
- [opt-lambda: opt-λ:])
21
+ [lambda: λ:])
27
22
pcase-lambda:
28
23
plambda:
29
24
-lambda
Original file line number Diff line number Diff line change 1
1
#lang typed/racket/base
2
2
3
- (: foo0 (∀ () (→* ((∪ Symbol String)) (Integer) (Pair Boolean Integer))))
4
- (: foo1 (∀ () (→* ((∪ Symbol String) Integer) () (Pair Boolean Integer))))
5
- (: foo2 (∀ () (→* ((∪ Symbol String) Integer) () (Pair Boolean Integer))))
6
- (: foo3 (∀ () (→* ((∪ Symbol String)) (Integer) (Pair Boolean Integer))))
7
- (: foo4 (∀ () (→* ((∪ Symbol String)) (Integer) (Pair Boolean Integer))))
8
- (define foo0 (λ #:∀ () ([s : (∪ Symbol String)] [i : Integer 0 ]) : (Pair Boolean Integer) (cons (symbol? s) i)))
9
- (define foo1 (λ: ([s : (∪ Symbol String)] [i : Integer]) : (Pair Boolean Integer) (cons (symbol? s) i)))
10
- (define foo2 (pλ: () ([s : (∪ Symbol String)] [i : Integer]) : (Pair Boolean Integer) (cons (symbol? s) i)))
11
- (define foo3 (opt-λ: ([s : (∪ Symbol String)] [i : Integer 0 ]) : (Pair Boolean Integer) (cons (symbol? s) i)))
12
- (define foo4 (popt-λ: () ([s : (∪ Symbol String)] [i : Integer 0 ]) : (Pair Boolean Integer) (cons (symbol? s) i)))
13
- (foo0 'abc 0 ) (foo0 "abc " 0 )
14
- (foo1 'abc 0 ) (foo1 "abc " 0 )
15
- (foo2 'abc 0 ) (foo2 "abc " 0 )
16
- (foo3 'abc 0 ) (foo3 "abc " 0 )
17
- (foo4 'abc 0 ) (foo4 "abc " 0 )
3
+ (: foo (→* ((∪ Symbol String)) (Integer) (Pair Boolean Integer)))
4
+ (define foo
5
+ (λ (s [i 0 ])
6
+ (cons (symbol? s) i)))
7
+ (foo 'abc )
8
+ (foo "abc " )
18
9
19
- (: bar0 (∀ () (case→ (→ True) (→ Any False))))
20
- (: bar1 (∀ () (case→ (→ True) (→ Any False))))
21
- (: bar2 (∀ () (case→ (→ True) (→ Any False))))
22
- (define bar0 (case-λ #:∀ () [() #t ] [(_ ) #f ]))
23
- (define bar1 (case-λ: #:∀ () [() #t ] [(_ ) #f ]))
24
- (define bar2 (pcase-λ: () [() #t ] [(_ ) #f ]))
25
- (bar0) (bar0 bar0)
26
- (bar1) (bar1 bar1)
27
- (bar2) (bar2 bar2)
10
+ (: bar (∀ () (case→ (→ True) (→ Any False))))
11
+ (define bar
12
+ (case-λ
13
+ [() #t ]
14
+ [(_ ) #f ]))
15
+ (bar)
16
+ (bar bar)
You can’t perform that action at this time.
0 commit comments