Playground
Each card of this page is the same glyph as on the other pages. Build a larger document, and its picture is made of the same parts.
Select a card to edit it. The picture evaluates after each change. An empty place evaluates to an error value.
- 1adda3number11number22
- 2multiplyb30refnamesa3number1010
- 3▸log30refnamesb30
The text
The text and the picture show the same document. Change the text, and the picture changes when the text is good.
- 1log30
Edit the JSON
How to build
Section titled “How to build”- Select a starting document, or keep the one that is there.
- Select a card. The panel shows its kind, its value and its name.
- Change the kind to replace the card with a new document of that kind. Each necessary place of the new document is empty.
- Select Add a part to add an empty part to a list. Select Put in a list to nest the card one level deeper.
- Select Empty this place to remove the document and keep its place.
- Select Step through it to see each event of the evaluation.
The editors come from the contracts
Section titled “The editors come from the contracts”The panel names no kind. It reads the contract of the selected card:
- A data shape gives an input: a text, a number or a menu.
- A record shape gives one row for each field, and each row tells if the field is necessary.
- A position lists only the kinds that its contract permits.
- A reference lists the names that its place can read.
An empty place holds a document of the kind hole. It evaluates to the error value #HOLE, and that error has its place. Thus each state of an edit evaluates, and the other cards keep their results. The text of an empty place is hole().
The text
Section titled “The text”The text pane shows the document as a formula, for example 2 + 3 * 4. Change the text. After a short wait, the picture shows the new document.
- A text with a problem does not change the picture. The pane shows the message and marks the problem in the text.
- A document can have no text. The pane then tells which part has no text form, and why. The cards still work.
- The text has the operators
+,*and>, and the formsif,list,seq,pure,logandwrite. A bare name, for exampleprice, reads a name of the context. - The text
a = 1 + 2gives a step the namea. The formmath.productwrites the alias ofmultiply. - A data envelope has a form with one literal, for example
text("big"). A node of a tree has a key for each field, for examplepanel(width: 300). - A bare literal in a part of
if,list,seqorpureis a data envelope, thusif(size > 10, "big", "small")evaluates. The whole text42is a number too. - The forms
add,multiplyandgreaterwrite an operator with one part or none, for exampleadd(5). - A step of a path in parentheses is a document, for example
self.parent.(nearest(type: "panel")).width.
The JSON under the picture is the document. Change it, and the picture changes.