Module pair

Module pair 

Source
Expand description

Functionsยง

append
Applied to two pair-encoded lists it concatenates them.
cons
Applied to two terms it returns them contained in a pair-encoded list; equivalent to pair::pair.
drop
Applied to a Church-encoded number n and a pair-encoded list it returns a new list without the first n elements of the supplied list.
drop_while
Applied to a predicate function and a pair-encoded list it returns a new list without the prefix of the supplied list whose elements satisfy the predicate function.
filter
Applied to a predicate and a pair-encoded list it filters the list based on the predicate.
foldl
Applied to a function, a starting value and a pair-encoded list it performs a left fold on the list.
foldr
Applied to a function, a starting value and a pair-encoded list it performs a right fold on the list.
head
Applied to a pair-encoded list it returns its first element; equivalent to pair::fst.
index
Applied to a Church-encoded number i and a pair-encoded list it returns the i-th (zero-indexed) element of the list.
init
Applied to a pair-encoded list it returns the list without the last element.
is_nil
Applied to a pair-encoded list it determines if it is empty.
last
Applied to a pair-encoded list it returns the last element.
length
Applied to a pair-encoded list it returns its Church-encoded length.
list
Applied to a Church-encoded number n and n Terms it creates a pair-encoded list of those terms.
map
Applied to a function and a pair-encoded list it maps the function over it.
nil
Produces a nil, the last link of a pair-encoded list; equivalent to boolean::fls.
replicate
Applied to a Church-encoded number n and an argument, it produces a list containing the argument repeated n times.
reverse
Reverses a pair-encoded list.
tail
Applied to a pair-encoded list it returns a new list with all its elements but the first one; equivalent to pair::snd.
take
Applied to a Church-encoded number n and a pair-encoded list it returns a new list with the first n elements of the supplied list.
take_while
Applied to a predicate function and a pair-encoded list it returns the longest prefix of the list whose elements all satisfy the predicate function.
zip
Applied to two pair-encoded lists it returns a list of corresponding pairs. If one input list is shorter, excess elements of the longer list are discarded.
zip_with
Applied to a function and two pair-encoded lists it applies the function to the corresponding elements and returns the resulting list. If one input list is shorter, excess elements of the longer list are discarded.