Lazyness properties of
Nat makes it ideal for lazy list length computation.
length [1..] > 100
length undefined >= 0
length (undefined: undefined) >= 1
Rank computation with lazy Peano numbers.
The dependence function represents a graph with multiedges (edges with multiple start nodes).
dependence n is the list of the start nodes of all multiedges whose end node is
nodeRank n computes the length of the shortest path to
n. Note that if
n is an end point of a multiedge with no start point,
nodeRank n == 0.
dependence n == then
nodeRank n == infinity, because
nis not accessable.
any null (dependence n)then
nodeRank n == 0
- Otherwise if
dependence n == [l1, l2, ..]then
nodeRank n == 1 + minimum [maximum (map nodeRank l1), maximum (map nodeRank l2), ..]
If there is an inevitable cycle in the graph, the rank is
One can observe these cases, due to the observable infinity value.