Liking cljdoc? Tell your friends :D

sicmutils.expression.analyze


ICanonicalizeclj/sprotocol

ICanonicalize captures the methods exposed by a scmutils analyzer backend. Analyzer backends find canonical forms of inputs over limited vocabularies of operations. For example, a polynomial backend will expose operations like addition, subtraction, multiplication, and exponentiation by positive integers (but not division). An expression containing only these operations and symbols can then be converted to and from a polynomial canonical form, which in this example would have the effect of grouping like terms; a rational function backend would include the division operation and be capable of cancellation. Canonicalizing an expression with respect to an analyzer is therefore effected by a round-trip to and from the canonical form.

ICanonicalize captures the methods exposed by a scmutils analyzer backend.
Analyzer backends find canonical forms of inputs over limited vocabularies of
operations. For example, a polynomial backend will expose operations like
addition, subtraction, multiplication, and exponentiation by positive
integers (but not division). An expression containing only these operations
and symbols can then be converted to and from a polynomial canonical form,
which in this example would have the effect of grouping like terms; a
rational function backend would include the division operation and be capable
of cancellation. Canonicalizing an expression with respect to an analyzer is
therefore effected by a round-trip to and from the canonical form.

->expressionclj/s

(->expression this b variables)

Convert a canonical form back to S-expression form. The variable list is typically obtained from the continuation invoked by expression->, so these functions are complementary.

Convert a canonical form back to S-expression form. The variable list is
typically obtained from the continuation invoked by expression->, so these
functions are complementary.

expression->clj/s

(expression-> this x continue)
(expression-> this x continue compare-variable)

Convert an expression to the canonical form represented by this analyzer, and invoke continue with the canonicalized input and a (sorted) sequence of variables found in the original expression.

Convert an expression to the canonical form represented by this analyzer,
and invoke continue with the canonicalized input and a (sorted) sequence of
variables found in the original expression.

known-operation?clj/s

(known-operation? this x)

A function deciding if an operation is considered fundamental by the canonical form

A function deciding if an operation is considered fundamental by the
canonical form

new-variablesclj/s

(new-variables this n)

Produce n new variables to represent values outside the domain of computation for this analyzer

Produce n new variables to represent values outside the domain of
computation for this analyzer
sourceraw docstring

make-analyzerclj/s

(make-analyzer backend symbol-generator)

Make-analyzer takes an analyzer backend (which implements ICanonicalize) and provides the apparatus necessary to prepare expressions for analysis by replacing subexpressions formed from operations unknown to the analyzer with generated symbols, and backsubstituting after analysis is complete. (For example, in the case of polynomial canonical form, we would replace a subexpression like (sin x) with a gensym, before entry, since the sine operation is not available to the polynomial canonicalizer, and restore it afterwards.

Make-analyzer takes an analyzer backend (which implements ICanonicalize) and
provides the apparatus necessary to prepare expressions for analysis by
replacing subexpressions formed from operations unknown to the analyzer with
generated symbols, and backsubstituting after analysis is complete. (For
example, in the case of polynomial canonical form, we would replace a
subexpression like (sin x) with a gensym, before entry, since the sine
operation is not available to the polynomial canonicalizer, and restore it
afterwards.
sourceraw docstring

monotonic-symbol-generatorclj/s

(monotonic-symbol-generator prefix)

Returns a function which generates a sequence of symbols with the given prefix with the property that later symbols will sort after earlier symbols. This is important for the stability of the simplifier. (If we just used gensym, then a temporary symbol like G__1000 will sort earlier than G__999, and this will happen at unpredictable times.)

Returns a function which generates a sequence of symbols with the given
prefix with the property that later symbols will sort after earlier symbols.
This is important for the stability of the simplifier. (If we just used
gensym, then a temporary symbol like G__1000 will sort earlier than G__999,
and this will happen at unpredictable times.)
sourceraw docstring

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

× close