7.7
3.7 List
(require cur/stdlib/list) | package: cur-lib |
This library defines the datatype List and several functions on them.
1 parameter type
constructor
constructor
The polymorphic list datatype.
syntax
(build-list A e ...)
A form for iterated application of cons.
Examples:
> (build-list Nat) (nil (Nat))
> (build-list Nat z) (cons (Nat) (z) (nil (Nat)))
> (build-list Nat z (s z)) (cons (Nat) (z) (cons (Nat) (s (z)) (nil (Nat))))
procedure
(list-append A ls1 ls2) → (List A)
A : Type ls1 : (List A) ls2 : (List A)
Examples:
> (list-append Nat (nil Nat) (nil Nat)) (nil (Nat))
> (list-append Nat (build-list Nat z (s z)) (build-list Nat (s z))) (cons (Nat) (z) (cons (Nat) (s (z)) (cons (Nat) (s (z)) (nil (Nat)))))