Liking cljdoc? Tell your friends :D

instacheck.util


check-weight-altsclj

(check-weight-alts)
source

filter-altsclj

(filter-alts weights)

Remove paths for weights that are not alternations. Only alternations (gen/frequency) are currently affected by the weights so remove everything else.

Remove paths for weights that are not alternations. Only
alternations (gen/frequency) are currently affected by the weights
so remove everything else.
sourceraw docstring

filter-weight-nodesclj

(filter-weight-nodes grammar weights pred?)

Return a weight map where the grammar nodes (for each weight path) fulfill pred? predicate. For example, to return weights that only refer to string or regex terminals use the predicate: #(#{:string :regex} (:tag %))

Return a weight map where the grammar nodes (for each weight path)
fulfill pred? predicate. For example, to return weights that only
refer to string or regex terminals use the predicate:
  #(#{:string :regex} (:tag %))
sourceraw docstring

flatten-textclj

(flatten-text tree & [sep])

Take a tree (sequences hierarchy) and flattens it all the way to a single string (optionally separated by sep). Empty values are removed.

Take a tree (sequences hierarchy) and flattens it all the way to
a single string (optionally separated by sep). Empty values are
removed.
sourceraw docstring

flatten-text*clj

(flatten-text* tree)

Take a tree (sequences hierarchy) and flattens it all the way to a single sequence of numbers and strings. Empty values are removed.

Take a tree (sequences hierarchy) and flattens it all the way to
a single sequence of numbers and strings. Empty values are removed.
sourceraw docstring

get-grammar-nodeclj

(get-grammar-node grammar path)

Get the a grammar node for the given path in grammar. Nil is returned if the path does not exist in the grammar, the tag type along the path don't match, or the numeric parser index is out-of-bounds.

Get the a grammar node for the given path in grammar. Nil is
returned if the path does not exist in the grammar, the tag type
along the path don't match, or the numeric parser index is
out-of-bounds.
sourceraw docstring

group-altsclj

(group-alts weights)
source

group-by-altsclj

(group-by-alts weights)
source

remove-keyclj

(remove-key tree k)

Walk a tree removing every key/value where key match k

Walk a tree removing every key/value where key match k
sourceraw docstring

tree-depsclj

(tree-deps trees)

Takes a structure like {:a tree-a :b tree-b :c tree-c} and returns a map like {:a #{:b :c} :b #{:c} :c #{}} which means that :a appears in tree-b and tree-c, :b appears in tree-c, but :c does not appear in tree-a or tree-b.

Takes a structure like {:a tree-a :b tree-b :c tree-c} and returns
a map like {:a #{:b :c} :b #{:c} :c #{}} which means that :a appears
in tree-b and tree-c, :b appears in tree-c, but :c does not appear
in tree-a or tree-b.
sourceraw docstring

tree-matchesclj

(tree-matches pred? tree)

Return seq of pred? matches for any node in the tree.

Return seq of pred? matches for any node in the tree.
sourceraw docstring

weight-reducer-halfclj

(weight-reducer-half weight)

Returns the amount to reduce a weight that will result in the final weight being the half of the original weight. A weight of 1 should return 1 and 0 should return 0.

Returns the amount to reduce a weight that will result in the final
weight being the half of the original weight. A weight of 1 should
return 1 and 0 should return 0.
sourceraw docstring

weight-reducer-sqrtclj

(weight-reducer-sqrt weight)

Returns the amount to reduce a weight that will result in the final weight being the sqrt of the original weight. A weight of 1 should return 1 and 0 should return 0.

Returns the amount to reduce a weight that will result in the final
weight being the sqrt of the original weight. A weight of 1 should
return 1 and 0 should return 0.
sourceraw docstring

weights-reduceclj

(weights-reduce grammar weights change-weights reducer-fn)

Takes a grammar, an starting weight map, a map weights to change (change-weights), and a per weight reducer function. Returns a new weight map with weights that are reduced based on change-weights and reducer-fn. If there is a single weight in the change-weights map then that weight in the original will be reduced by (reducer-fn original-weight). If there is more than one weight in change-weights, then the reduce value will be proportional to the ratio of the change-weight value to the sum of all the change-weight values.

Takes a grammar, an starting weight map, a map weights to change
(change-weights), and a per weight reducer function. Returns a new
weight map with weights that are reduced based on change-weights and
reducer-fn. If there is a single weight in the change-weights map
then that weight in the original will be reduced by (reducer-fn
original-weight). If there is more than one weight in
change-weights, then the reduce value will be proportional to the
ratio of the change-weight value to the sum of all the change-weight
values.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close