Reifies the #commensura/quantity "…" and #commensura/unit "…" tagged
literals (registered in resources/data_readers.clj). A quantity literal rebuilds
an anonymous Quantity from its display formula; a unit literal resolves the named
Unit through the registry (so user defunits reify too).
A leading ≈ in the payload marks an approximate value: for those, the BigDecimal
in the literal is the source of truth (no re-check). For an exact quantity the exact
value is the source of truth — its printed approximation is re-derived and checked
against the literal's, throwing if they disagree beyond *approx-tolerance* (ruling
out junk data or values that would come out differently under JVM/library drift).
Reifies the `#commensura/quantity "…"` and `#commensura/unit "…"` tagged literals (registered in resources/data_readers.clj). A quantity literal rebuilds an anonymous Quantity from its display formula; a unit literal resolves the named Unit through the registry (so user `defunit`s reify too). A leading `≈` in the payload marks an *approximate* value: for those, the BigDecimal in the literal is the source of truth (no re-check). For an *exact* quantity the exact value is the source of truth — its printed approximation is re-derived and checked against the literal's, throwing if they disagree beyond `*approx-tolerance*` (ruling out junk data or values that would come out differently under JVM/library drift).
Maximum relative difference tolerated between the literal's printed approximation and the value re-derived from its exact part. Full-precision doubles agree to ~15 digits; 1e-9 absorbs realistic JVM/libm/format drift while still catching junk data.
Maximum *relative* difference tolerated between the literal's printed approximation and the value re-derived from its exact part. Full-precision doubles agree to ~15 digits; 1e-9 absorbs realistic JVM/libm/format drift while still catching junk data.
(read-quantity s)Data-reader for #commensura/quantity "…" → an anonymous Quantity. A leading ≈
marks an approximate value (an ApproxQuantity from the literal's BigDecimal); else the
exact value is the source of truth (a PreciseQuantity rebuilt from its display formula).
Data-reader for `#commensura/quantity "…"` → an anonymous Quantity. A leading `≈` marks an approximate value (an ApproxQuantity from the literal's BigDecimal); else the exact value is the source of truth (a PreciseQuantity rebuilt from its display formula).
(read-unit s)Data-reader for #commensura/unit "[≈ ]<name> [dim]" → the named Unit (precise or
approximate), resolved via resolve-unit — a registered unit (builtin or user defunit), or a
commensura-provided historical currency (dollar_1960…) minted on demand. The leading ≈ marker
and trailing [dim] are decorative — only the name matters.
Data-reader for `#commensura/unit "[≈ ]<name> [dim]"` → the named Unit (precise or approximate), resolved via `resolve-unit` — a registered unit (builtin or user `defunit`), or a commensura-provided historical currency (`dollar_1960`…) minted on demand. The leading `≈` marker and trailing `[dim]` are decorative — only the name matters.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |