Liking cljdoc? Tell your friends :D

formform.expr

API for the expr module of formform.

Concepts

Basic Expressions

expression
→ interpret the representation as an indicator of a value

  • representationform {syntax} and intentionality {semantics}
  • form → relate structure and code
  • valuecalc/value
  • valuecalc/constant {determined} or formDNA {contingent}

variable
→ the interpretation of the expression symbol is undetermined

form expression {FORM}
expression of form
→ invert the value of the relation

  • relation → relate the values of the content of the expression

Symbolic Expressions

symbolic expression
expression symbol or operator

expression symbol
→ interpret the symbol as a specific expression

operator
→ interpret the structure by its symbol as an expression pattern

Types

arrangement {:-}
operator to construct relations

unclear FORM {:uncl}
operator to construct unclear FORMs

seq-reentry FORM {:seq-re}
operator to construct self-equivalent re-entry FORMs

memory FORM {:mem}
operator to construct memory FORMs

  • rem pair → observe and remember equality between the two expressions

formDNA {:fdna}
operator to construct calc/formDNA expressions

API for the `expr` module of `formform`.

## Concepts

### Basic Expressions

**expression**  
→ interpret the _representation_ as an indicator of a _value_

* _representation_ → _form_ {syntax} and intentionality {semantics}
* _form_ → relate structure and code
* _value_ → _calc/value_
* _value_ → _calc/constant_ {determined} or _formDNA_ {contingent}

**variable**  
→ the interpretation of the _expression symbol_ is undetermined

**form expression** {FORM}  
→ _expression_ of _form_  
→ invert the _value_ of the _relation_

* _relation_ → relate the _values_ of the content of the _expression_


### Symbolic Expressions

**symbolic expression**  
→ _expression symbol_ or _operator_

**expression symbol**  
→ interpret the symbol as a specific _expression_

**operator**  
→ interpret the structure by its symbol as an _expression_ pattern

#### Types

**arrangement** {`:-`}  
→ _operator_ to construct _relations_

**unclear FORM** {`:uncl`}  
→ _operator_ to construct unclear _FORMs_

**seq-reentry FORM** {`:seq-re`}  
→ _operator_ to construct self-equivalent re-entry _FORMs_

**memory FORM** {`:mem`}  
→ _operator_ to construct memory _FORMs_

* _rem pair_ → observe and remember equality between the two expressions

**formDNA** {`:fdna`}  
→ _operator_ to construct _calc/formDNA_ _expressions_
raw docstring

==>clj/s

Alias for eval->val.

Alias for [[eval->val]].
sourceraw docstring

==>*clj/s

Alias for eval->val-all.

Alias for [[eval->val-all]].
sourceraw docstring

=>clj/s

Alias for eval->expr.

Alias for [[eval->expr]].
sourceraw docstring

=>*clj/s

Alias for eval->expr-all.

Alias for [[eval->expr-all]].
sourceraw docstring

>>clj/s

Alias for simplify.

Alias for [[simplify]].
sourceraw docstring

arrangement?clj/s

source

chain>>clj/s

Obsolete → use nested-l>> or nested-r>> instead!

Obsolete → use [[nested-l>>]] or [[nested-r>>]] instead!
sourceraw docstring

defoperatorclj/smacro

(defoperator k args interpretation & params)

Defines a new operator by its symbol (a keyword), a vector of arguments and an interpretation function. Takes additional key-value pairs for options.

Registers various methods for the operator:

  • interpret-op (use interpret) to access the interpretation function
  • make-op (use make) → constructor (either uses the provided args or a custom constructor function via the option :constructor)
  • simplify-op (use simplify) → simplifier (either defaults to the given interpretation function or uses a custom reducer via the option :reducer)
  • valid-op? → validator (provided by the :predicate option)
  • op-data → returns a key-value map of the operator arguments
  • op-get → returns a specific value by a given argument-key
Defines a new operator by its symbol (a keyword), a vector of arguments and an interpretation function. Takes additional key-value pairs for options.

Registers various methods for the operator: 

* `interpret-op` (use [[interpret]]) to access the interpretation function
* `make-op` (use [[make]]) → constructor (either uses the provided `args` or a custom constructor function via the option `:constructor`)
* `simplify-op` (use [[simplify]]) → simplifier (either defaults to the given interpretation function or uses a custom reducer via the option `:reducer`)
* [[valid-op?]] → validator (provided by the `:predicate` option)
* [[op-data]] → returns a key-value map of the operator arguments
* [[op-get]] → returns a specific value by a given argument-key
sourceraw docstring

defsymbolclj/smacro

(defsymbol k interpretation & params)

Defines a new expression symbol by its symbol (a keyword) and an interpretation function. Takes additional key-value pairs for options.

Registers various methods for the expression symbol:

  • interpret-sym (use interpret) → to access the interpretation function
  • simplify-sym (use simplify) → simplifier (either defaults to the given interpretation function or uses a custom reducer via the option :reducer)
Defines a new expression symbol by its symbol (a keyword) and an interpretation function. Takes additional key-value pairs for options.

Registers various methods for the expression symbol:

* `interpret-sym` (use [[interpret]]) → to access the interpretation function
* `simplify-sym` (use [[simplify]]) → simplifier (either defaults to the given interpretation function or uses a custom reducer via the option `:reducer`)
sourceraw docstring

equal?clj/s

(equal? & exprs)

Equality check for expressions. Two expressions are considered equal, if their formDNAs are equal. Compares formDNAs from evaluation results of each expression by calling calc/equal-dna?.

WARNING: Procedure and assumptions are being reassessed. Use with caution!

Equality check for expressions. Two expressions are considered equal, if their formDNAs are equal. Compares formDNAs from evaluation results of each expression by calling [[calc/equal-dna?]].

WARNING: Procedure and assumptions are being reassessed. Use with caution!

* ordering of variable names in formDNA matters, see [[find-vars]]
* stricter than [[equiv]], which compares by [[calc/equiv-dna?]]
sourceraw docstring

equiv?clj/s

(equiv? & exprs)

Equivalence check for expressions. Two expressions are considered equivalent, if their formDNAs are equivalent. Compares formDNAs from evaluation results of each expression by calling calc/equiv-dna?.

WARNING: Procedure and assumptions are being reassessed. Use with caution!

  • ordering of variable names in formDNA is irrelevant
  • looser than [[equal]], which compares by calc/equal-dna?
  • can be slow on expressions with 6+ variables
Equivalence check for expressions. Two expressions are considered equivalent, if their formDNAs are equivalent. Compares formDNAs from evaluation results of each expression by calling [[calc/equiv-dna?]].

WARNING: Procedure and assumptions are being reassessed. Use with caution!

* ordering of variable names in formDNA is irrelevant
* looser than [[equal]], which compares by [[calc/equal-dna?]]
* can be slow on expressions with 6+ variables
sourceraw docstring

eval->exprclj/s

(eval->expr expr)
(eval->expr expr env)

Evaluates a FORM expr with an optional env and returns an expression: either a constant or the simplified input expression, if it could not be determined to a value.

  • env must be a map from variables to expressions
Evaluates a FORM `expr` with an optional `env` and returns an expression: either a constant or the simplified input expression, if it could not be determined to a value.  

* `env` must be a map from variables to expressions
sourceraw docstring

eval->expr-allclj/s

(eval->expr-all expr)
(eval->expr-all expr env)
(eval->expr-all expr env opts)

Like eval->expr, but evaluates all possible interpretations of any occurring variable in the expr. Returns an expression: either a constant, a formDNA expression (which collects all interpretation results) or the simplified input expression, if it could not be determined to a value in any of its interpretations.

  • env must be a map from variables to expressions

An opts map can be provided with the following keys:

  • :varorder → sets the variable interpretation order for the resulting formDNA
  • :pre-simplify? → (default: true) simplifies the expression before interpretation, which might reduce terms and therefore evaluation time
  • :reduce-dna? → (default: true) if result is a formDNA expression which can be reduced to fewer terms, reduces it to further simplify the output
  • :allow-hole-results? → (default: false) sets a “value hole” (:_) in place of an uninterpretable result
  • :allow-hole-exprs? → (default: false) allows “value holes” (:_) in the input expression (each instance will be treated like a different variable)
Like [[eval->expr]], but evaluates all possible interpretations of any occurring variable in the `expr`. Returns an expression: either a constant, a formDNA expression (which collects all interpretation results) or the simplified input expression, if it could not be determined to a value in any of its interpretations.  
* `env` must be a map from variables to expressions

An `opts` map can be provided with the following keys:

* `:varorder` → sets the variable interpretation order for the resulting formDNA
* `:pre-simplify?` → (default: `true`) simplifies the expression before interpretation, which might reduce terms and therefore evaluation time
* `:reduce-dna?` → (default: `true`) if result is a formDNA expression which can be reduced to fewer terms, reduces it to further simplify the output
* `:allow-hole-results?` → (default: `false`) sets a “value hole” (`:_`) in place of an uninterpretable result
* `:allow-hole-exprs?` → (default: `false`) allows “value holes” (`:_`) in the input expression (each instance will be treated like a different variable)
sourceraw docstring

eval->valclj/s

(eval->val expr)
(eval->val expr env)

Evaluates a FORM expr with an optional env and returns a value: either a constant or a “value hole” :_ (in case a value cannot be determined, which usually happens when variables remain uninterpreted).

  • env must be a map from variables to expressions
Evaluates a FORM `expr` with an optional `env` and returns a value: either a constant or a “value hole” `:_` (in case a value cannot be determined, which usually happens when variables remain uninterpreted).  

* `env` must be a map from variables to expressions
sourceraw docstring

eval->val-allclj/s

(eval->val-all expr)
(eval->val-all expr env)
(eval->val-all expr env opts)

Like eval->val, but evaluates all possible interpretations of any occurring variable in the expr. Returns a complex value called formDNA, which collects all interpretation results.

  • env must be a map from variables to expressions

Note: interpretation results might (in very rare cases) include “value holes” :_, if a value cannot be determined. This applies to unregistered symbols (like :pie) or uninterpretable results from custom, user-defined operators. To avoid holes, wrap them in unclear FORMs, e.g. (make :uncl :pie).

An opts map can be provided with the following keys:

  • :varorder → sets the variable interpretation order for the resulting formDNA
  • :pre-simplify? → (default: false) simplifies the expression before interpretation, which might reduce terms and therefore evaluation time
  • :reduce-dna? → (default: false) if result is a formDNA expression which can be reduced to fewer terms, reduces it to further simplify the output
  • :allow-hole-exprs? → (default: false) allows “value holes” (:_) in the input expression (each instance will be treated like a different variable)
Like [[eval->val]], but evaluates all possible interpretations of any occurring variable in the `expr`. Returns a complex value called formDNA, which collects all interpretation results.

* `env` must be a map from variables to expressions

Note: interpretation results might (in very rare cases) include “value holes” `:_`, if a value cannot be determined. This applies to unregistered symbols (like `:pie`) or uninterpretable results from custom, user-defined operators. To avoid holes, wrap them in unclear FORMs, e.g. `(make :uncl :pie)`.

An `opts` map can be provided with the following keys:

* `:varorder` → sets the variable interpretation order for the resulting formDNA
* `:pre-simplify?` → (default: `false`) simplifies the expression before interpretation, which might reduce terms and therefore evaluation time
* `:reduce-dna?` → (default: `false`) if result is a formDNA expression which can be reduced to fewer terms, reduces it to further simplify the output
* `:allow-hole-exprs?` → (default: `false`) allows “value holes” (`:_`) in the input expression (each instance will be treated like a different variable)
sourceraw docstring

eval-allclj/s

(eval-all expr)
(eval-all expr env)
(eval-all expr env opts)

Like evaluate, but evaluates all possible interpretations of any occurring variable in the expr, with an optional env.

  • env must be a map from variables to expressions

Returns a map with the following entries:

  • :results → vector of [<interpretation> <result>] tuples (with result like in evaluate), think of it as a kind of value table
  • :varorder → the reading order of variable interpretations

An opts map can be provided with the following keys:

  • :varorder → sets the variable interpretation order for the results
  • :rich-results? → each results value will be a map as if returned by evaluate
  • :pre-simplify? → (default: false) simplifies the expression before interpretation, which might reduce terms and therefore evaluation time
  • :allow-hole-results? → (default: false) sets a “value hole” (:_) in place of nil for an uninterpretable result
  • :allow-hole-exprs? → (default: false) allows “value holes” (:_) in the input expression (each instance will be treated like a different variable)
Like [[evaluate]], but evaluates all possible interpretations of any occurring variable in the `expr`, with an optional `env`.  
* `env` must be a map from variables to expressions

Returns a map with the following entries:  

* `:results` → vector of `[<interpretation> <result>]` tuples (with `result` like in `evaluate`), think of it as a kind of value table
* `:varorder` → the reading order of variable interpretations

An `opts` map can be provided with the following keys:

* `:varorder` → sets the variable interpretation order for the results
* `:rich-results?` → each results value will be a map as if returned by [[evaluate]]
* `:pre-simplify?` → (default: `false`) simplifies the expression before interpretation, which might reduce terms and therefore evaluation time
* `:allow-hole-results?` → (default: `false`) sets a “value hole” (`:_`) in place of `nil` for an uninterpretable result
* `:allow-hole-exprs?` → (default: `false`) allows “value holes” (`:_`) in the input expression (each instance will be treated like a different variable)
sourceraw docstring

eval-tsds->val-allclj/s

(eval-tsds->val-all & selection)

Convenience function that takes a 6-digit binary selection (as a vector) for a triple-selective decision system (TsDS) and returns the formDNA for the (as by eval->val-all) evaluated expression.

Note: contrary to eval->val-all, the resulting formDNA does not get reduced.

Convenience function that takes a 6-digit binary `selection` (as a vector) for a triple-selective decision system (TsDS) and returns the formDNA for the (as by [[eval->val-all]]) evaluated expression.

Note: contrary to [[eval->val-all]], the resulting formDNA does not get reduced.
sourceraw docstring

evaluateclj/s

(evaluate expr)
(evaluate expr env)

Evaluates a FORM expr with an optional env and returns a map with a :result entry that is either a constant or nil, if it could not be determined to a value. It also contains a :simplified entry with the simplified expression.

  • env must be a map from variables to expressions
Evaluates a FORM `expr` with an optional `env` and returns a map with a `:result` entry that is either a constant or `nil`, if it could not be determined to a value. It also contains a `:simplified` entry with the simplified expression.  
* `env` must be a map from variables to expressions
sourceraw docstring

expr->constclj/s

(expr->const expr)

Returns the constant value/expression that corresponds to its simplest (as per simplify) input expr (including itself):

nil                     → :n
[]                      → :m
[:seq-re :<r nil nil]   → :u
[[:seq-re :<r nil nil]] → :i
[:u]                    → :i
Returns the constant value/expression that corresponds to its simplest (as per [[simplify]]) input `expr` (including itself):  

```
nil                     → :n
[]                      → :m
[:seq-re :<r nil nil]   → :u
[[:seq-re :<r nil nil]] → :i
[:u]                    → :i
```
sourceraw docstring

expr-symbol?clj/s

source

expression?clj/s

source

find-subexprsclj/s

(find-subexprs expr subexprs)

Finds all subexpressions in expr that match any element of the given set subexprs.

Finds all subexpressions in `expr` that match any element of the given set `subexprs`.
sourceraw docstring

find-varsclj/s

(find-vars expr opts)

Finds all variables in an expresson or returns the expression itself if it is a variable.

Options:

  • {:ordered true} to return variables in: type order → alphanumeric order
  • {:vars #{…}} can be given a set of specific variables to find
Finds all variables in an expresson or returns the expression itself if it is a variable.

Options:

* `{:ordered true}` to return variables in: type order → alphanumeric order
* `{:vars #{…}}` can be given a set of specific variables to find
sourceraw docstring

formclj/s

(form & args)

Constructor for FORM expressions [ … ]. Calls make on args.

Constructor for FORM expressions `[ … ]`. Calls [[make]] on `args`.
sourceraw docstring

form-markedclj/s

(form-marked & exprs)

Returns a FORM with each exprs argument marked, e.g. ((a) (b) …).

  • group expressions with arrangements: (make x y …)
Returns a FORM with each `exprs` argument marked, e.g. `((a) (b) …)`.

* group expressions with arrangements: `(make x y …)`
sourceraw docstring

form-nested-lclj/s

(form-nested-l & exprs)

Nests exprs leftwards in a FORM, e.g. ((((…) y) z).

  • use nil for empty expressions
  • use an arrangement (make x y …) to add multiple exprs. to the same level
Nests `exprs` leftwards in a FORM, e.g. `((((…) y) z)`.

* use `nil` for empty expressions
* use an arrangement `(make x y …)` to add multiple exprs. to the same level
sourceraw docstring

form-nested-rclj/s

(form-nested-r & exprs)

Nests exprs rightwards in a FORM, e.g. (a (b (…))).

  • use nil for empty expressions
  • use an arrangement (make x y …) to add multiple exprs. to the same level
Nests `exprs` rightwards in a FORM, e.g. `(a (b (…)))`.

* use `nil` for empty expressions
* use an arrangement `(make x y …)` to add multiple exprs. to the same level
sourceraw docstring

form?clj/s

source

formDNA-perspectivesclj/s

(formDNA-perspectives fdna)

Takes a formDNA expression and returns its formDNA perspective group.

Takes a formDNA expression and returns its formDNA perspective group.
sourceraw docstring

formDNA?clj/s

source

gen-varsclj/s

(gen-vars n)

Generates a number of variables with random names.

Generates a number of variables with random names.
sourceraw docstring

in>>clj/s

Alias for simplify-in.

Alias for [[simplify-in]].
sourceraw docstring

interpretclj/s

(interpret expr)
(interpret expr env)

Interprets an expression of any kind. Returns the original expression if it cannot be interpreted.

Can be given an env map to interpret variables (as keys). This map can have an optional --defocus entry whose value is a set of items that should not be interpreted and a complementary --focus entry to only interpret the items specified in its set and nothing else.

  • the keywords :ops / :syms / :vars designate all operations / expression symbols / variables
  • an operator symbol can provided to designate a specific operator
  • any other expression (like a variable) can be designated as itself
  • --focus and --defocus can cancel each other out if they contain the same item so you usually pick one or the other
Interprets an expression of any kind. Returns the original expression if it cannot be interpreted.

Can be given an `env` map to interpret variables (as keys). This map can have an optional `--defocus` entry whose value is a set of items that should not be interpreted and a complementary `--focus` entry to only interpret the items specified in its set and nothing else.

* the keywords `:ops` / `:syms` / `:vars` designate _all_ operations / expression symbols / variables
* an operator symbol can provided to designate a specific operator
* any other expression (like a variable) can be designated as itself
* `--focus` and `--defocus` can cancel each other out if they contain the same item so you usually pick one or the other
sourceraw docstring

interpret*clj/s

(interpret* expr)
(interpret* expr env)

Like interpret, but repeats substitution on interpreted expressions until they cannot be interpreted any further.

Like [[interpret]], but repeats substitution on interpreted expressions until they cannot be interpreted any further.
sourceraw docstring

interpret-opclj/smultimethod

Interprets a symbolic expression with a registered operator.

Note: default to use interpret instead

Interprets a symbolic expression with a registered operator.

Note: default to use [[interpret]] instead
sourceraw docstring

interpret-symclj/smultimethod

Interprets a registered symbol.

Note: default to use interpret instead

Interprets a registered symbol.

Note: default to use [[interpret]] instead
sourceraw docstring

interpret-walkclj/s

(interpret-walk expr)
(interpret-walk expr env)

Recursively calls interpret on given expression and all its subexpressions with a depth-first walk.

Recursively calls [[interpret]] on given expression and all its subexpressions with a depth-first walk.
sourceraw docstring

interpret-walk*clj/s

(interpret-walk* expr)
(interpret-walk* expr env)

Like interpret-walk, but repeats substitution on interpreted (sub-)expressions until they cannot be interpreted any further.

Like [[interpret-walk]], but repeats substitution on interpreted (sub-)expressions until they cannot be interpreted any further.
sourceraw docstring

isolatorclj/s

(isolator c)

Given a constant, returns the corresponding FORM from the isolator class.

Given a constant, returns the corresponding FORM from the isolator class.
sourceraw docstring

makeclj/s

(make & args)

Constructor for expressions of any kind. Validates its input.

If the first argument (or the first after the options map) is a keyword of a registered operator, will call the constructor for that operator

Can be given an options map as first argument:

  • mark? (default: false) marks the whole expression, creating a FORM
  • splice? (default: true) dissolves all top-level arrangements
Constructor for expressions of any kind. Validates its input.

If the first argument (or the first after the options map) is a keyword of a registered operator, will call the constructor for that operator

Can be given an options map as first argument:

* `mark?` (default: false) marks the whole expression, creating a FORM
* `splice?` (default: true) dissolves all top-level arrangements
sourceraw docstring

make-markedclj/s

(make-marked & exprs)

Returns an arrangement with each exprs argument marked, e.g. (a) (b) ….

  • group expressions with arrangements: (make x y …)
Returns an arrangement with each `exprs` argument marked, e.g. `(a) (b) …`.

* group expressions with arrangements: `(make x y …)`
sourceraw docstring

make-nested-lclj/s

(make-nested-l & exprs)

Nests exprs leftwards in an arrangement, e.g. ((…) y) z.

  • use nil for empty expressions
  • use an arrangement (make x y …) to add multiple exprs. to the same level
Nests `exprs` leftwards in an arrangement, e.g. `((…) y) z`.

* use `nil` for empty expressions
* use an arrangement `(make x y …)` to add multiple exprs. to the same level
sourceraw docstring

make-nested-rclj/s

(make-nested-r & exprs)

Nests exprs rightwards in an arrangement, e.g. a (b (…)).

  • use nil for empty expressions
  • use an arrangement (make x y …) to add multiple exprs. to the same level
Nests `exprs` rightwards in an arrangement, e.g. `a (b (…))`.

* use `nil` for empty expressions
* use an arrangement `(make x y …)` to add multiple exprs. to the same level
sourceraw docstring

make-opclj/smultimethod

Constructs a symbolic expression given a registered operator and parameters.

Note: default to use make instead of make-op

Constructs a symbolic expression given a registered operator and parameters.

Note: default to use [[make]] instead of `make-op`
sourceraw docstring

mark-exprsclj/s

(mark-exprs opts & exprs)

Obsolete → use make-marked or form-marked instead.

Obsolete → use [[make-marked]] or [[form-marked]] instead.
sourceraw docstring

memoryclj/s

(memory rem-pairs & exprs)

Constructs a memory FORM from a given list of rem-pairs (key-value pairs, where both the key and the value is an expression) and one or more expressions which are in their scope.

Constructs a memory FORM from a given list of `rem-pair`s (key-value pairs, where both the key and the value is an expression) and one or more expressions which are in their scope.
sourceraw docstring

memory-extendclj/s

(memory-extend mem & ext-pairs)

Takes a memory FORM and extends its rem-pairs by one or more given extension pairs.

Takes a memory FORM and extends its `rem-pair`s by one or more given extension pairs.
sourceraw docstring

memory-replaceclj/s

(memory-replace mem & repl-pairs)

Takes a memory FORM and replaces its rem-pairs by one or more given replacement pairs.

Takes a memory FORM and replaces its `rem-pair`s by one or more given replacement pairs.
sourceraw docstring

memory?clj/s

source

nest-exprsclj/s

(nest-exprs opts & exprs)
Obsolete → use [[make-nested-l]]/[[make-nested-r]] or [[form-nested-l]]/[[form-nested-r]] instead.
sourceraw docstring

nested-l>>clj/s

Alias for simplify-nested-l.

Alias for [[simplify-nested-l]].
sourceraw docstring

nested-r>>clj/s

Alias for simplify-nested-r.

Alias for [[simplify-nested-r]].
sourceraw docstring

op-dataclj/smultimethod

Gets all parameters from a symbolic expression with a registered operator as a map.

Gets all parameters from a symbolic expression with a registered operator as a map.
sourceraw docstring

op-getclj/smultimethod

Gets a specified part from a symbolic expression with a registered operator.

Gets a specified part from a symbolic expression with a registered operator.
sourceraw docstring

op-symbolclj/s

Returns the symbol of a given operator.

Returns the symbol of a given operator.
sourceraw docstring

op-symbol?clj/s

source

operator?clj/s

source

permute-varsclj/s

(permute-vars varorder)

Generates all permutations of a variable order (a sequence of variables).

Generates all permutations of a variable order (a sequence of variables).
sourceraw docstring

rem-pair?clj/s

source

selectorclj/s

(selector vars->consts)
(selector vars->consts simplify?)

Given a map variable->constant, returns a FORM from the selector class.

Given a map variable->constant, returns a FORM from the selector class.
sourceraw docstring

seq-reclj/s

(seq-re specs & nested-exprs)

Constructs a self-equivalent re-entry FORM given the arguments:

  • specs: either a seq-reentry-signature or an options map
  • nested-exprs: zero or more expressions intended as a nested sequence
Constructs a self-equivalent re-entry FORM given the arguments:

* `specs`: either a `seq-reentry-signature` or an options map
* `nested-exprs`: zero or more expressions intended as a nested sequence
sourceraw docstring

seq-reentry-opts->signclj/s

(seq-reentry-opts->sign opt-map)

Inverse map of seq-reentry-sign->opts with default args.

Inverse map of [[seq-reentry-sign->opts]] with default args.
sourceraw docstring

seq-reentry-opts?clj/s

source

seq-reentry-sign->optsclj/s

(seq-reentry-sign->opts sign)

Maps signatures for self-equivalent re-entry FORMs to their corresponding option-maps.

Maps signatures for self-equivalent re-entry FORMs to their corresponding option-maps.
sourceraw docstring

seq-reentry-signature?clj/s

source

seq-reentry?clj/s

source

simplifyclj/s

(simplify x)
(simplify x env)
(simplify x env opts)

Simplifies a FORM recursively until it cannot be further simplified. All deductions are justified by the axioms of FORM logic.

  • if no simplification applies, tries to retrieve the value from given env
  • if retrieval was unsuccessful, returns x as is

An opts map can be provided with the following keys:

  • :allow-hole-exprs? → (default: false) allows “value holes” (:_) in the input expression (each instance will be treated like a different variable)
Simplifies a FORM recursively until it cannot be further simplified. All deductions are justified by the axioms of FORM logic.

* if no simplification applies, tries to retrieve the value from given `env`
* if retrieval was unsuccessful, returns `x` as is

An `opts` map can be provided with the following keys:

* `:allow-hole-exprs?` → (default: `false`) allows “value holes” (`:_`) in the input expression (each instance will be treated like a different variable)
sourceraw docstring

simplify-expr-chainclj/s

(simplify-expr-chain chain env)
(simplify-expr-chain opts chain env)

Obsolete → use simplify-nested-l or simplify-nested-r instead!

Obsolete → use [[simplify-nested-l]] or [[simplify-nested-r]] instead!
sourceraw docstring

simplify-inclj/s

(simplify-in ctx)
(simplify-in ctx env)
(simplify-in ctx env opts)

Simplifies a context/sequence of FORMs recursively until it cannot be further simplified. All deductions are justified by the axioms of FORM logic.

An opts map can be provided with the following keys:

  • :allow-hole-exprs? → (default: false) allows “value holes” (:_) in the input expression (each instance will be treated like a different variable)
Simplifies a context/sequence of FORMs recursively until it cannot be further simplified. All deductions are justified by the axioms of FORM logic.

An `opts` map can be provided with the following keys:

* `:allow-hole-exprs?` → (default: `false`) allows “value holes” (`:_`) in the input expression (each instance will be treated like a different variable)
sourceraw docstring

simplify-nested-lclj/s

(simplify-nested-l nesting-chain)
(simplify-nested-l nesting-chain env)
(simplify-nested-l nesting-chain env opts)

Reduces a leftward nesting-chain, a sequence of expressions ( … x y z ) whose interpretation is ( [[[…] x] y] z ), to a simplified nesting chain, possibly spliced or shortened via inference.

  • takes an optional env that gets applied to the nested expansion

An opts map can be provided with the following keys:

  • :allow-hole-exprs? → (default: false) allows “value holes” (:_) in the input expression (each instance will be treated like a different variable)
Reduces a leftward `nesting-chain`, a sequence of expressions `( … x y z )` whose interpretation is `( [[[…] x] y] z )`, to a simplified nesting chain, possibly spliced or shortened via inference.

* takes an optional `env` that gets applied to the nested expansion

An `opts` map can be provided with the following keys:

* `:allow-hole-exprs?` → (default: `false`) allows “value holes” (`:_`) in the input expression (each instance will be treated like a different variable)
sourceraw docstring

simplify-nested-rclj/s

(simplify-nested-r nesting-chain)
(simplify-nested-r nesting-chain env)
(simplify-nested-r nesting-chain env opts)

Reduces a rightward nesting-chain, a sequence of expressions ( a b c … ) whose interpretation is ( a [b [c […]]] ), to a simplified nesting chain, possibly spliced or shortened via inference.

  • takes an optional env that gets applied to the nested expansion

An opts map can be provided with the following keys:

  • :allow-hole-exprs? → (default: false) allows “value holes” (:_) in the input expression (each instance will be treated like a different variable)
Reduces a rightward `nesting-chain`, a sequence of expressions `( a b c … )` whose interpretation is `( a [b [c […]]] )`, to a simplified nesting chain, possibly spliced or shortened via inference.

* takes an optional `env` that gets applied to the nested expansion

An `opts` map can be provided with the following keys:

* `:allow-hole-exprs?` → (default: `false`) allows “value holes” (`:_`) in the input expression (each instance will be treated like a different variable)
sourceraw docstring

ts==>*clj/s

Alias for eval-tsds->val-all.

Alias for [[eval-tsds->val-all]].
sourceraw docstring

unclear?clj/s

source

valid-op?clj/smultimethod

Validates the shape of a symbolic expression with a registered operator.

Validates the shape of a symbolic expression with a registered operator.
sourceraw docstring

variable?clj/s

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close