Skip to content

Latest commit

 

History

History
130 lines (107 loc) · 7.47 KB

settings.md

File metadata and controls

130 lines (107 loc) · 7.47 KB

Settings a program writes

A program chooses how it is drawn and bounds its recorded explanation with equations in &mettagrapher:

!(add-atom &mettagrapher (= (setting output view) side-by-side))
!(add-atom &mettagrapher (= (setting evaluation max-steps) 50))
(= (fact $n) (if (> $n 0) (* $n (fact (- $n 1))) 1))
!(fact 5)

How a setting is read

  • A write takes effect where the program runs it. The evaluation settings are read just before each call, so a line that sets one governs the calls after it. The rest describe the drawing as a whole and are read when the program ends, so a line after the last call still counts.
  • Only a line the program runs writes anything. In a program that marks its calls with !, an unmarked (add-atom &mettagrapher ...) is an inert atom, as MeTTa treats it.
  • A setting is evaluated, so (= (setting output width) (* 2 240)) sets 480.
  • A setting that answers nothing or more than once, names a family or key nothing reads, or answers the wrong kind of value is refused, and the refusal names it. So is writing the same setting twice, which answers twice.
  • renderReductionGif and mettagrapher gif read the output, animation, evaluation, activation and substitution settings, and a view or settings the caller passes to renderReductionGif is laid over the program's own. The browser workspace reads the evaluation settings and draws with its own view, size and pacing. The playback settings are read by playerPayload, the payload a player page is built from, and editor view by nothing yet.

output

Setting Value Default
output view blocks, graph or side-by-side: the view a GIF is drawn in blocks
output width a whole number from 1 to 4096: the width, in pixels, of the stage before it grows 720
output scale a number above 0: how many pixels a GIF draws per stage pixel; width times scale must round to at most 4096 1
output max-frames a whole number from 1 to 360: the most frames in an exported animation, which paces every step shorter when needed; an export with more settled states than this is refused. The interactive canvas retains every settled state. 360
output min-scale a number from 0 to 2: the smallest a node is drawn; a stage that would draw smaller grows instead, and 0 turns the floor off 1
output max-stage-growth a number from 1 to 16: how many times its width a stage may grow to keep nodes at min-scale 4

editor

Setting Value Default
editor view graph or blocks: the view an editor opens a program in; checked, and not yet read by the workspace graph

animation

Setting Value Default
animation frames-per-step a whole number from 1 to 360 of frames per morph, or auto for morph-ms over frames of step-ms each; a step whose values take several hop-lengths, a binding and then the holes it fills, lasts that many morphs and gets that many times the frames; either way no more than max-frames allows auto
animation hold-ms milliseconds from 0 to 60000 that each settled state is held 120
animation step-ms milliseconds from 1 to 60000 that automatic pacing gives one frame 20
animation morph-ms milliseconds from 0 to 60000 that one transition takes, or each hop-length of one whose values take several 550

Two timing laws are equations rather than settings, written into &mettagrapher the same way. Each is asked for its value at 65 points from $t = 0 to 1 and must answer each exactly once with a finite number, 0 at the start and 1 at the end.

  • (= (animation-progress $t) ...) times every transition, so it may not move backwards or leave 0 through 1.
  • (= (animation-settle $t) ...) is how a form travels, and may overshoot to anywhere from -0.35 to 1.35 on the way.

evaluation

Setting Value Default
evaluation max-steps a whole number from 1 to 10000: the explanatory frames a call is drawn in before its answer 1000
evaluation max-events a whole number from 1 to 10000000: the recorded events expanded into explanatory detail for one call 10000
evaluation show-pruned True or False: whether branches confirmed empty are drawn False

Drawing bounds leave the native run complete. When a bound cuts the explanation, the drawing reports it and retains the actual answers and final state. The former evaluation max-inferences setting is removed: analysis no longer evaluates MeTTa.

playback

Setting Value Default
playback autoplay True or False: whether a player starts on its own True
playback loop True or False: whether a player starts again at the end False

activation

How the expression being reduced glows.

Setting Value Default
activation expansion a number above 0: how far the glow reaches past the expression 2.5
activation blur a number of at least 0 0.85
activation opacity a number from 0 through 1 0.52

substitution

How a value travels out of a call and into the variables of the equation it matched: the curve of its route, the arrow drawn along it, and when it enters and leaves. Besides each range, a bend's and an arrow's minimum may not pass its maximum, and a fan-out has to open before it closes.

Setting Value Default
substitution curve-distance-ratio a number of at least 0 0.06
substitution curve-min-bend a number of at least 0 6
substitution curve-max-bend a number greater than 0 18
substitution fan-spacing a number of at least 0: how far apart the arrows filling one variable's holes from its binding are bent 1.5
substitution overlap-padding a number of at least 0: how much of a route has to lie outside the two outlines it joins for it to be drawn 6
substitution stroke-width a number greater than 0 1.35
substitution target-stroke-width a number greater than 0 2.2
substitution target-glow-start a number of at least 0 and less than 1 0.72
substitution target-glow-exit-fraction a number greater than 0 and at most 1 (/ 1 3)
substitution route-opacity a number from 0 through 1 0.68
substitution source-opacity a number from 0 through 1 0.82
substitution materialize-scale-start a number from 0 through 1 0
substitution materialize-move-start a number of at least 0 and less than 1 0.55
substitution fanout-split-start-ratio a number of at least 0 0.12
substitution fanout-split-end-ratio a number of at least 0 0.65
substitution arrow-length-ratio a number of at least 0 0.06
substitution arrow-min-length a number of at least 0 4
substitution arrow-max-length a number greater than 0 8.5
substitution arrow-width-ratio a number greater than 0 0.52
substitution arrow-reveal-start a number of at least 0 and less than 1 0.72
substitution enter-fraction a number greater than 0 and at most 1 0.5
substitution exit-fraction a number greater than 0 and at most 1 (/ 1 3)
substitution arrival-stagger a number from 0 through 1: how long each value setting out waits behind the one before it, as a share of one hop; a variable's other holes fill together once its binding lands 0.28
substitution path-samples a whole number of at least 2 12