Glossary#

Each term that the spec defines, with the rule that defines it.

.mtpc#
compiled model#

The JSON file that the compiler writes for one world model, and the only thing that passes from the compiler to the runtime. Defined in Compiler and runtime, and its format in The .mtpc format.

animation#

A collection of moves, played in order or at once, as a group is a collection of shapes. Defined in Time and animation.

author#

The person who writes a page and places components of world models in it. Defined in Compiler and runtime.

binding#

A name that a let, a foreach or a parameter gives to a value for a part of a source. A binding creates nothing (Rule 6.1).

body#

The last items of a form, after its optional arguments. What a body may hold depends on the form (Rule 4.16).

bool#

A value of type bool: true or false. Written as the word true or false (Rule 8.2, Rule 3.9).

brackets#

A […] right after a name or a list literal, which reads a part of it (Rule 4.4, Rule 4.5).

broadened type#

Two words or more joined by | with no whitespace between them, such as real|none (Rule 4.6).

built-in type#

One of the types that mtp gives, such as real, point or circle, whose name no declaration and no binding takes (Rule 6.7).

call depth limit#

The constant max-call-depth, which is 256: a call known when compiling that, when folded, would nest calls of functions deeper than it is a compile error. Defined in Evaluation.

choice type#

A string type refined by (one-of …) to a few strings (Rule 8.14).

choreo#

A template of moves, (choreo N PARAMS ITEM…), as a motif is a template of shapes. Each use is the body of the choreo with the values of its parameters. Defined in Time and animation.

comment#

Text from ; up to the end of the line (Rule 3.4).

compile error#

An error by which a step of compiling after the parse step rejects a source. Defined in Compiler and runtime, and each one in Errors.

compiler#

The program that turns a source file into a .mtpc, in the steps parse, rewrite, prove, expand, fold and write. Defined in Compiler and runtime.

complex#

A value of type complex: two binary64 numbers, its real part and its imaginary part, within the number limit. Written as a number literal with an imaginary part, such as 2i or 1+2i (Rule 12.9, Rule 3.12).

component#

A view, a control or a listener: what the illustrator declares and the author places on a page. Defined in Compiler and runtime.

constraint#

A form that refines a type to some of its values, such as (>= 0) or (one-of 'a' 'b') (Rule 8.6).

control#

A component that the reader presses, drags or clicks, and which writes the model: a slider, a button, a play, a stepper or a toggle. Defined in Compiler and runtime.

core form#

A form that is not sugar, such as a form whose head is core or a call of a library function. The prover proves core forms, and the runtime runs them. See Rule 5.1 and Rule 5.3.

corrupt .mtpc#

A .mtpc that matches the schema of its version and breaks a rule of this spec. The compiler never writes one, and the runtime refuses every one. Defined in Compiler and runtime.

declaration#

A form that creates a new thing that can be addressed: an object of the world model, a function, a type or a choreo, with a name or without one (Rule 6.1).

digit#

One of the ASCII digits 0 to 9 (Rule 3.12).

docstring#

(doc 'text'), usually written doc@'text': plain text about a declaration, for the illustrator (Rule 3.15, Rule 4.15).

evaluation#

Computing the value of an expression, when compiling or while drawing. Evaluation changes nothing. Defined in Evaluation.

expression#

One item of a source as the parser produces it: a form, a list literal, a word or a string literal (Rule 4.7).

file scope#

The scope of a whole file. Its names are the names of its top-level declarations, the names that its imports give, and the names of the declarations of its scene at any depth (Rule 6.2).

file to import#

A .mtp file that another file imports with import. It holds only the forms that Table 4.1 allows at its top level. Defined in Imports.

fit#

A type A fits a type B when a value of type A is accepted where a value of type B is expected (Rule 8.4).

folding#

Computing an expression whose inputs are all known when compiling, and writing its value into the .mtpc in place of the expression. Defined in Evaluation.

form#

A head and its items in parentheses, such as (circle p (r 1)) (Rule 4.2, Rule 4.10).

format spec#

The text after : in the braces of an interpolated string, such as .2f in {x:.2f} (Rule 3.16).

free starting value#

(free X), also written free@X: a free value that starts at the value of X and does not change when X changes (Rule 3.15, Core and derived forms).

head#

The first item of a form (Rule 4.10).

illustrator#

The person who writes a world model as an .mtp source file. Defined in Compiler and runtime.

int#

A value of type int: an exact whole number, within the number limit. Written as a number literal that is a whole number, such as 3 or -2 (Rule 12.9, Rule 3.12).

interface#

A type that no object has as its own type, which every type with what it lists satisfies, such as shape or a type declared with interface (Rule 8.15).

interpolated string#

$'…': a string literal with expressions in braces, whose values are filled in (Rule 3.16).

keyword#

The head of a form of the language, such as circle, if or on-drag, which no declaration and no binding takes as its name (Rule 3.10, Rule 6.7).

known length#

The length of a list when it is known when compiling, as a (length n) in its type (Rule 8.12).

letter#

One of the ASCII letters a to z and A to Z, as a character of a name (Rule 3.7).

library#

The built-in functions and the files of the standard library. A call of a library function is a core form. See Rule 5.3.

list#

A value of a list type list[T]: items of type T, in order, of any length. Written as expressions in square brackets, such as [0 1] (Rule 8.2, Rule 4.4).

listener#

A component that is written inside a view and has no page element of its own, and which writes the model when the reader acts on a shape or a term, or when its view changes. Defined in Compiler and runtime.

literal#

Text that writes a value directly, such as 2.5, 'crimson' or [0 1] (Rule 8.10).

live model#

The world model of one .mtpc, as the runtime holds it in memory while a page is open, with the current value of every variable and attribute. Defined in Compiler and runtime.

match#

Two values match when they are equal, except that two reals match when they are within about a millionth of their size. Matching is not equality, and only the runtime matches values: the step of a play or a stepper is read from the scene by matching. Defined in Evaluation.

motif#

A template of shapes, (motif N PARAMS ITEM…). Each instance is the body of the motif with the values of its parameters. Defined in World model.

move#

A form (move T …) that changes one target, such as a variable or an attribute, to a new value over a duration. Every control, listener and animation that changes the model over time plays moves. Defined in Time and animation.

name#

A word that refers to a declaration or a binding: name parts joined by dots, such as p.pos.x (Rule 3.7).

name part#

A piece of a name: the text between two dots, or a pair of brackets, such as pos and [0] in xs[0].pos (Rule 3.7, Rule 4.5).

name string#

#'…': an interpolated string read as a name, which is (name $'…') (Rule 3.16, Rule 4.8).

number limit#

±10¹⁵⁰, the bound on every number. Every result and every write is clamped to it. Defined in Evaluation.

object#

A thing that a declaration creates in the world model, such as the scene, a shape, a variable, a component, a transition or an animation. It stays the same object while its value or the values of its attributes change (Rule 8.1).

open page#

A page open in the reader’s browser, with the runtime and one live model for each .mtpc that the page loads. Defined in Compiler and runtime.

operator#

One of the words + - * / ^ < <= > >= = != ., read as a name with one name part (Rule 3.9).

optional argument#

A form after the name and the positional arguments of a form, whose head names one of the optional arguments that the form allows, such as (r 1) in (circle c (r 1)) (Rule 4.13).

parser#

The part of the compiler that does the parse step: it reads the text into forms by the syntax alone. Defined in Compiler and runtime.

positional argument#

An item of a form that comes right after the name, known by its place (Rule 4.10).

prover#

The part of the compiler that does the prove step: it checks types, proves ranges and constraints, and checks every invariant of the world model. It is given only core forms. See Rule 2.1.

range#

The closed interval of reals that holds every value of an expression, which the prover works out (Rule 10.8, Rule 10.9).

ratio#

A value of type ratio: an exact fraction, within the number limit. Written as a number literal that is an exact fraction, such as 1/3 (Rule 12.9, Rule 3.12).

reader#

The person who opens a page and acts on its components. Defined in Compiler and runtime.

real#

A value of type real: a finite binary64 number, within the number limit. Written as a number literal with a decimal point or an exponent, such as 2.5 or 1e3 (Rule 12.9, Rule 3.12).

refined type#

A type with constraints, written (T C…), whose values are the values of T that meet every constraint (Rule 8.2, Rule 8.6).

rewrite#

A pair of mtp fragments: a sugar form, and the core forms that it means. See Rule 5.4.

runtime#

The program that runs in the reader’s browser, loads each .mtpc that a page names, builds its live model, keeps it current, and serves the components that the page places. Defined in Compiler and runtime.

runtime script#

The file mathterpiece.js, which holds the runtime and defines the page elements. It is the same for every world model. Defined in Compiler and runtime.

scope#

A part of a file in which some names may be used, such as the body of a motif or of a let (Rule 6.2).

seed#

A free variable of type rand-seed, from which random values are computed. Defined in Evaluation.

site#

The number that each call of a random function has, counted from 0 in the order of the calls in the source after the rewrite step. Defined in Evaluation.

string#

A value of type string: text. Written as text in single quotes, such as 'crimson' (Rule 8.2, Rule 3.13).

sugar#

A form that can be rewritten into core forms without computing any value and without using any type. Also called a derived form. See Rule 5.2.

syntax error#

An error by which the parse step rejects a source. Defined in Compiler and runtime.

TeX string#

tex'…': a string literal of LaTeX, in which only \' is an escape (Rule 3.14).

value#

What an expression gives: a number, a bool, a string, a color, a font, a point, a transform, a list, a function or none. A value never changes (Rule 8.1).

view#

A component through which the reader sees the model: a canvas, a readout or a display. Defined in Compiler and runtime.

whitespace#

The characters space, tab, line feed and carriage return. Whitespace and comments have no meaning (Rule 3.4).

word#

A name, a number, an operator, a bool literal or none (Rule 3.5).

world model#

Everything that one .mtp source file defines, such as its shapes, variables and components. The compiler builds it, the .mtpc stores it, and the runtime holds it as the live model. Defined in World model.