Liking cljdoc? Tell your friends :D

sicmutils.numerical.compile


common-subexpression-eliminationclj/s

(common-subexpression-elimination x
                                  &
                                  {:keys [symbol-generator deterministic?]
                                   :or {symbol-generator gensym}})

Given an expression and a table of common subexpressions, create a let statement which assigns the subexpressions to the values of dummy variables generated for the purpose of holding these values; the body of the let statement will be x with the subexpressions replaced by the dummy variables.

If :deterministic? true is supplied, the function will assign variable names by sorting the string representations of each term before assignment. Otherwise, the nondeterministic order of hash maps inside this function won't guarantee a consistent variable naming convention in the returned function. For tests, set :deterministic? true.

Given an expression and a table of common subexpressions, create a let
statement which assigns the subexpressions to the values of dummy variables
generated for the purpose of holding these values; the body of the let
statement will be x with the subexpressions replaced by the dummy variables.

If `:deterministic? true` is supplied, the function will assign variable names
by sorting the string representations of each term before assignment.
Otherwise, the nondeterministic order of hash maps inside this function won't
guarantee a consistent variable naming convention in the returned function.
For tests, set `:deterministic? true`.
raw docstring

compile-state-functionclj/s

(compile-state-function f parameters initial-state)

compile-univariate-functionclj/s

(compile-univariate-function f)

extract-common-subexpressionsclj/s

(extract-common-subexpressions expression
                               symbol-generator
                               continue
                               &
                               {:keys [deterministic?]})

Considers an S-expression from the point of view of optimizing its evaluation by isolating common subexpressions into auxiliary variables. The continuation is called with two arguments: a new equivalent expression with possibly some subexpressions replaced by new variables (delivered by the supplied generator) and a seq of pairs of [aux variable, subexpression] used to reconstitute the value.

If :deterministic? true is supplied, the function will assign aux variables by sorting the string representations of each term before assignment. Otherwise, the nondeterministic order of hash maps inside this function won't guarantee a consistent variable naming convention in the returned function. For tests, set :deterministic? true.

Considers an S-expression from the point of view of optimizing its evaluation
by isolating common subexpressions into auxiliary variables. The continuation
is called with two arguments: a new equivalent expression with possibly some
subexpressions replaced by new variables (delivered by the supplied generator)
and a seq of pairs of [aux variable, subexpression] used to reconstitute the
value.

If `:deterministic? true` is supplied, the function will assign aux variables
by sorting the string representations of each term before assignment.
Otherwise, the nondeterministic order of hash maps inside this function won't
guarantee a consistent variable naming convention in the returned function.
For tests, set `:deterministic? true`.
raw docstring

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

× close