Skip to content

@enumeratio/combinatorics ​

Combinatorial collections and carriers for @cortex-js/compute-engine: permutations, partitions, set partitions, compositions, words, trees, tableaux, lattice paths and graphs, each declared as a lazy indexed collection rather than a generated list. Count answers by arithmetic, At by unranking — see Ranking and unranking for what that buys you.

Merged wholesale ahead of per-area carving (wiki): today every area lives under this one package, subpath exports notwithstanding.

Entry points ​

declareCombinatorics(ce) (., src/index.ts) mints the carrier types and declares every family typed by them, in that order. It does not call declareCarrierPlurals, declareCarrierElement or declareMaps — each host declares those itself, at its own position in its own declare order (see the file comment for why).

  • ./collections — declareCollections, the family library (allEntries) and declareStats; ./collections/src and ./collections/sampleable for the source and the sampler used by property tests.
  • carriers.ts — CARRIERS, declareCombinatoricsCarriers, LEFTOVER_CARRIERS.
  • ./notation — the carrier constructors' StandardForm, \permutation([2, 3, 1]) both ways, and MathLive macros for those commands; a host loads it before it builds an engine.
  • maps.ts — MAPS, declareMaps, evaluateDefinition; frontier-maps.ts tracks the ones not yet defined (UNDEFINED_MAPS).
  • laws.ts — checkLaws: cross-checks a map against the algebraic law it claims to satisfy.

Areas ​

Each subfolder is a carrier area with its own src/ and tests, still exported through this package rather than its own:

A representative few, each with its own reference page: SymmetricGroup, KSubsets, IntegerPartitions, SetPartitions, DyckPaths, BinaryTrees, SemistandardTableaux, Graph.

Commands ​

sh
vp check
vp test
vp pack   # build dist (also: vp pack --watch)

Next ​

Statistics over these carriers (MajorIndex, Descents, distributions, …) live in @enumeratio/statistics. Carrier and protocol machinery (registerCarrier, conform) lives in @enumeratio/structures.

Its enumeratio.reads names ../statistics/reference rather than depending on statistics: the build reads those records, and statistics sits above combinatorics, which may import only down the hierarchy. The dist-cache key hashes the records instead.

Pages ​