13 Legacy Forms
The following forms are provided by Typed Racket for backwards compatibility.
syntax
(lambda: formals maybe-ret . body)
maybe-ret =
| : type formals = ([v : t] ...) | ([v : t] ... v : t *) | ([v : t] ... v : t ooo bound)
syntax
(λ: formals maybe-ret . body)
syntax
(opt-lambda: formals maybe-ret . 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 maybe-ret . body)
(popt-lambda: (a ... a ooo) formals maybe-ret . 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] ...) : t0 . 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
(define-struct/exec name-spec ([f : t] ...) [e : proc-t] maybe-type-name)
name-spec = name-id | (name-id parent) maybe-type-name =
| #:type-name type-id
Changed in version 1.13 of package typed-racket-lib: Deprecated
Changed in version 1.4 of package typed-racket-lib: Added the #:type-name option.
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
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)
type constructor
syntax
type constructor
type constructor
type constructor
type constructor