12 Legacy Forms
The following forms are provided by Typed Racket for backwards compatibility.
syntax
(lambda: formals . body)
formals = ([v : t] ...) | ([v : t] ... v : t *) | ([v : t] ... v : t ooo bound)
syntax
(λ: formals . body)
syntax
(opt-lambda: formals . body)
formals = ([v : t] ... [v : t default] ...) | ([v : t] ... [v : t default] ... v : t *) | ([v : t] ... [v : t default] ... v : t ooo bound)
syntax
(popt-lambda: (a ...) formals . body)
(popt-lambda: (a ... a ooo) formals . body)
syntax
syntax
(pcase-lambda: (a ...) [formals body] ...)
(pcase-lambda: (a ... b ooo) [formals body] ...)
> (: filter-even : (Listof Natural) (Listof Natural) -> (Listof Natural))
> (define (filter-even lst accum) (if (null? lst) accum (let: ([first : Natural (car lst)] [rest : (Listof Natural) (cdr lst)]) (if (even? first) (filter-even rest (cons first accum)) (filter-even rest accum))))) > (filter-even (list 1 2 3 4 5 6) null) - : (Listof Nonnegative-Integer)
'(6 4 2)
> (: filter-even-loop : (Listof Natural) -> (Listof Natural))
> (define (filter-even-loop lst) (let: loop : (Listof Natural) ([accum : (Listof Natural) null] [lst : (Listof Natural) lst]) (cond [(null? lst) accum] [(even? (car lst)) (loop (cons (car lst) accum) (cdr lst))] [else (loop accum (cdr lst))]))) > (filter-even-loop (list 1 2 3 4)) - : (Listof Nonnegative-Integer)
'(4 2)
syntax
(plet: (a ...) ([v : t e] ...) . body)
syntax
(letrec: ([v : t e] ...) . body)
syntax
(let*: ([v : t e] ...) . body)
syntax
(let-values: ([([v : t] ...) e] ...) . body)
syntax
(letrec-values: ([([v : t] ...) e] ...) . body)
syntax
(let*-values: ([([v : t] ...) e] ...) . body)
syntax
(define: v : t e)
(define: (a ...) v : t e) (define: (a ... a ooo) v : t e) (define: (f . formals) : t . body) (define: (a ...) (f . formals) : t . body) (define: (a ... a ooo) (f . formals) : t . body)
> (define: foo : Integer 10) > (define: (A) mt-seq : (Sequenceof A) empty-sequence)
> (define: (add [first : Integer] [rest : Integer]) : Integer (+ first rest))
> (define: (A) (poly-app [func : (A A -> A)] [first : A] [rest : A]) : A (func first rest))
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
syntax
Changed in version 1.12 of package typed-racket-lib: Added for/foldr: and for*/foldr:.
syntax
syntax
syntax
syntax
syntax
syntax
syntax
(pred t)
syntax
syntax
syntax
syntax
syntax
syntax