Liking cljdoc? Tell your friends :D

sicmutils.expression

This namespace contains a number of functions and utilities for manipulating and comparing raw symbolic expression trees.

Also included is an implementation of a Literal type that forms the basis for sicmutils.abstract.number/literal-number.

This namespace contains a number of functions and utilities for manipulating
and comparing raw symbolic expression trees.

Also included is an implementation of a [[Literal]] type that forms the basis
for [[sicmutils.abstract.number/literal-number]].
raw docstring

abstract-typesclj/s

These keywords reference 'abstract' types that stand in for some concrete data type in the system.

These keywords reference 'abstract' types that stand in for some
concrete data type in the system.
sourceraw docstring

abstract?clj/s

(abstract? x)

Returns true if x is both a Literal and has a type specified in abstract-types, false otherwise.

Returns true if `x` is both a [[Literal]] and has a type specified
in [[abstract-types]], false otherwise.
sourceraw docstring

compareclj/s

(compare l r)

Comparator for expressions. The rule is that types have the following ordering:

  • empty sequence is < anything (except another empty seq)
  • real < symbol < string < sequence
  • sequences compare element-by-element

Any types not in this list compare with the other type using hashes.

Comparator for expressions. The rule is that types have the following ordering:

- empty sequence is < anything (except another empty seq)
- real < symbol < string < sequence
- sequences compare element-by-element

Any types _not_ in this list compare with the other type using hashes.
sourceraw docstring

evaluateclj/s

(evaluate expr sym->var sym->f)

Walk the unwrapped expression expr in postorder, replacing symbols found there with their values in the sym->var mapping, if present.

sym->f is used for elements in function application position (first of a sequence).

Walk the unwrapped expression `expr` in postorder, replacing symbols found
there with their values in the `sym->var` mapping, if present.

`sym->f` is used for elements in function application position (first of a
sequence).
sourceraw docstring

expression->streamclj/s

(expression->stream expr stream)
(expression->stream expr stream options)

Renders an expression through the simplifier and onto the stream.

Renders an expression through the simplifier and onto the stream.
sourceraw docstring

expression->stringclj/s

(expression->string expr)

Returns a string representation of a frozen, simplified version of the supplied expression expr.

Returns a string representation of a frozen, simplified version of the supplied
expression `expr`.
sourceraw docstring

expression-ofclj/s

(expression-of expr)

If the supplied argument is a Literal (or a symbol, interpreted elsewhere as a numerical literal expression), returns the wrapped expression (or the symbol).

Else, returns expr.

If the supplied argument is a [[Literal]] (or a symbol, interpreted elsewhere
as a numerical literal expression), returns the wrapped expression (or the
symbol).

Else, returns `expr`.
sourceraw docstring

fmapclj/s

(fmap f e)

Returns a Literal generated by applying f to the expression part of e.

literal-type and [[meta]] will return the same thing for e and the return value.

Returns a [[Literal]] generated by applying `f` to the expression part of
`e`.

[[literal-type]] and [[meta]] will return the same thing for `e` and the
return value.
sourceraw docstring

Literalcljs

source

literal-applyclj/s

(literal-apply type op args)

Similar to make-literal, but accepts:

  • some operation
  • the arguments to which it applies

Similar to clojure.core/apply.

For example:

(literal-apply ::numeric 'cos [1 2 3])
;;=> (cos 1 2 3)
Similar to [[make-literal]], but accepts:

- some operation
- the arguments to which it applies

Similar to `clojure.core/apply`.

For example:

```clojure
(literal-apply ::numeric 'cos [1 2 3])
;;=> (cos 1 2 3)
```
sourceraw docstring

literal-typeclj/s

(literal-type x)

If x is a Literal instance, returns its type. Else, returns nil.

If `x` is a [[Literal]] instance, returns its type. Else, returns nil.
sourceraw docstring

literal?clj/s

(literal? x)

Returns true if x is a Literal instance, false otherwise.

Returns true if `x` is a [[Literal]] instance, false otherwise.
sourceraw docstring

make-literalclj/s

(make-literal type expr)

Constructs a Literal instance with the supplied type and an empty metadata map out of the literal form expr.

Constructs a [[Literal]] instance with the supplied type and an empty metadata
map out of the literal form `expr`.
sourceraw docstring

peclj/s

source

(print-expression expr)
source

sortclj/s

(sort xs)
source

sorted?clj/s

(sorted? xs)
source

substituteclj/s

(substitute expr s-map)
(substitute expr old new)

Returns a form similar to expr, with all instances of old replaced by new. Substitution occurs in postwalk order.

Returns a form similar to `expr`, with all instances of `old` replaced by
`new`. Substitution occurs
in [postwalk](https://clojuredocs.org/clojure.walk/postwalk) order.
sourceraw docstring

variables-inclj/s

(variables-in expr)

Return the set of 'variables' (e.g. symbols) found in expr.

expr is either a symbol, a Literal instance or some sequence representing a symbolic expression.

Return the set of 'variables' (e.g. symbols) found in `expr`.

`expr` is either a symbol, a [[Literal]] instance or some sequence
representing a symbolic expression.
sourceraw docstring

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

× close