propeller.utils

count-points

(count-points tree)
Returns the number of points in tree, where each atom and each pair of parentheses
counts as a point.

depth

(depth tree)
Returns the height of the nested list called tree.
Borrowed idea from here: https://stackoverflow.com/a/36865180/2023312
Works by looking at the path from each node in the tree to the root, and
finding the longest one.
Note: does not treat an empty list as having any height.

ensure-list

(ensure-list thing)
Returns a non-lazy list if passed a seq argument. Otherwise, returns a list
containing the argument.

first-non-nil

(first-non-nil coll)
Returns the first non-nil values from the collection, or returns `nil` if
the collection is empty or only contains `nil`.

indexof

(indexof element coll)
Returns the first index of an element in a collection. If the element is not
present in the collection, returns -1.

not-lazy

(not-lazy lst)
Returns lst if it is not a seq, or a non-lazy version of lst if it is.

random-instruction

(random-instruction instructions)
Returns a random instruction from a supplied pool of instructions, evaluating
ERC-producing functions to a constant literal.

seq-zip

added in 1.0

(seq-zip root)
Returns a zipper for nested sequences, given a root sequence