Liking cljdoc? Tell your friends :D

formform.calc

API for the calc module of formform.

API for the `calc` module of `formform`.
raw docstring

--clj/s

Alias to rel.

Alias to `rel`.
raw docstring

char->constclj/s

(char->const c)
(char->const sort-code c)

Coerces a char to a corresponding constant.

Coerces a `char` to a corresponding `constant`.
raw docstring

chars->dnaclj/s

(chars->dna dna-seq)
(chars->dna sort-code dna-seq)

Converts a seqable? of chars to formDNA.

Note that nuim-code is the default ordering. If a different sort-code is specified, digits will be reordered to match the code.

Converts a `seqable?` of chars to formDNA.
  
Note that `nuim-code` is the default ordering. If a different `sort-code` is specified, `digits` will be reordered to match the code.
raw docstring

compare-constsclj/s

Comparator for constants using the default nuim-code.

Comparator for constants using the default `nuim-code`.
raw docstring

const->digitclj/s

(const->digit c)
(const->digit sort-code c)

Converts a constant to a digit corresponding to an optional sort-code or the default nuim-code.

Converts a `constant` to a `digit` corresponding to an optional `sort-code` or the default `nuim-code`.
raw docstring

const?clj/s

Checks if the argument is a valid constant.

Checks if the argument is a valid constant.
raw docstring

constsclj/s

Set of all 4 constants

Set of all 4 constants
raw docstring

digit->constclj/s

(digit->const n)
(digit->const sort-code n)

Converts a digit to its corresponding constant representation.

Converts a digit to its corresponding constant representation.
raw docstring

digits->dnaclj/s

(digits->dna dna-seq)
(digits->dna sort-code dna-seq)

Converts a seqable? of digits (as string/char or integer) to formDNA.

Note that nuim-code is the default ordering. If a different sort-code is specified, digits will be reordered to match the code.

Converts a `seqable?` of digits (as string/char or integer) to formDNA.
  
Note that `nuim-code` is the default ordering. If a different `sort-code` is specified, `digits` will be reordered to match the code.
raw docstring

dna->digitsclj/s

(dna->digits dna)
(dna->digits sort-code dna)

Converts formDNA to a sequence of digits corresponding to a sort-code.

Note that nuim-code is the default ordering. If a different sort-code is specified, dna will be reordered to match the code.

Converts formDNA to a sequence of digits corresponding to a `sort-code`.
  
Note that `nuim-code` is the default ordering. If a different `sort-code` is specified, `dna` will be reordered to match the code.
raw docstring

dna->vdictclj/s

(dna->vdict dna)
(dna->vdict opts dna)

Generates a vdict from a given dna.

  • optional sorted? defaults to false since sorting large vspace dimensions can be expensive
Generates a vdict from a given dna.

* optional `sorted?` defaults to false since sorting large vspace dimensions can be expensive
raw docstring

dna->vmapclj/s

(dna->vmap dna)

dna-dimensionclj/s

(dna-dimension xs)

Calculates the dimension of a formDNA/dna-seq (corresponds to the number of variables in a FORM). The length of a dna-seq is 4^d for its dimension d.

  • the input sequence can have any type of elements
Calculates the dimension of a `formDNA`/`dna-seq` (corresponds to the number of variables in a FORM). The length of a `dna-seq` is 4^d for its dimension d.

* the input sequence can have any type of elements
raw docstring

dna-dimension?clj/s


dna-perspectivesclj/s

(dna-perspectives dna)
(dna-perspectives opts dna)

Given a formDNA, generates all of its permutations and returns a map from permuted term order to the corresponding formDNA.

Given a formDNA, generates all of its permutations and returns a map from permuted term order to the corresponding formDNA.
raw docstring

dna?clj/s


equal-dnaclj/s

(equal-dna & dnas)

Equality check for formDNA. Two formDNAs are considered equal, if they contain the same constants in the same order. Stricter than equiv-dna, where permutations are considered equal.

Equality check for formDNA. Two formDNAs are considered equal, if they contain the same constants in the same order. Stricter than `equiv-dna`, where permutations are considered equal.
raw docstring

equiv-dnaclj/s

(equiv-dna & dnas)

Equivalence check for formDNA. Two formDNAs are considered equivalent, if they belong to the same equivalence-class of dna-perspectives (i.e. if they are permutations of each other).

Equivalence check for formDNA. Two formDNAs are considered equivalent, if they belong to the same equivalence-class of `dna-perspectives` (i.e. if they are permutations of each other).
raw docstring

expand-dna-seqclj/s

(expand-dna-seq dna-seq ext-dim)
(expand-dna-seq dna-seq dim ext-dim)

Expands a dna-seq to a given target dimension by repeating elements.

Note: dna-seq can have any type of elements (not only constants)

Expands a `dna-seq` to a given target dimension by repeating elements.

Note: `dna-seq` can have any type of elements (not only constants)
raw docstring

filter-dnaclj/s

(filter-dna dna vpoint)

Filters a dna by selecting specific parts corresponding to a given vpoint, which acts as a coordinate vector in its value space.

  • use holes :_ to indicate a variable selection
Filters a `dna` by selecting specific parts corresponding to a given `vpoint`, which acts as a coordinate vector in its value space.

* use holes `:_` to indicate a variable selection
raw docstring

invclj/s

(inv & consts-or-dnas)

Inverts the value of a every constant in a formDNA.

Inverts the value of a every constant in a formDNA.
raw docstring

make-compare-constsclj/s

(make-compare-consts sort-code)

Given a sort-code (try calc.nuim-code or calc.nmui-code), returns a comparator function to sort single constants, formDNA or arbitrary sequences of constants (can be mixed).

  • can also compare map-entries by keys of comparable types
Given a `sort-code` (try `calc.nuim-code` or `calc.nmui-code`), returns a comparator function to sort single constants, formDNA or arbitrary sequences of constants (can be mixed).

* can also compare map-entries by keys of comparable types
raw docstring

make-dnaclj/s

(make-dna & xs)

Creates a formDNA from arguments, which may be valid chars, keywords, integers or sequences thereof.

  • valid chars are: \n \u \i \m (upper- or lowercase) and \0 \1 \2 \3
  • valid integers are: 0 1 2 3
  • valid keywords are: :N :U :I :M
  • total argument count (including count of sequence args) must match a valid formDNA length, which is 4^d, where d is a natural number
Creates a formDNA from arguments, which may be valid chars, keywords, integers or sequences thereof.

* valid chars are: \n \u \i \m (upper- or lowercase) and \0 \1 \2 \3
* valid integers are: 0 1 2 3
* valid keywords are: :N :U :I :M
* total argument count (including count of sequence args) must match a valid formDNA length, which is 4^d, where d is a natural number
raw docstring

nmui-codeclj/s


nuim-codeclj/s


permute-dnaclj/s

(permute-dna dna perm-order)
(permute-dna opts dna perm-order)

rand-constclj/s

Generates a random constant.

Generates a random constant.
raw docstring

rand-dnaclj/s

(rand-dna dim)
(rand-dna dim elems)

Generates a random formDNA/dna-seq of dimension dim. A vector of 4 custom elements can be provided as a second argument.

Generates a random formDNA/`dna-seq` of dimension `dim`. A vector of 4 custom elements can be provided as a second argument.
raw docstring

rand-vpointclj/s

(rand-vpoint)
(rand-vpoint dim)

Generates a random vpoint either as an infinite lazy seq or with given dimension dim.

Generates a random vpoint either as an infinite lazy seq or with given dimension `dim`.
raw docstring

reduce-dna-seqclj/s

(reduce-dna-seq dna-seq)
(reduce-dna-seq terms dna-seq)

Reduces a dna-seq by eliminating redundant/contingent terms.

  • returns a tuple [terms dna-seq], where terms is a sequence that represents the remaining terms after reduction
  • takes an optional terms sequence of any kind of items that will be used instead of the default arithmetic sequence [0 1 2 …] to represent each term (length has to match the formDNA dimension)

Note: dna-seq can have any type of elements (not only constants)

Reduces a `dna-seq` by eliminating redundant/contingent terms.

* returns a tuple `[terms dna-seq]`, where `terms` is a sequence that represents the remaining terms after reduction
* takes an optional `terms` sequence of any kind of items that will be used instead of the default arithmetic sequence `[0 1 2 …]` to represent each term (length has to match the formDNA dimension)

Note: `dna-seq` can have any type of elements (not only constants)
raw docstring

relclj/s

(rel & consts-or-dnas)

Relates the values of 2 constants in a formDNA to each other.

Relates the values of 2 constants in a formDNA to each other.
raw docstring

reorder-dna-seqclj/s

(reorder-dna-seq dna-seq sort-code-from sort-code-to)

Reorders given formDNA/dna-seq from sort-code-from to sort-code-to.

Note:

  • dna-seq can have any type of elements (not only constants)
  • does NOT change the encoding of the elements, just their ordering
Reorders given formDNA/`dna-seq` from `sort-code-from` to `sort-code-to`.

Note:

* `dna-seq` can have any type of elements (not only constants)
* does NOT change the encoding of the elements, just their ordering
raw docstring

sort-code?clj/s


var-constclj/s

Variable constant (like a hole/placeholder)

Variable constant (like a hole/placeholder)
raw docstring

vdictclj/s

(vdict vpoint->result)
(vdict opts vpoint->result)

Generates a vdict given a map vpoint->result (result is a constant).

  • if the corresponding vspace is not a subset of the set of keys from vp->r, the remaining results will be filled with :N or a given default constant
  • optional sorted? defaults to false since sorting large vspace dimensions can be expensive
Generates a vdict given a map vpoint->result (result is a constant).

* if the corresponding vspace is not a subset of the set of keys from `vp->r`, the remaining results will be filled with :N or a given default constant
* optional `sorted?` defaults to false since sorting large vspace dimensions can be expensive
raw docstring

vdict->vmapclj/s

(vdict->vmap vdict)

Generates a vmap from a given vdict.

Generates a vmap from a given vdict.
raw docstring

vdict?clj/s


vmap?clj/s


vpoint?clj/s


vspaceclj/s

(vspace dim)
(vspace sort-code dim)

Generates a vspace of dimension dim, optionally with custom sort-code.

  • returns a lazy-seq which may be too memory-expensive to fully realize for dimensions greater than 11 (> 200 Mio. elements in total!)
Generates a vspace of dimension `dim`, optionally with custom `sort-code`.

* returns a lazy-seq which may be too memory-expensive to fully realize for dimensions greater than 11 (> 200 Mio. elements in total!)
raw docstring

vspace?clj/s


|clj/s

Alias to inv.

Alias to `inv`.
raw docstring

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

× close