Cur
3.1 Datum
3.2 Sugar
3.3 Bool
3.4 Nat
3.6 Maybe
3.7 List
3.8 Equality
3.9 ASCII
3.11 Typeclass
On this page:
nil
9.0
top
up

3.7ListπŸ”— i

This library defines the datatype List and several functions on them.

1 parameter type

List :(->TypeType)

constructor

nil :(->(A:Type)(List A))

constructor

cons :(->(A:Type)(a:A)(->(List A)(List A)))

The polymorphic list datatype.

syntax

( build-list Ae...)

A form for iterated application of cons .

Examples:

(nil (Nat))

(cons (Nat)(z)(nil (Nat)))

> (build-list Nat z (s z ))

(cons (Nat)(z)(cons (Nat)(s (z))(nil (Nat))))

procedure

( list-ref Alsn)(Maybe A)

A:Type
ls:(List A)
n:Nat
Returns the nth element of ls in the Maybe monad.

procedure

( list-append Als1ls2)(List A)

A:Type
ls1:(List A)
ls2:(List A)
Returns the nth element of ls in the Maybe monad.

Examples:

(nil (Nat))

(cons (Nat)(s (z))(cons (Nat)(z)(cons (Nat)(s (z))(nil (Nat)))))

top
up

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /