Liking cljdoc? Tell your friends :D

vaelii.impl.naming

The naming invariants: predicates that read a symbol's role off its spelling, and the walk that applies them to every literal of a sentence, under the KB's :naming policy. Also the content-order comparator and keys every tie-break uses (docs/defenses.md, "Tie-breaks and orderings key on content, not the handle"). See docs/naming.md.

The naming invariants: predicates that read a symbol's role off its spelling, and the
walk that applies them to every literal of a sentence, under the KB's `:naming` policy.
Also the content-order comparator and keys every tie-break uses (docs/defenses.md,
"Tie-breaks and orderings key on content, not the handle").  See docs/naming.md.
raw docstring

adviceclj

(advice sentence)

{:id :message} for a well-formed sentence that is almost certainly not what was meant, or nil. One entry: (isa X T) at arity 2 (docs/naming.md, "Advice").

The bar for a new entry is that the shape has no legitimate reading: isa is a predicate no shipped KB declares and the one the ontology names as the mistake. A shape somebody might mean stays out, because a warning that fires on correct input is one an author learns to ignore.

`{:id :message}` for a well-formed sentence that is almost certainly not what was
meant, or nil.  One entry: `(isa X T)` at arity 2 (docs/naming.md, "Advice").

The bar for a new entry is that the shape has no legitimate reading: `isa` is a
predicate no shipped KB declares and the one the ontology names as the mistake.  A
shape somebody might mean stays out, because a warning that fires on correct input
is one an author learns to ignore.
sourceraw docstring

advise!clj

(advise! policy sentence context)

Log advice about sentence at :warn, once per process per advice id. Silent under :off; never a refusal.

Log `advice` about `sentence` at `:warn`, once per process per advice id.  Silent
under `:off`; never a refusal.
sourceraw docstring

applied-literalsclj

(applied-literals sentence)
(applied-literals role form)

The [role literal] pairs of sentence as written: every position that applies something to arguments, tagged with the literal-roles key of the wrapper it sits in. Wrappers are descended and arguments are not. A variable-functor position is included; literals filters it out and rules/variable-functor-literals keeps it.

The `[role literal]` pairs of `sentence` as written: every position that applies
something to arguments, tagged with the `literal-roles` key of the wrapper it sits in.
Wrappers are descended and arguments are not.  A variable-functor position is
included; `literals` filters it out and `rules/variable-functor-literals` keeps it.
sourceraw docstring

argsclj

(args sentence)
source

arityclj

(arity sentence)
source

between-predicates?clj

(between-predicates? literal)

Does literal have an argument, every one of them predicate-spelled?: the literals a :forced-between-predicates functor makes forced-monotonic (decide/forced-literal?), and the opposed bodies the index files under [:opposed-between f].

Does `literal` have an argument, every one of them `predicate-spelled?`: the literals a
`:forced-between-predicates` functor makes forced-monotonic (`decide/forced-literal?`),
and the opposed bodies the index files under `[:opposed-between f]`.
sourceraw docstring

binding-problemclj

(binding-problem sentence)

The spelling violation of the length binding sentence states (sx/arity-binding), as {:class :symbol :binding}, or nil: length-class of the bound relation over the lengths the binding admits, {:exact n} or {:min m}. A variable_arity binding admits every length and breaks no spelling.

The spelling violation of the length binding `sentence` states (`sx/arity-binding`),
as `{:class :symbol :binding}`, or nil: `length-class` of the bound relation over the
lengths the binding admits, `{:exact n}` or `{:min m}`.  A `variable_arity` binding
admits every length and breaks no spelling.
sourceraw docstring

blocking-problemsclj

(blocking-problems policy sentence context)

The naming violations that stop a write under policy, as messages, or nil. Nil under :warn and :off, so a caller that returns a value rather than throwing (special/naming-violation, core/check) has no policy branch of its own.

The naming violations that stop a write under `policy`, as messages, or nil.  Nil
under `:warn` and `:off`, so a caller that returns a value rather than throwing
(`special/naming-violation`, `core/check`) has no policy branch of its own.
sourceraw docstring

by-print-keyclj

(by-print-key coll)

coll ordered by its elements' print-key under compare: the guarded (sort-by str coll), with the key built once per element.

`coll` ordered by its elements' `print-key` under `compare`: the guarded
`(sort-by str coll)`, with the key built once per element.
sourceraw docstring

check!clj

(check! policy sentence context)

Enforce policy on sentence in context: throw :naming under :strict, log under :warn, do nothing under :off. Under :strict and :warn it then logs any advice.

Enforce `policy` on `sentence` in `context`: throw `:naming` under `:strict`, log
under `:warn`, do nothing under `:off`.  Under `:strict` and `:warn` it then logs any
`advice`.
sourceraw docstring

check-binding!clj

(check-binding! policy sentence context)

Enforce policy on the length binding sentence states (binding-problem): throw :length-against-spelling under :strict, carrying :relation, :class and :binding, log under :warn, do nothing under :off.

Enforce `policy` on the length binding `sentence` states (`binding-problem`): throw
`:length-against-spelling` under `:strict`, carrying `:relation`, `:class` and
`:binding`, log under `:warn`, do nothing under `:off`.
sourceraw docstring

compare-formclj

(compare-form a b)

A structural total order on sentence and context content, as a Comparator. It walks the two forms in place and reads no handle, so a tie breaks the same way in every arrival order. Kinds order by form-rank; same-kind scalars by compare; two sequentials element by element, then shorter first, so (a) precedes (a b). A value outside sentence content (a map, a set, a record) is compared by its print-key, so the order stays total under an ambient print bound.

A structural total order on sentence and context content, as a `Comparator`.  It
walks the two forms in place and reads no handle, so a tie breaks the same way in
every arrival order.  Kinds order by `form-rank`; same-kind scalars by `compare`;
two sequentials element by element, then shorter first, so `(a)` precedes `(a b)`.
A value outside sentence content (a map, a set, a record) is compared by its
`print-key`, so the order stays total under an ambient print bound.
sourceraw docstring

context-namespaceclj

The namespace of a reified context constant (docs/context-nat.md). A literal, since vaelii.impl.nat requires this namespace.

The namespace of a reified context constant (docs/context-nat.md).  A literal, since
`vaelii.impl.nat` requires this namespace.
sourceraw docstring

context?clj

(context? x)

Is x a context: a Cx… CapitalCamelCase name, or a symbol in the cx/ namespace? Decided by spelling alone, so a query context answers true.

Is `x` a context: a `Cx…` CapitalCamelCase name, or a symbol in the `cx/` namespace?
Decided by spelling alone, so a query context answers true.
sourceraw docstring

distinct-byclj

(distinct-by f coll)

Lazy distinct on (f x), keeping the first element of each key in coll's order. levels folds a derived answer into the stored one it duplicates with it, and checks/first-per-slot keeps one filler per slot.

Lazy `distinct` on `(f x)`, keeping the first element of each key in `coll`'s order.
`levels` folds a derived answer into the stored one it duplicates with it, and
`checks/first-per-slot` keeps one filler per slot.
sourceraw docstring

empty-tallyclj

A fresh tally accumulator: records seen, records with at least one violation, and the records per violation class.

A fresh `tally` accumulator: records seen, records with at least one violation, and
the records per violation class.
sourceraw docstring

functorclj

(functor sentence)
source

individual?clj

(individual? x)
source

length-classclj

(length-class f {exact :exact floor :min})

The class of the spelling violation a relation f of the lengths binding admits commits, or nil: :functor-arity when f is spelled as a type (underscored, or a sense) and binding admits no length of one, :functor-unary when f is camelCase, not unary-spelling-exempt, and binding admits the length one alone. binding is {:exact n} or {:min m}; a bare lowercase word and a symbol matching no convention answer nil.

The class of the spelling violation a relation `f` of the lengths `binding` admits
commits, or nil: `:functor-arity` when `f` is spelled as a type (underscored, or a
sense) and `binding` admits no length of one, `:functor-unary` when `f` is camelCase,
not `unary-spelling-exempt`, and `binding` admits the length one alone.  `binding` is
`{:exact n}` or `{:min m}`; a bare lowercase word and a symbol matching no convention
answer nil.
sourceraw docstring

lexeme-namespaceclj

The namespace that marks a lexeme (docs/naming.md).

The namespace that marks a **lexeme** (docs/naming.md).
sourceraw docstring

lexeme?clj

(lexeme? x)

Is x a lexeme, a symbol in the lex namespace (lex/fool's_gold)? The other role predicates read a symbol's name half and answer false for a lexeme.

Is `x` a lexeme, a symbol in the `lex` namespace (`lex/fool's_gold`)?  The other role
predicates read a symbol's name half and answer false for a lexeme.
sourceraw docstring

literalsclj

(literals sentence)
(literals role form)

The [role literal] pairs of applied-literals whose functor is not a variable: the functors an author named, which every check below reads.

The `[role literal]` pairs of `applied-literals` whose functor is not a variable: the
functors an author named, which every check below reads.
sourceraw docstring

messageclj

(message {:keys [class role symbol literal]})

One problems* map rendered as a rejection line: the offending symbol, the wrapper it sits in, and the spelling to write instead.

One `problems*` map rendered as a rejection line: the offending symbol, the wrapper
it sits in, and the spelling to write instead.
sourceraw docstring

min-by-content-keyclj

(min-by-content-key keyfn coll)
(min-by-content-key keyfn cmp coll)

(first (sort-by-content-key keyfn cmp coll)) in one pass, building the key once per element. A tie keeps the earliest element; nil for an empty coll. cmp defaults to compare-form.

`(first (sort-by-content-key keyfn cmp coll))` in one pass, building the key once per
element.  A tie keeps the earliest element; nil for an empty `coll`.  `cmp` defaults
to `compare-form`.
sourceraw docstring

name-keyclj

(name-key x)

x as a String ordering key where x is expected to be a scalar (a symbol, keyword, string or number): str, which no print bound elides for a scalar. A collection is keyed through print-key instead, so a NAT or a sentence arriving here keys safely.

`x` as a String ordering key where `x` is expected to be a scalar (a symbol, keyword,
string or number): `str`, which no print bound elides for a scalar.  A collection is
keyed through `print-key` instead, so a NAT or a sentence arriving here keys safely.
sourceraw docstring

policiesclj

The :naming settings open-kb accepts, each with the line describing it.

The `:naming` settings `open-kb` accepts, each with the line describing it.
sourceraw docstring

predicate-spelled?clj

(predicate-spelled? x)

Is x spelled as a predicate of arity 2 or more: predicate? and not type-symbol?, so camelCase with an interior capital? A bare lowercase word answers false.

Is `x` spelled as a predicate of arity 2 or more: `predicate?` and not `type-symbol?`,
so camelCase with an interior capital?  A bare lowercase word answers false.
sourceraw docstring

predicate?clj

(predicate? x)
source

(print-key x)

x printed as a content key: pr-str with *print-length* and *print-level* released and *print-meta* off, so no ambient print bound collapses two keys to one. The one home for a printed ordering key; compare-form is the first choice, and this is for a key whose String order is the contract. A symbol without metadata is str, with no binding frame. sort_by_content_key_test fails a printed ordering key in src/ that does not go through this fn or bind the print vars itself.

`x` printed as a content key: `pr-str` with `*print-length*` and `*print-level*`
released and `*print-meta*` off, so no ambient print bound collapses two keys to one.
The one home for a printed ordering key; `compare-form` is the first choice, and this
is for a key whose String order is the contract.  A symbol without metadata is `str`,
with no binding frame.  `sort_by_content_key_test` fails a printed ordering key in
`src/` that does not go through this fn or bind the print vars itself.
sourceraw docstring

problem-classesclj

Each naming violation class problems* reports, with the line describing it. The class is the datum a caller counts by; message renders the prose.

Each naming violation class `problems*` reports, with the line describing it.  The
class is the datum a caller counts by; `message` renders the prose.
sourceraw docstring

problemsclj

(problems sentence context)

The naming violations of sentence in context, as message strings: the context's name, then every literal's functor (outermost wrapper first), then every literal's atomic symbol arguments, then each ist context slot, then a top-level dotted rest marker. A check on the spelling of a name, not on whether the vocabulary wants it (docs/naming.md, "What this does not check").

The naming violations of `sentence` in `context`, as message strings: the context's
name, then every literal's functor (outermost wrapper first), then every literal's
atomic symbol arguments, then each `ist` context slot, then a top-level dotted rest
marker.  A check on the spelling of a name, not on whether the vocabulary wants it
(docs/naming.md, "What this does not check").
sourceraw docstring

problems*clj

(problems* sentence context)

The naming violations of sentence in context, as a vector of {:class :role :symbol :literal} maps in the order problems reports them. :class is a problem-classes key, :role a literal-roles key, and :symbol the name that broke the convention.

The naming violations of `sentence` in `context`, as a vector of
`{:class :role :symbol :literal}` maps in the order `problems` reports them.  `:class`
is a `problem-classes` key, `:role` a `literal-roles` key, and `:symbol` the name
that broke the convention.
sourceraw docstring

query-context?clj

(query-context? x)

Is x one of query-contexts?

Is `x` one of `query-contexts`?
sourceraw docstring

query-contextsclj

The query contexts: three Cx… symbols that name a reading mode rather than a place. The read entry point resolves them, so nothing is stored in one and no genlCx edge names one. context? answers true for each; core/assert's context slot and the genlCx argument slots at vaelii.impl.wff refuse them. What each one reads, and the variable context beside them: docs/contexts.md, "The query contexts".

The **query contexts**: three `Cx…` symbols that name a reading mode rather than a
place.  The read entry point resolves them, so nothing is stored in one and no `genlCx`
edge names one.  `context?` answers true for each; `core/assert`'s context slot and
the `genlCx` argument slots at `vaelii.impl.wff` refuse them.  What each one reads, and
the variable context beside them: docs/contexts.md, "The query contexts".
sourceraw docstring

sense?clj

(sense? x)

A disambiguated type.

A disambiguated type.
sourceraw docstring

snake-caseclj

(snake-case s)

The snake_case spelling of a camelCase symbol, warmBlooded ⇒ warm_blooded: the repair a :functor-unary rejection names.

The snake_case spelling of a camelCase symbol, `warmBlooded` ⇒ `warm_blooded`: the
repair a `:functor-unary` rejection names.
sourceraw docstring

sort-by-content-keyclj

(sort-by-content-key keyfn coll)
(sort-by-content-key keyfn cmp coll)

coll ordered by (keyfn element) under cmp, as a vector. The key is built once per element, where sort-by builds it once per comparison, and not at all below two elements. cmp defaults to compare-form; pass compare for a pre-built Comparable key (a [rank …] tuple, a print-key). The print vars are not bound here: a printed key goes through print-key in keyfn. Stable, so equal keys keep coll's order.

`coll` ordered by `(keyfn element)` under `cmp`, as a vector.  The key is built once
per element, where `sort-by` builds it once per comparison, and not at all below two
elements.  `cmp` defaults to `compare-form`; pass `compare` for a pre-built
`Comparable` key (a `[rank …]` tuple, a `print-key`).  The print vars are not bound
here: a printed key goes through `print-key` in `keyfn`.  Stable, so equal keys keep
`coll`'s order.
sourceraw docstring

tallyclj

(tally t sentence context)

Fold one sentence's violations into t, counting records rather than violations. Counts and classes only, never spellings; vaelii.bench.survey's naming audit groups by spelling.

Fold one sentence's violations into `t`, counting records rather than violations.
Counts and classes only, never spellings; `vaelii.bench.survey`'s `naming` audit
groups by spelling.
sourceraw docstring

tally-lineclj

(tally-line t)

The line a load logs about t, or nil when no record was refused.

The line a load logs about `t`, or nil when no record was refused.
sourceraw docstring

type-symbol?clj

(type-symbol? x)

A type: bare snake_case (dog, physical_object) or a sense (abrasive-grit). Both are unary predicates — a sense is a type that says which sense it is.

A type: bare snake_case (`dog`, `physical_object`) or a sense (`abrasive-grit`).
Both are unary predicates — a sense is a type that says which sense it is.
sourceraw docstring

unary-spelling-exemptclj

The camelCase functors legal at arity 1 because they name no relation (docs/naming.md, "The one exemption").

The camelCase functors legal at arity 1 because they name no relation
(docs/naming.md, "The one exemption").
sourceraw docstring

value?clj

(value? x)

Is x a value: neither a symbol nor a sequential compound? A string, number, keyword, boolean, character, nil and a tagged literal (#inst, #uuid) each denote themselves, so each has instances of nothing. A reified NAT is a nat/ symbol, so it is no value.

Is `x` a value: neither a symbol nor a sequential compound?  A string, number, keyword,
boolean, character, `nil` and a tagged literal (`#inst`, `#uuid`) each denote themselves,
so each has instances of nothing.  A reified NAT is a `nat/` symbol, so it is no value.
sourceraw docstring

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