The value vocabulary shared by both platforms.
CBOR has three things Clojure has no native counterpart for — simple values,
the undefined value, and tagged values whose tag we do not interpret. They
live here rather than in either implementation so the conformance suite can
name them once.
The value vocabulary shared by both platforms. CBOR has three things Clojure has no native counterpart for — simple values, the `undefined` value, and tagged values whose tag we do not interpret. They live here rather than in either implementation so the conformance suite can name them once.
(bytes= a b)Value equality for byte arrays.
Value equality for byte arrays.
(decimal exponent mantissa)A decimal fraction: mantissa * 10^exponent.
A decimal fraction: mantissa * 10^exponent.
(decimal-from-unscaled unscaled scale)The inverse of decimal-unscaled / decimal-scale: a platform decimal from
a BigDecimal-style unscaled value and scale.
On ClojureScript the unscaled value is narrowed back to an ordinary number
when it fits, because that is the convention the reader itself uses and the
writer encodes the two differently: a js/BigInt goes out as a bignum (tag
2/3) even when it is small, so skipping this made the same logical decimal
encode as c4 8221 c241 96 here and c4 8221 1896 on the JVM -- a
cross-platform byte divergence introduced by the round trip through this
function, not present in the data.
The inverse of `decimal-unscaled` / `decimal-scale`: a platform decimal from a BigDecimal-style unscaled value and scale. On ClojureScript the unscaled value is narrowed back to an ordinary number when it fits, because that is the convention the reader itself uses and the writer encodes the two differently: a `js/BigInt` goes out as a bignum (tag 2/3) even when it is small, so skipping this made the same logical decimal encode as `c4 8221 c241 96` here and `c4 8221 1896` on the JVM -- a cross-platform byte divergence introduced by the round trip through this function, not present in the data.
(decimal-scale d)The BigDecimal-style scale: value = unscaled * 10^-scale.
Accepts whatever the platform's decoder produced for CBOR tag 4 -- a real
java.math.BigDecimal on the JVM, this namespace's Decimal stand-in on
ClojureScript -- so portable code does not branch.
The BigDecimal-style scale: value = unscaled * 10^-scale. Accepts whatever the platform's decoder produced for CBOR tag 4 -- a real `java.math.BigDecimal` on the JVM, this namespace's `Decimal` stand-in on ClojureScript -- so portable code does not branch.
(decimal-unscaled d)The unscaled value, always as a big integer -- BigInteger on the JVM,
js/BigInt on ClojureScript -- whatever its magnitude.
The unscaled value, always as a big integer -- `BigInteger` on the JVM, `js/BigInt` on ClojureScript -- whatever its magnitude.
(frame-name x)The wire type name of an unregistered tag-27 frame, as a string.
The wire type name of an unregistered tag-27 frame, as a string.
(frame-payload x)The payload of an unregistered tag-27 frame: a field map for an
UnknownRecord, whatever was written for a TaggedLiteral.
The payload of an unregistered tag-27 frame: a field map for an `UnknownRecord`, whatever was written for a `TaggedLiteral`.
(record-fields x)The field map of an UnknownRecord, as a plain map.
The field map of an UnknownRecord, as a plain map.
(record-type x)The wire type name an UnknownRecord stands for.
The wire type name an UnknownRecord stands for.
(record-type-name x)The canonical wire name for a record type, identical on both platforms.
On the JVM this is the class name, which already munges - to _. On
ClojureScript the constructor's .name is MINIFIED under :advanced
(a record printed as #my.ns.P{...} reports a type name of Vg), so the
name is taken from pr-str, where the compiler embeds it as a string
constant that survives minification — and then munged the same way, which is
incognito's convention and the reason it has one.
The canonical wire name for a record type, identical on both platforms.
On the JVM this is the class name, which already munges `-` to `_`. On
ClojureScript the constructor's `.name` is MINIFIED under `:advanced`
(a record printed as `#my.ns.P{...}` reports a type name of `Vg`), so the
name is taken from `pr-str`, where the compiler embeds it as a string
constant that survives minification — and then munged the same way, which is
`incognito`'s convention and the reason it has one.(simple-value n)A CBOR simple value with code n (0-255).
A CBOR simple value with code `n` (0-255).
(tagged-frame? x)True for either fallback an unregistered tag-27 frame can decode to.
True for either fallback an unregistered tag-27 frame can decode to.
CBOR's undefined — simple value 23. Distinct from nil, which is null
(simple value 22).
CBOR's `undefined` — simple value 23. Distinct from nil, which is `null` (simple value 22).
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 |