Indexing #
Length #
A List is empty iff it has length zero.
A List is nonempty iff it has length greater than zero.
Membership #
If i is a valid index of List xs, then xs[i] is a member of xs.
Sublists #
The last entry of a nonempty List has index 1 less than its length.
If a List has a tail? defined, it must be nonempty.
Zips #
The length of a zip consisting of a List and its tail is the length of the
List's tail.
An index less than the length of a zipWith is less than the length of the left
operand.
An index less than the length of a zipWith is less than the length of the left
operand.
Pairwise #
Given a List xs of length k, this function produces a List of length
k - 1 where the ith member of the resulting List is f xs[i] xs[i + 1].
Equations
- List.pairwise xs f = match List.tail? xs with | none => [] | some ys => List.zipWith f xs ys
Instances For
If List xs is empty, then any pairwise operation on xs yields an empty
List.
If List xs is nonempty, then any pairwise operation on xs has length
xs.length - 1.
If a pairwise'd List isn't empty, then the input List must have at least
two entries.
If x is a member of a pairwise'd list, there must exist two (adjacent)
entries of the list, say x₁ and x₂, such that x = f x₁ x₂.