elixush v0.0.2 Elixush.Util
Summary
Functions
Returns a subtree of tree indexed by point-index in a depth first traversal
computes the next row using the prev-row current-element and the other seq
If tree contains subtree at any level then this returns the smallest subtree of tree that contains but is not equal to the first instance of subtree. For example, contining-subtree([b [c [a]] [d [a]]], [a]]) => [c [a]]. Returns nil if tree does not contain subtree
Returns true if tree contains subtree at any level. Inefficient but functional implementation
Returns the number of paren pairs in tree
Returns the number of points in tree, where each atom and each pair of parentheses counts as a point
really make-list-if-not-seq, but close enough for here
Returns a copy of tree with the subtree formerly indexed by point_index (in a depth-first traversal) replaced by new_subtree
Returns a version of n that obeys limit parameters
Levenshtein Distance - http://en.wikipedia.org/wiki/Levenshtein_distance In information theory and computer science, the Levenshtein distance is a metric for measuring the amount of difference between two sequences. This is a functional implementation of the levenshtein edit distance with as little mutability as possible. Still maintains the O(n*m) guarantee
Like postwalk, but only for lists
Like postwalk-replace, but only for lists
Prints the provided thing and returns it
If thing is a literal, return its type -- otherwise return false
If a number, rounds float f to n decimal places
Returns the given list but with all instances of that (at any depth) replaced with this. Read as 'subst this for that in list'
Like walk, but only for lists
Functions
Returns a subtree of tree indexed by point-index in a depth first traversal.
computes the next row using the prev-row current-element and the other seq
If tree contains subtree at any level then this returns the smallest subtree of tree that contains but is not equal to the first instance of subtree. For example, contining-subtree([b [c [a]] [d [a]]], [a]]) => [c [a]]. Returns nil if tree does not contain subtree.
Returns true if tree contains subtree at any level. Inefficient but functional implementation.
Specs
count_points(Enum.t) :: integer
Returns the number of points in tree, where each atom and each pair of parentheses counts as a point.
Returns a copy of tree with the subtree formerly indexed by point_index (in a depth-first traversal) replaced by new_subtree.
Specs
keep_number_reasonable(number) :: number
Returns a version of n that obeys limit parameters.
Levenshtein Distance - http://en.wikipedia.org/wiki/Levenshtein_distance In information theory and computer science, the Levenshtein distance is a metric for measuring the amount of difference between two sequences. This is a functional implementation of the levenshtein edit distance with as little mutability as possible. Still maintains the O(n*m) guarantee.
Returns the given list but with all instances of that (at any depth) replaced with this. Read as 'subst this for that in list'.