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
- numberA document: the tab is its type42
- numberA dashed tab: the container declares the type42
- addParts: a card inside a cardnumber1number2
- kindA kind: a document of type kindnew
A kind gives three things:
- The evaluator of each verb. A verb is a question, for example
evalorview. 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.
The kind, as a document
kind
addThe sum of its parts. A bare number in its list gets the type number.
| eval | math.add |
|---|---|
| view | view.op |
| parts | a list of number |
| side | derive |
A document of this kind, evaluated
add14
number
2
2multiply12
number
3
3number
4
4The JSON
{
"type": "add",
"value": [
2,
{
"type": "multiply",
"value": [3, 4]
}
]
}A kind is data
Section titled “A kind is data”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.