Skip to content

Kinds

The type of a document is the name of a kind. A kind is a document too, with the type kind. Thus the site draws a kind as a card, with the glyphs of the page before.

The glyphs so far: 5, 1 new on this page
  • 42Data: a value without a type
  • number
    42
    A document: the tab is its type
  • number
    42
    A dashed tab: the container declares the type
  • add
    number
    1
    number
    2
    Parts: a card inside a card
  • kindA kind: a document of type kindnew

A kind gives three things:

  • The evaluator of each verb. A verb is a question, for example eval or view. The kind names the evaluator that answers it.
  • The place of the parts. The value of a document is data, a list of parts, or a record with named parts. A list can declare the type of its bare items.
  • The side. A kind on the derive side is pure. A kind on the run side causes effects.

Select a kind to see it as a document, and to see a document of that kind after its evaluation.

Data
Operations
Control and names
Effects
Trees and paths
Kinds

The kind, as a document

kind
addThe sum of its parts. A bare number in its list gets the type number.
evalmath.add
viewview.op
partsa list of number
sidederive

A document of this kind, evaluated

add
number
2
2
multiply
number
3
3
number
4
4
12
14
The JSON
{
  "type": "add",
  "value": [
    2,
    {
      "type": "multiply",
      "value": [3, 4]
    }
  ]
}
A kind is a document of type kind. It names the evaluator of each verb, the place of the parts of its value, and its side. The view of the kind kind draws it, by the same ladder as each other card.

To change how each document of a kind evaluates, write the document of the kind. No registry changes, and no code changes. A new kind is one new document.

The site uses this rule for its own pictures. Each card is drawn by the view that the kind of its document names. The verb view goes up the same ladder as the verb eval. The next page shows the ladder.