X_eTaL in LaTeX

Every line of code we ship or document (3595 lines), as typed, as xetal render --latex writes it, and as KaTeX draws it. The gate checks that KaTeX accepts every one.

demos/arrays.xtl · demos/birds-untyped.xtl · demos/classics/automaton.xtl · demos/classics/bases.xtl · demos/classics/closure.xtl · demos/classics/collatz.xtl · demos/classics/duck.xtl · demos/classics/factorial.xtl · demos/classics/fibonacci.xtl · demos/classics/gcd.xtl · demos/classics/hanoi.xtl · demos/classics/histogram.xtl · demos/classics/life-drawn.xtl · demos/classics/magic.xtl · demos/classics/mandelbrot.xtl · demos/classics/mastermind-play.xtl · demos/classics/mastermind.xtl · demos/classics/matmul.xtl · demos/classics/mini-apl.xtl · demos/classics/pascal.xtl · demos/classics/primes.xtl · demos/classics/queens.xtl · demos/classics/quicksort.xtl · demos/classics/rle.xtl · demos/classics/roman.xtl · demos/classics/sequences.xtl · demos/classics/shortest.xtl · demos/classics/sieve.xtl · demos/classics/sorting.xtl · demos/classics/truth.xtl · demos/classics/turtle.xtl · demos/classics/wordfreq.xtl · demos/combinators.xtl · demos/factorial.xtl · demos/fixed-point.xtl · demos/hello-library.xtl · demos/higher-order.xtl · demos/keys.xtl · demos/leetcode/numbers-in-string.xtl · demos/life.xtl · demos/macros.xtl · demos/magmas.xtl · demos/monads.xtl · demos/rosetta/Comparison.xtl · demos/rosetta/Stone.xtl · demos/rosetta/cube.xtl · demos/rosetta/rosetta.xtl · demos/rotate.xtl · demos/square.xtl · demos/stats.xtl · demos/sub.xtl · demos/tour.xtl · demos/tttml-play.xtl · demos/tttml-train.xtl · demos/tttml.xtl · demos/unit.xtl · demos/user-macros.xtl · lib/Combinators.xtl · lib/Geometry3D.xtl · lib/Maybe.xtl · lib/Stats.xtl · lib/Svg.xtl · lib/TTTML.xtl · lib/Terminal.xtl · lib/Turtle.xtl · userlibs/Greetings.xtl · userlibs/Hello.xtl · docs/literate/beginner.org · docs/literate/birds.org · docs/literate/classics.org · docs/literate/duck.org · docs/literate/finnapl-idioms.org · docs/literate/hanoi.org · docs/literate/hello.org · docs/literate/libraries.org · docs/literate/life.org · docs/literate/macros.org · docs/literate/rosetta.org · docs/literate/tour.org · docs/literate/trains.org · docs/literate/tttml.org · docs/reference.md · spec/ambiguity/adjacent-names.case · spec/ambiguity/function-exponent.case · spec/ambiguity/function-without-argument.case · spec/ambiguity/guard-outside-lambda.case · spec/ambiguity/left-without-right.case · spec/ambiguity/long-right-scope.case · spec/ambiguity/mixed-parameters.case · spec/ambiguity/name-then-number.case · spec/ambiguity/no-parameters.case · spec/ambiguity/quote-variable.case · spec/ambiguity/quoted-left-is-operand.case · spec/ambiguity/reject-string-number-strand.case · spec/ambiguity/statement-in-parens.case · spec/ambiguity/symbol-after-function.case · spec/ambiguity/symbol-one-argument.case · spec/ambiguity/too-deep.case · spec/ambiguity/trailing-symbol.case · spec/ambiguity/value-in-train.case · spec/ambiguity/value-then-operand.case · spec/eval/add.case · spec/eval/axes.case · spec/eval/bool-arithmetic.case · spec/eval/bound-condition.case · spec/eval/cat-axis.case · spec/eval/closures.case · spec/eval/compose.case · spec/eval/decode-any.case · spec/eval/display.case · spec/eval/division-is-float.case · spec/eval/each-dyadic.case · spec/eval/each.case · spec/eval/empty-char-kind.case · spec/eval/empty-kind-boxes.case · spec/eval/empty-kind-primitives.case · spec/eval/empty-kind-through-take.case · spec/eval/encode-decode.case · spec/eval/ensure-error.case · spec/eval/ensure.case · spec/eval/evaluation-order.case · spec/eval/exact-equality.case · spec/eval/exponent-canonical.case · spec/eval/exponent-literals.case · spec/eval/factorial.case · spec/eval/float-printing.case · spec/eval/format.case · spec/eval/grid.case · spec/eval/identity-and-tacks.case · spec/eval/inner-empty.case · spec/eval/inner.case · spec/eval/integer-division.case · spec/eval/lazy-parameter.case · spec/eval/literal-is-polymorphic.case · spec/eval/local-poly-literal.case · spec/eval/map.case · spec/eval/match.case · spec/eval/multi-axis-polymorphic.case · spec/eval/multi-axis.case · spec/eval/mutation.case · spec/eval/mutual-recursion.case · spec/eval/nested-equal.case · spec/eval/nested.case · spec/eval/partial-application.case · spec/eval/partition.case · spec/eval/path.case · spec/eval/phi-combinator.case · spec/eval/poly-group-float.case · spec/eval/poly-literal-float.case · spec/eval/poly-literal-print.case · spec/eval/poly-recursion-float.case · spec/eval/power-builtin.case · spec/eval/power.case · spec/eval/powers.case · spec/eval/quad-clock.case · spec/eval/quad-values.case · spec/eval/reduce-empty.case · spec/eval/reduce.case · spec/eval/reject-array-division-by-zero.case · spec/eval/reject-axis-beyond-rank.case · spec/eval/reject-axis-rank-change.case · spec/eval/reject-axis-several.case · spec/eval/reject-bound-condition-float.case · spec/eval/reject-cat-axis-beyond.case · spec/eval/reject-cat-axis-many.case · spec/eval/reject-cat-axis-shape.case · spec/eval/reject-cat-shapes.case · spec/eval/reject-color-out-of-range.case · spec/eval/reject-compose-types.case · spec/eval/reject-continue-signal.case · spec/eval/reject-decode-length.case · spec/eval/reject-decode-mixed.case · spec/eval/reject-decode-overflow.case · spec/eval/reject-delay-negative.case · spec/eval/reject-disclose-many.case · spec/eval/reject-disclose-plain.case · spec/eval/reject-division-by-zero.case · spec/eval/reject-duplicate-definition.case · spec/eval/reject-each-extra-argument.case · spec/eval/reject-each-nested.case · spec/eval/reject-each-shape.case · spec/eval/reject-each-types.case · spec/eval/reject-empty-first.case · spec/eval/reject-empty-reshape.case · spec/eval/reject-encode-float-radix.case · spec/eval/reject-encode-rank.case · spec/eval/reject-encode-types.case · spec/eval/reject-grid-rank.case · spec/eval/reject-identity-dyadic.case · spec/eval/reject-inner-length.case · spec/eval/reject-inner-types.case · spec/eval/reject-key-as-color.case · spec/eval/reject-match-types.case · spec/eval/reject-negative-exponent.case · spec/eval/reject-negative-range.case · spec/eval/reject-nested-types.case · spec/eval/reject-no-guard.case · spec/eval/reject-no-identity.case · spec/eval/reject-not-a-bool.case · spec/eval/reject-not-unit.case · spec/eval/reject-numbers-type.case · spec/eval/reject-numbers.case · spec/eval/reject-overflow.case · spec/eval/reject-partition-keys.case · spec/eval/reject-partition-length.case · spec/eval/reject-path-shape.case · spec/eval/reject-pi-argument.case · spec/eval/reject-power-dyadic.case · spec/eval/reject-power-negative.case · spec/eval/reject-program-defines-library-names.case · spec/eval/reject-quad-unknown-value.case · spec/eval/reject-quad-value-applied.case · spec/eval/reject-reduce-lambda-empty.case · spec/eval/reject-reduce-types.case · spec/eval/reject-replicate-length.case · spec/eval/reject-replicate-negative.case · spec/eval/reject-replicate-rank.case · spec/eval/reject-replicate-types.case · spec/eval/reject-roll-float.case · spec/eval/reject-roll-zero.case · spec/eval/reject-rotate-amount-rank.case · spec/eval/reject-rotate-amount-type.case · spec/eval/reject-rotate-axes-amount-rank.case · spec/eval/reject-rotate-axis-beyond-rank.case · spec/eval/reject-scan-overflow.case · spec/eval/reject-scan-shape.case · spec/eval/reject-search-cells.case · spec/eval/reject-search-kinds.case · spec/eval/reject-shape-mismatch.case · spec/eval/reject-show-types.case · spec/eval/reject-signal-code.case · spec/eval/reject-sort-boxes.case · spec/eval/reject-structural.case · spec/eval/reject-swap-monadic.case · spec/eval/reject-table-nested.case · spec/eval/reject-table-types.case · spec/eval/reject-tack-monadic.case · spec/eval/reject-train-atop-number.case · spec/eval/reject-train-atop-outer.case · spec/eval/reject-train-chain.case · spec/eval/reject-train-dyadic-middle.case · spec/eval/reject-train-dyadic-tine.case · spec/eval/reject-train-fork-middle.case · spec/eval/reject-train-long.case · spec/eval/reject-train-named.case · spec/eval/reject-train-nested.case · spec/eval/reject-train-runtime.case · spec/eval/reject-transpose-axis-beyond.case · spec/eval/reject-transpose-axis-one.case · spec/eval/reject-transpose-axis-three.case · spec/eval/reject-transpose-dyadic.case · spec/eval/reject-transpose-length.case · spec/eval/reject-transpose-range.case · spec/eval/reject-transpose-repeated.case · spec/eval/reject-trap-recover-type.case · spec/eval/reject-trig-types.case · spec/eval/reject-u-char-range.case · spec/eval/reject-u-cs-number.case · spec/eval/reject-vector-condition.case · spec/eval/reject-warn-type.case · spec/eval/reject-where-matrix.case · spec/eval/reject-where-not-bool.case · spec/eval/replicate-axis.case · spec/eval/replicate.case · spec/eval/reshape-and-range.case · spec/eval/reverse.case · spec/eval/right-to-left.case · spec/eval/roll.case · spec/eval/rotate.case · spec/eval/s-combinator.case · spec/eval/scalar-extension.case · spec/eval/scan.case · spec/eval/search.case · spec/eval/select-first-cat.case · spec/eval/signal.case · spec/eval/square.case · spec/eval/strands.case · spec/eval/string-comparison.case · spec/eval/string-structure.case · spec/eval/strings-are-char-vectors.case · spec/eval/sub.case · spec/eval/swap.case · spec/eval/table.case · spec/eval/take-and-drop.case · spec/eval/terminal-types.case · spec/eval/transpose-axes.case · spec/eval/transpose-permute.case · spec/eval/transpose.case · spec/eval/trap-halt.case · spec/eval/trap-nested.case · spec/eval/trap-retry.case · spec/eval/trap.case · spec/eval/trig.case · spec/eval/unicode-strings.case · spec/eval/unique-sort.case · spec/eval/warn-ensure-recover.case · spec/eval/warn-ensure.case · spec/eval/warn-halt.case · spec/eval/warn-recover.case · spec/eval/warn-uncaught.case · spec/eval/warn.case · spec/eval/y-combinator.case · spec/integration/combinators.case · spec/integration/geometry3d.case · spec/integration/idioms.case · spec/integration/life-blinker.case · spec/integration/long-aliases.case · spec/integration/maybe.case · spec/integration/reject-alias-digit-first.case · spec/integration/reject-alias-uppercase.case · spec/integration/reject-hidden-namespace.case · spec/integration/reject-maybe-types.case · spec/integration/svg.case · spec/integration/turtle.case · spec/lex/abutting.case · spec/lex/assign.case · spec/lex/axes.case · spec/lex/binding-arrow-guard.case · spec/lex/comments.case · spec/lex/docs-input-examples.case · spec/lex/exponent-literals.case · spec/lex/exponents.case · spec/lex/function-names.case · spec/lex/lambda-args.case · spec/lex/life.case · spec/lex/long-prefixes.case · spec/lex/negative-literals.case · spec/lex/power-spaced.case · spec/lex/quotes.case · spec/lex/square.case · spec/lex/strings.case · spec/lex/subtraction.case · spec/lex/symbols.case · spec/lex/trailing-marks.case · spec/lex/variables.case · spec/macros/argument-error-located.case · spec/macros/assert.case · spec/macros/catch-halts.case · spec/macros/catch.case · spec/macros/cfg.case · spec/macros/combinators-b.case · spec/macros/combinators-y.case · spec/macros/dbg-hygienic.case · spec/macros/dbg.case · spec/macros/each.case · spec/macros/error.case · spec/macros/file.case · spec/macros/finally.case · spec/macros/format-hole-located.case · spec/macros/format.case · spec/macros/hygiene-anaphor.case · spec/macros/hygiene-capture.case · spec/macros/hygiene-numbering.case · spec/macros/if.case · spec/macros/in-lambda.case · spec/macros/line.case · spec/macros/nested.case · spec/macros/panic-int.case · spec/macros/panic.case · spec/macros/reject-assert-at.case · spec/macros/reject-at-for-text.case · spec/macros/reject-combinators-y-shape.case · spec/macros/reject-each-expression.case · spec/macros/reject-each-no-word.case · spec/macros/reject-format-empty.case · spec/macros/reject-format-lone-brace.case · spec/macros/reject-format-text-left.case · spec/macros/reject-format-unclosed.case · spec/macros/reject-fresh-alias.case · spec/macros/reject-fresh-namespace.case · spec/macros/reject-hook-outside.case · spec/macros/reject-if-branches.case · spec/macros/reject-include-absolute.case · spec/macros/reject-include-missing.case · spec/macros/reject-macro-in-program.case · spec/macros/reject-no-macro-library.case · spec/macros/reject-not-strings.case · spec/macros/reject-retry-text.case · spec/macros/reject-s-is-not-system.case · spec/macros/reject-strand.case · spec/macros/reject-text-for-at.case · spec/macros/reject-try-at.case · spec/macros/reject-unknown.case · spec/macros/reject-user-not-exported.case · spec/macros/retry-halt-continue.case · spec/macros/s-alias.case · spec/macros/todo.case · spec/macros/try.case · spec/macros/unless.case · spec/macros/user-in-expression.case · spec/macros/user-macros.case · spec/names/h-helpers-in-an-app.case · spec/names/reject-bare-function-in-app.case · spec/names/reject-h-alias.case · spec/render/axes.case · spec/render/comments.case · spec/render/docs-input-table.case · spec/render/exponents.case · spec/render/lambda-args.case · spec/render/life.case · spec/render/ligatures.case · spec/render/namespaces.case · spec/render/unchanged.case · spec/render/underline.case · spec/syntax/apply-argument.case · spec/syntax/apply-computed.case · spec/syntax/dyadic-left-is-one-value.case · spec/syntax/guards-multiline.case · spec/syntax/inner-two-operands.case · spec/syntax/lambda-inline-dyadic.case · spec/syntax/lambda-innermost.case · spec/syntax/lambda-lazy-guards.case · spec/syntax/lambda-left-right.case · spec/syntax/lambda-niladic.case · spec/syntax/lambda-right.case · spec/syntax/life.case · spec/syntax/long-right-scope.case · spec/syntax/mutable-binding.case · spec/syntax/newline-in-parens.case · spec/syntax/paren-exponent.case · spec/syntax/power-quoted.case · spec/syntax/power-spaced.case · spec/syntax/power.case · spec/syntax/quote-operand.case · spec/syntax/quote-value.case · spec/syntax/quoted-lambda-operand.case · spec/syntax/reject-unit-parameter-value.case · spec/syntax/right-to-left.case · spec/syntax/square.case · spec/syntax/statements.case · spec/syntax/strand-exponent.case · spec/syntax/strand-strings.case · spec/syntax/sub.case · spec/syntax/system-name.case · spec/syntax/table-operand.case · spec/syntax/train-atop.case · spec/syntax/train-fork.case · spec/syntax/train-long.case · spec/syntax/unit-parameter-normal.case · spec/syntax/unit-parameter.case

demos/arrays.xtl

3m := 2 3 r_eshape r_ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}m ← 2 3 r‾eshape r‾ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
4m{\mathrm{m}}m{\mathrm{m}}
5s_hape m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}s‾hape m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}
62 s_elect m{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}2 s‾elect m{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
7-1 t_ake m{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{m}}−1 t‾ake m{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{m}}
8m * 10{\mathrm{m}}\ {\times}\ {10}m × 10{\mathrm{m}}\ {\times}\ {10}
9(f_irst m) c_at 7 8 9{(}{\mathrm{\underline{f}irst}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {7}\ {8}\ {9}(f‾irst m) c‾at 7 8 9{(}{\mathrm{\underline{f}irst}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {7}\ {8}\ {9}
1010 ^ o_ffsets 3{10}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {3}10 ^ o‾ffsets 3{10}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {3}

demos/birds-untyped.xtl

7u:M_ := { x_ -> x_ 'x_ } # Mockingbird: M x = x x{{}^{\mathrm{u}}\mathrm{\underline{M}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}uM‾ ← { x‾ → x‾ ’x‾ }{{}^{\mathrm{u}}\mathrm{\underline{M}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}
8u:L_ := { x_ y_ -> x_ y_ 'y_ } # Lark: L x y = x (y y){{}^{\mathrm{u}}\mathrm{\underline{L}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\text{'}}{\mathrm{\underline{y}}}\ {\}}uL‾ ← { x‾ y‾ → x‾ y‾ ’y‾ }{{}^{\mathrm{u}}\mathrm{\underline{L}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\text{'}}{\mathrm{\underline{y}}}\ {\}}
9u:M_2 := { x_ y -> y x_ (x_ y) } # Double Mockingbird: M2 x y = x y (x y){{}^{\mathrm{u}}\mathrm{\underline{M}2}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {(}{\mathrm{\underline{x}}}\ {\mathrm{y}}{)}\ {\}}uM‾2 ← { x‾ y → y x‾ (x‾ y) }{{}^{\mathrm{u}}\mathrm{\underline{M}2}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {(}{\mathrm{\underline{x}}}\ {\mathrm{y}}{)}\ {\}}
10u:U_ := { x_ y_ -> y_ ('x_ x_ 'y_) } # Turing bird: U x y = y (x x y){{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{\underline{y}}}\ {(}{\text{'}}{\mathrm{\underline{x}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{y}}}{)}\ {\}}uU‾ ← { x‾ y‾ → y‾ (’x‾ x‾ ’y‾) }{{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{\underline{y}}}\ {(}{\text{'}}{\mathrm{\underline{x}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{y}}}{)}\ {\}}
13u:I_ := { x -> x }{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}uI‾ ← { x → x }{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}
14('u:I_ u:M_)_ 42{(}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {{}^{\mathrm{u}}\mathrm{\underline{M}}}{)}{\_}\ {42}(’uI‾ uM‾)_ 42{(}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {{}^{\mathrm{u}}\mathrm{\underline{M}}}{)}{\_}\ {42}
18u:Y_ := { f_ -> { x_ -> f_ x_ 'x_ } '{ x_ -> f_ x_ 'x_ } }{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\}}uY‾ ← { f‾ → { x‾ → f‾ x‾ ’x‾ } ’{ x‾ → f‾ x‾ ’x‾ } }{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\}}
19u:F_ := { ~s_elf n -> n <= 1 ? 1; n * s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uF‾ ← { ∼s‾elf n → n ≤ 1 ? 1⋄ n × s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
20(u:Y_ 'u:F_)_ 5{(}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {5}(uY‾ ’uF‾)_ 5{(}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {5}
24u:Z_ := { f_ -> { x_ -> f_ '{ v -> 'x_ x_ v } } '{ x_ -> f_ '{ v -> 'x_ x_ v } } }{{}^{\mathrm{u}}\mathrm{\underline{Z}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\text{'}}{\{}\ {\mathrm{v}}\ {\to}\ {\text{'}}{\mathrm{\underline{x}}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}\ {\}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\text{'}}{\{}\ {\mathrm{v}}\ {\to}\ {\text{'}}{\mathrm{\underline{x}}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}\ {\}}\ {\}}\ {\}}uZ‾ ← { f‾ → { x‾ → f‾ ’{ v → ’x‾ x‾ v } } ’{ x‾ → f‾ ’{ v → ’x‾ x‾ v } } }{{}^{\mathrm{u}}\mathrm{\underline{Z}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\text{'}}{\{}\ {\mathrm{v}}\ {\to}\ {\text{'}}{\mathrm{\underline{x}}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}\ {\}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\text{'}}{\{}\ {\mathrm{v}}\ {\to}\ {\text{'}}{\mathrm{\underline{x}}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}\ {\}}\ {\}}\ {\}}
25u:G_ := { s_elf n -> n <= 1 ? 1; n * s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{G}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uG‾ ← { s‾elf n → n ≤ 1 ? 1⋄ n × s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{G}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
26(u:Z_ 'u:G_)_ 6{(}{{}^{\mathrm{u}}\mathrm{\underline{Z}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{G}}}{)}{\_}\ {6}(uZ‾ ’uG‾)_ 6{(}{{}^{\mathrm{u}}\mathrm{\underline{Z}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{G}}}{)}{\_}\ {6}
29('u:U_ u:U_ 'u:F_)_ 4{(}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {4}(’uU‾ uU‾ ’uF‾)_ 4{(}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {4}

demos/classics/automaton.xtl

9u:b_its := { rule -> (rule d_iv 2 ^ o_ffsets 8) m_od 2 }{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {\leftarrow}\ {\{}\ {\mathrm{rule}}\ {\to}\ {(}{\mathrm{rule}}\ {\mathrm{\underline{d}iv}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {8}{)}\ {\mathrm{\underline{m}od}}\ {2}\ {\}}ub‾its ← { rule → (rule d‾iv 2 ^ o‾ffsets 8) m‾od 2 }{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {\leftarrow}\ {\{}\ {\mathrm{rule}}\ {\to}\ {(}{\mathrm{rule}}\ {\mathrm{\underline{d}iv}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {8}{)}\ {\mathrm{\underline{m}od}}\ {2}\ {\}}
10u:b_its 30{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {30}ub‾its 30{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {30}
15u:s_tep := { bits row -> (1 + (4 * -1 o_- row) + (2 * row) + 1 o_- row) s_elect bits }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {\mathrm{bits}}\ {\mathrm{row}}\ {\to}\ {(}{1}\ {+}\ {(}{4}\ {\times}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{row}}{)}\ {+}\ {(}{2}\ {\times}\ {\mathrm{row}}{)}\ {+}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{row}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{bits}}\ {\}}us‾tep ← { bits row → (1 + (4 × −1 o‾− row) + (2 × row) + 1 o‾− row) s‾elect bits }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {\mathrm{bits}}\ {\mathrm{row}}\ {\to}\ {(}{1}\ {+}\ {(}{4}\ {\times}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{row}}{)}\ {+}\ {(}{2}\ {\times}\ {\mathrm{row}}{)}\ {+}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{row}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{bits}}\ {\}}
19u:e_volve := { bits rows ->{{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\leftarrow}\ {\{}\ {\mathrm{bits}}\ {\mathrm{rows}}\ {\to}ue‾volve ← { bits rows →{{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\leftarrow}\ {\{}\ {\mathrm{bits}}\ {\mathrm{rows}}\ {\to}
20 (t_ally rows) >= t_ally f_irst rows ? rows\ \ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{rows}}{)}\ {\geq}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{rows}}\ {?}\ {\mathrm{rows}}  (t‾ally rows) ≥ t‾ally f‾irst rows ? rows\ \ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{rows}}{)}\ {\geq}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{rows}}\ {?}\ {\mathrm{rows}}
21 next := bits u:s_tep r_avel -1 t_ake rows\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{bits}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{r}avel}}\ {-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{rows}}  next ← bits us‾tep r‾avel −1 t‾ake rows\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{bits}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{r}avel}}\ {-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{rows}}
22 bits u:e_volve rows c_at next\ \ {\mathrm{bits}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\mathrm{rows}}\ {\mathrm{\underline{c}at}}\ {\mathrm{next}}  bits ue‾volve rows c‾at next\ \ {\mathrm{bits}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\mathrm{rows}}\ {\mathrm{\underline{c}at}}\ {\mathrm{next}}
23}{\}}}{\}}
24u:s_tart := { w -> (1 c_at w) r_eshape ((w d_iv 2) r_eshape 0) c_at 1 c_at (w - 1 + w d_iv 2) r_eshape 0 }{{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{(}{\mathrm{w}}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{w}}\ {-}\ {1}\ {+}\ {\mathrm{w}}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}us‾tart ← { w → (1 c‾at w) r‾eshape ((w d‾iv 2) r‾eshape 0) c‾at 1 c‾at (w − 1 + w d‾iv 2) r‾eshape 0 }{{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{(}{\mathrm{w}}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{w}}\ {-}\ {1}\ {+}\ {\mathrm{w}}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}
25u:s_tart 9{{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {9}us‾tart 9{{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {9}
28r30 := (u:b_its 30) u:e_volve u:s_tart 31{\mathrm{r30}}\ {\leftarrow}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {30}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {31}r30 ← (ub‾its 30) ue‾volve us‾tart 31{\mathrm{r30}}\ {\leftarrow}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {30}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {31}
29(1 + 12 t_ake r30) s_elect " #"{(}{1}\ {+}\ {12}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r30}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" \#"}}(1 + 12 t‾ake r30) s‾elect " #"{(}{1}\ {+}\ {12}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r30}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" \#"}}
36thirty := []S_HOW []G_RID 32 t_ake (u:b_its 30) u:e_volve u:s_tart 63{\mathrm{thirty}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {32}\ {\mathrm{\underline{t}ake}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {30}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {63}thirty ← □S‾HOW □G‾RID 32 t‾ake (ub‾its 30) ue‾volve us‾tart 63{\mathrm{thirty}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {32}\ {\mathrm{\underline{t}ake}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {30}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {63}
37ninety := []S_HOW []G_RID 32 t_ake (u:b_its 90) u:e_volve u:s_tart 63{\mathrm{ninety}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {32}\ {\mathrm{\underline{t}ake}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {90}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {63}ninety ← □S‾HOW □G‾RID 32 t‾ake (ub‾its 90) ue‾volve us‾tart 63{\mathrm{ninety}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {32}\ {\mathrm{\underline{t}ake}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {90}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {63}
38right := 1 63 r_eshape (62 r_eshape 0) c_at 1{\mathrm{right}}\ {\leftarrow}\ {1}\ {63}\ {\mathrm{\underline{r}eshape}}\ {(}{62}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {1}right ← 1 63 r‾eshape (62 r‾eshape 0) c‾at 1{\mathrm{right}}\ {\leftarrow}\ {1}\ {63}\ {\mathrm{\underline{r}eshape}}\ {(}{62}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {1}
39eleven := []S_HOW []G_RID (u:b_its 110) u:e_volve right{\mathrm{eleven}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {110}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\mathrm{right}}eleven ← □S‾HOW □G‾RID (ub‾its 110) ue‾volve right{\mathrm{eleven}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {110}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\mathrm{right}}

demos/classics/bases.xtl

52 2 2 2 2 2 2 2 e_ncode 200{2}\ {2}\ {2}\ {2}\ {2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {200}2 2 2 2 2 2 2 2 e‾ncode 200{2}\ {2}\ {2}\ {2}\ {2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {200}
62 d_ecode 1 1 0 0 1 0 0 0{2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}2 d‾ecode 1 1 0 0 1 0 0 0{2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}
78 8 8 e_ncode 493 # octal 755, the file mode{8}\ {8}\ {8}\ {\mathrm{\underline{e}ncode}}\ {493}8 8 8 e‾ncode 493{8}\ {8}\ {8}\ {\mathrm{\underline{e}ncode}}\ {493}
816 16 e_ncode 255{16}\ {16}\ {\mathrm{\underline{e}ncode}}\ {255}16 16 e‾ncode 255{16}\ {16}\ {\mathrm{\underline{e}ncode}}\ {255}
13u:d_igits := { b n ->{{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\mathrm{n}}\ {\to}ud‾igits ← { b n →{{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\mathrm{n}}\ {\to}
14 d := (40 r_eshape b) e_ncode n\ \ {\mathrm{d}}\ {\leftarrow}\ {(}{40}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{n}}  d ← (40 r‾eshape b) e‾ncode n\ \ {\mathrm{d}}\ {\leftarrow}\ {(}{40}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{n}}
15 ('| s_\ 0 != d) r_eplicate d\ \ {(}{\text{'}}{\vee}\ {\mathrm{\underline{s}}{\backslash}}\ {0}\ {\neq}\ {\mathrm{d}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{d}}  (’∨ s‾\ 0 ≠ d) r‾eplicate d\ \ {(}{\text{'}}{\vee}\ {\mathrm{\underline{s}}{\backslash}}\ {0}\ {\neq}\ {\mathrm{d}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{d}}
16}{\}}}{\}}
172 u:d_igits 2026{2}\ {{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {2026}2 ud‾igits 2026{2}\ {{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {2026}
1816 u:d_igits 48879{16}\ {{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {48879}16 ud‾igits 48879{16}\ {{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {48879}
1910 u:d_igits 1234567{10}\ {{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {1234567}10 ud‾igits 1234567{10}\ {{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {1234567}
22hex := "0123456789ABCDEF"{\mathrm{hex}}\ {\leftarrow}\ {\text{"0123456789ABCDEF"}}hex ← "0123456789ABCDEF"{\mathrm{hex}}\ {\leftarrow}\ {\text{"0123456789ABCDEF"}}
23(1 + 16 u:d_igits 48879) s_elect hex{(}{1}\ {+}\ {16}\ {{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {48879}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{hex}}(1 + 16 ud‾igits 48879) s‾elect hex{(}{1}\ {+}\ {16}\ {{}^{\mathrm{u}}\mathrm{\underline{d}igits}}\ {48879}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{hex}}
2416 d_ecode -1 + hex i_ndexOf "BEEF"{16}\ {\mathrm{\underline{d}ecode}}\ {-1}\ {+}\ {\mathrm{hex}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{"BEEF"}}16 d‾ecode −1 + hex i‾ndexOf "BEEF"{16}\ {\mathrm{\underline{d}ecode}}\ {-1}\ {+}\ {\mathrm{hex}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{"BEEF"}}
2516 d_ecode -1 + hex i_ndexOf "7FFFFFFFFFFFFFFF" # the largest Int{16}\ {\mathrm{\underline{d}ecode}}\ {-1}\ {+}\ {\mathrm{hex}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{"7FFFFFFFFFFFFFFF"}}16 d‾ecode −1 + hex i‾ndexOf "7FFFFFFFFFFFFFFF"{16}\ {\mathrm{\underline{d}ecode}}\ {-1}\ {+}\ {\mathrm{hex}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{"7FFFFFFFFFFFFFFF"}}
282 2 2 2 e_ncode 3 5 9 12{2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {3}\ {5}\ {9}\ {12}2 2 2 2 e‾ncode 3 5 9 12{2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {3}\ {5}\ {9}\ {12}
320 24 60 60 e_ncode 1000000{0}\ {24}\ {60}\ {60}\ {\mathrm{\underline{e}ncode}}\ {1000000}0 24 60 60 e‾ncode 1000000{0}\ {24}\ {60}\ {60}\ {\mathrm{\underline{e}ncode}}\ {1000000}
330 24 60 60 d_ecode 11 13 46 40{0}\ {24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {11}\ {13}\ {46}\ {40}0 24 60 60 d‾ecode 11 13 46 40{0}\ {24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {11}\ {13}\ {46}\ {40}
350 3 12 e_ncode 100{0}\ {3}\ {12}\ {\mathrm{\underline{e}ncode}}\ {100}0 3 12 e‾ncode 100{0}\ {3}\ {12}\ {\mathrm{\underline{e}ncode}}\ {100}
39b := 2 2 2 e_ncode o_ffsets 8{\mathrm{b}}\ {\leftarrow}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{o}ffsets}}\ {8}b ← 2 2 2 e‾ncode o‾ffsets 8{\mathrm{b}}\ {\leftarrow}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{o}ffsets}}\ {8}
40g := 0 + b != (1 8 r_eshape 0) c_at -1 d_rop b{\mathrm{g}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{b}}\ {\neq}\ {(}{1}\ {8}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{b}}g ← 0 + b ≠ (1 8 r‾eshape 0) c‾at −1 d‾rop b{\mathrm{g}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{b}}\ {\neq}\ {(}{1}\ {8}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{b}}
41g{\mathrm{g}}g{\mathrm{g}}
422 d_ecode g{2}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{g}}2 d‾ecode g{2}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{g}}

demos/classics/closure.xtl

9a := 4 4 r_eshape 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0{\mathrm{a}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ \ {0}\ {0}\ {1}\ {0}\ \ {0}\ {0}\ {0}\ {1}\ \ {0}\ {0}\ {0}\ {0}a ← 4 4 r‾eshape 0 1 0 0  0 0 1 0  0 0 0 1  0 0 0 0{\mathrm{a}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ \ {0}\ {0}\ {1}\ {0}\ \ {0}\ {0}\ {0}\ {1}\ \ {0}\ {0}\ {0}\ {0}
10a '| '& i_nner a # two steps{\mathrm{a}}\ {\text{'}}{\vee}\ {\text{'}}{\wedge}\ {\mathrm{\underline{i}nner}}\ {\mathrm{a}}a ’∨ ’∧ i‾nner a{\mathrm{a}}\ {\text{'}}{\vee}\ {\text{'}}{\wedge}\ {\mathrm{\underline{i}nner}}\ {\mathrm{a}}
12u:c_losure := { r ->{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}uc‾losure ← { r →{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}
13 next := r | r '| '& i_nner r\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{r}}\ {\vee}\ {\mathrm{r}}\ {\text{'}}{\vee}\ {\text{'}}{\wedge}\ {\mathrm{\underline{i}nner}}\ {\mathrm{r}}  next ← r ∨ r ’∨ ’∧ i‾nner r\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{r}}\ {\vee}\ {\mathrm{r}}\ {\text{'}}{\vee}\ {\text{'}}{\wedge}\ {\mathrm{\underline{i}nner}}\ {\mathrm{r}}
14 (next m_atch r) ? r\ \ {(}{\mathrm{next}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{r}}{)}\ {?}\ {\mathrm{r}}  (next m‾atch r) ? r\ \ {(}{\mathrm{next}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{r}}{)}\ {?}\ {\mathrm{r}}
15 u:c_losure next\ \ {{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{next}}  uc‾losure next\ \ {{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{next}}
16}{\}}}{\}}
17u:c_losure a{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{a}}uc‾losure a{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{a}}
22u:w_arshall := { r k ->{{}^{\mathrm{u}}\mathrm{\underline{w}arshall}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\mathrm{k}}\ {\to}uw‾arshall ← { r k →{{}^{\mathrm{u}}\mathrm{\underline{w}arshall}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\mathrm{k}}\ {\to}
23 k > t_ally r ? r\ \ {\mathrm{k}}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{r}}\ {?}\ {\mathrm{r}}  k > t‾ally r ? r\ \ {\mathrm{k}}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{r}}\ {?}\ {\mathrm{r}}
24 through := (k s_elect_2 r) '& t_able k s_elect r\ \ {\mathrm{through}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{r}}{)}\ {\text{'}}{\wedge}\ {\mathrm{\underline{t}able}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}  through ← (k s‾elect2 r) ’∧ t‾able k s‾elect r\ \ {\mathrm{through}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{r}}{)}\ {\text{'}}{\wedge}\ {\mathrm{\underline{t}able}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}
25 (r | through) u:w_arshall k + 1\ \ {(}{\mathrm{r}}\ {\vee}\ {\mathrm{through}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshall}}\ {\mathrm{k}}\ {+}\ {1}  (r ∨ through) uw‾arshall k + 1\ \ {(}{\mathrm{r}}\ {\vee}\ {\mathrm{through}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshall}}\ {\mathrm{k}}\ {+}\ {1}
26}{\}}}{\}}
27(a u:w_arshall 1) m_atch u:c_losure a{(}{\mathrm{a}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshall}}\ {1}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{a}}(a uw‾arshall 1) m‾atch uc‾losure a{(}{\mathrm{a}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshall}}\ {1}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{a}}
30g := 8 8 r_eshape 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0{\mathrm{g}}\ {\leftarrow}\ {8}\ {8}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ \ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ \ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}g ← 8 8 r‾eshape 0 1 0 0 0 0 0 0  0 0 1 0 0 0 0 0  1 0 0 1 0 0 0 0  0 0 0 0 1 0 0 0  0 0 0 0 0 1 0 0  0 0 0 0 0 0 1 0  0 0 0 0 0 0 0 1  0 0 0 0 1 0 0 0{\mathrm{g}}\ {\leftarrow}\ {8}\ {8}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ \ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ \ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}
31c := g u:w_arshall 1{\mathrm{c}}\ {\leftarrow}\ {\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshall}}\ {1}c ← g uw‾arshall 1{\mathrm{c}}\ {\leftarrow}\ {\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshall}}\ {1}
32c{\mathrm{c}}c{\mathrm{c}}
33'+ r_/_2 c # how many each vertex reaches{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{c}}’+ r‾/2 c{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{c}}
36u:p_lane := { m -> (1 c_at s_hape m) r_eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}up‾lane ← { m → (1 c‾at s‾hape m) r‾eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}
37u:s_teps := { r k ->{{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\mathrm{k}}\ {\to}us‾teps ← { r k →{{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\mathrm{k}}\ {\to}
38 k > t_ally r ? u:p_lane r\ \ {\mathrm{k}}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{r}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{r}}  k > t‾ally r ? up‾lane r\ \ {\mathrm{k}}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{r}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{r}}
39 through := (k s_elect_2 r) '& t_able k s_elect r\ \ {\mathrm{through}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{r}}{)}\ {\text{'}}{\wedge}\ {\mathrm{\underline{t}able}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}  through ← (k s‾elect2 r) ’∧ t‾able k s‾elect r\ \ {\mathrm{through}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{r}}{)}\ {\text{'}}{\wedge}\ {\mathrm{\underline{t}able}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}
40 (u:p_lane r) c_at (r | through) u:s_teps k + 1\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{r}}\ {\vee}\ {\mathrm{through}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\mathrm{k}}\ {+}\ {1}  (up‾lane r) c‾at (r ∨ through) us‾teps k + 1\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{r}}\ {\vee}\ {\mathrm{through}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\mathrm{k}}\ {+}\ {1}
41}{\}}}{\}}
42watched := []S_HOW []G_RID g u:s_teps 1{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {1}watched ← □S‾HOW □G‾RID g us‾teps 1{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {1}

demos/classics/collatz.xtl

6u:h_ail := { n -> 0 = n m_od 2 ? n d_iv 2; 1 + 3 * n }{{}^{\mathrm{u}}\mathrm{\underline{h}ail}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {0}\ {=}\ {\mathrm{n}}\ {\mathrm{\underline{m}od}}\ {2}\ {?}\ {\mathrm{n}}\ {\mathrm{\underline{d}iv}}\ {2}{\diamond}\ {1}\ {+}\ {3}\ {\times}\ {\mathrm{n}}\ {\}}uh‾ail ← { n → 0 = n m‾od 2 ? n d‾iv 2⋄ 1 + 3 × n }{{}^{\mathrm{u}}\mathrm{\underline{h}ail}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {0}\ {=}\ {\mathrm{n}}\ {\mathrm{\underline{m}od}}\ {2}\ {?}\ {\mathrm{n}}\ {\mathrm{\underline{d}iv}}\ {2}{\diamond}\ {1}\ {+}\ {3}\ {\times}\ {\mathrm{n}}\ {\}}
7u:c_ollatz := { n -> n = 1 ? 1 r_eshape 1; n c_at u:c_ollatz u:h_ail n }{{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {1}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}{\diamond}\ {\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}ail}}\ {\mathrm{n}}\ {\}}uc‾ollatz ← { n → n = 1 ? 1 r‾eshape 1⋄ n c‾at uc‾ollatz uh‾ail n }{{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {1}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}{\diamond}\ {\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}ail}}\ {\mathrm{n}}\ {\}}
8u:c_ollatz 6{{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {6}uc‾ollatz 6{{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {6}
9t_ally u:c_ollatz 27 # 27 takes 111 steps, 112 numbers{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {27}t‾ally uc‾ollatz 27{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {27}
10'm_ax r_/ u:c_ollatz 27 # climbing as high as 9232{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {27}’m‾ax r‾/ uc‾ollatz 27{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {27}
13s := '{ (t_ally u:c_ollatz _r) - 1 } e_ach r_ange 30{\mathrm{s}}\ {\leftarrow}\ {\text{'}}{\{}\ {(}{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {\_\mathrm{r}}{)}\ {-}\ {1}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {30}s ← ’{ (t‾ally uc‾ollatz _r) − 1 } e‾ach r‾ange 30{\mathrm{s}}\ {\leftarrow}\ {\text{'}}{\{}\ {(}{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {\_\mathrm{r}}{)}\ {-}\ {1}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {30}
14s{\mathrm{s}}s{\mathrm{s}}
15(s i_ndexOf 'm_ax r_/ s) c_at 'm_ax r_/ s{(}{\mathrm{s}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}(s i‾ndexOf ’m‾ax r‾/ s) c‾at ’m‾ax r‾/ s{(}{\mathrm{s}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}

demos/classics/duck.xtl

6family := 3 20 r_eshape " _ _ _ __(.)< (.)< (.)< \\___) "{\mathrm{family}}\ {\leftarrow}\ {3}\ {20}\ {\mathrm{\underline{r}eshape}}\ {\text{" \_ \_ \_ \_\_(.)< (.)< (.)< \textbackslash{}\textbackslash{}\_\_\_) "}}family ← 3 20 r‾eshape " _ _ _ __(.)< (.)< (.)< \\___) "{\mathrm{family}}\ {\leftarrow}\ {3}\ {20}\ {\mathrm{\underline{r}eshape}}\ {\text{" \_ \_ \_ \_\_(.)< (.)< (.)< \textbackslash{}\textbackslash{}\_\_\_) "}}
7family{\mathrm{family}}family{\mathrm{family}}
8pond := 32 t_ake_2 family # a wider pond, padded with blanks{\mathrm{pond}}\ {\leftarrow}\ {32}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{family}}pond ← 32 t‾ake2 family{\mathrm{pond}}\ {\leftarrow}\ {32}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{family}}
9-6 o_-_2 pond # six steps to the right{-6}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}−6 o‾−2 pond{-6}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}
13frames := (n_eg o_ffsets 32) o_-_2 pond{\mathrm{frames}}\ {\leftarrow}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{o}ffsets}}\ {32}{)}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}frames ← (n‾eg o‾ffsets 32) o‾−2 pond{\mathrm{frames}}\ {\leftarrow}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{o}ffsets}}\ {32}{)}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}
14s_hape frames{\mathrm{\underline{s}hape}}\ {\mathrm{frames}}s‾hape frames{\mathrm{\underline{s}hape}}\ {\mathrm{frames}}
151 13 25 s_elect frames{1}\ {13}\ {25}\ {\mathrm{\underline{s}elect}}\ {\mathrm{frames}}1 13 25 s‾elect frames{1}\ {13}\ {25}\ {\mathrm{\underline{s}elect}}\ {\mathrm{frames}}
16shown := []S_HOW []G_RID frames{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{frames}}shown ← □S‾HOW □G‾RID frames{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{frames}}
21water := 32 r_eshape "~ ~~ ~ "{\mathrm{water}}\ {\leftarrow}\ {32}\ {\mathrm{\underline{r}eshape}}\ {\text{"\textasciitilde{} \textasciitilde{}\textasciitilde{} \textasciitilde{} "}}water ← 32 r‾eshape "~ ~~ ~ "{\mathrm{water}}\ {\leftarrow}\ {32}\ {\mathrm{\underline{r}eshape}}\ {\text{"\textasciitilde{} \textasciitilde{}\textasciitilde{} \textasciitilde{} "}}
22waves := (o_ffsets 32) o_- water{\mathrm{waves}}\ {\leftarrow}\ {(}{\mathrm{\underline{o}ffsets}}\ {32}{)}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{water}}waves ← (o‾ffsets 32) o‾− water{\mathrm{waves}}\ {\leftarrow}\ {(}{\mathrm{\underline{o}ffsets}}\ {32}{)}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{water}}
23swim := frames c_at_2 waves{\mathrm{swim}}\ {\leftarrow}\ {\mathrm{frames}}\ {{\mathrm{\underline{c}at}}_{2}}\ {\mathrm{waves}}swim ← frames c‾at2 waves{\mathrm{swim}}\ {\leftarrow}\ {\mathrm{frames}}\ {{\mathrm{\underline{c}at}}_{2}}\ {\mathrm{waves}}
24s_hape swim{\mathrm{\underline{s}hape}}\ {\mathrm{swim}}s‾hape swim{\mathrm{\underline{s}hape}}\ {\mathrm{swim}}
257 s_elect swim{7}\ {\mathrm{\underline{s}elect}}\ {\mathrm{swim}}7 s‾elect swim{7}\ {\mathrm{\underline{s}elect}}\ {\mathrm{swim}}
26shown := []S_HOW []G_RID swim{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{swim}}shown ← □S‾HOW □G‾RID swim{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{swim}}

demos/classics/factorial.xtl

4u:f_act := ['* r_/ r_ange]{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {[}{\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{r}ange}}{]}uf‾act ← [’× r‾/ r‾ange]{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {[}{\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{r}ange}}{]}
5'u:f_act e_ach o_ffsets 11{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {11}’uf‾act e‾ach o‾ffsets 11{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {11}
8u:c_hoose := { k n -> (u:f_act n) d_iv (u:f_act k) * u:f_act n - k }{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{n}}\ {\to}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{d}iv}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{k}}{)}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {\mathrm{k}}\ {\}}uc‾hoose ← { k n → (uf‾act n) d‾iv (uf‾act k) × uf‾act n − k }{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{n}}\ {\to}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{d}iv}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{k}}{)}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {\mathrm{k}}\ {\}}
9(o_ffsets 7) 'u:c_hoose e_ach 6{(}{\mathrm{\underline{o}ffsets}}\ {7}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{e}ach}}\ {6}(o‾ffsets 7) ’uc‾hoose e‾ach 6{(}{\mathrm{\underline{o}ffsets}}\ {7}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{e}ach}}\ {6}
10'+ r_/ (o_ffsets 7) 'u:c_hoose e_ach 6 # 2^6 subsets{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{o}ffsets}}\ {7}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{e}ach}}\ {6}’+ r‾/ (o‾ffsets 7) ’uc‾hoose e‾ach 6{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{o}ffsets}}\ {7}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{e}ach}}\ {6}
13u:p_erm := { k n -> '* r_/ k t_ake r_ev r_ange n }{{}^{\mathrm{u}}\mathrm{\underline{p}erm}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{n}}\ {\to}\ {\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{k}}\ {\mathrm{\underline{t}ake}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\}}up‾erm ← { k n → ’× r‾/ k t‾ake r‾ev r‾ange n }{{}^{\mathrm{u}}\mathrm{\underline{p}erm}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{n}}\ {\to}\ {\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{k}}\ {\mathrm{\underline{t}ake}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\}}
143 u:p_erm 10{3}\ {{}^{\mathrm{u}}\mathrm{\underline{p}erm}}\ {10}3 up‾erm 10{3}\ {{}^{\mathrm{u}}\mathrm{\underline{p}erm}}\ {10}
17'+ r_/ 1 / f_loat 'u:f_act e_ach o_ffsets 15{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {\div}\ {\mathrm{\underline{f}loat}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {15}’+ r‾/ 1 ÷ f‾loat ’uf‾act e‾ach o‾ffsets 15{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {\div}\ {\mathrm{\underline{f}loat}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {15}
18e_xp 1{\mathrm{\underline{e}xp}}\ {1}e‾xp 1{\mathrm{\underline{e}xp}}\ {1}

demos/classics/fibonacci.xtl

9u:f_ib := { n -> n < 2 ? n; (u:f_ib n - 1) + u:f_ib n - 2 }{{}^{\mathrm{u}}\mathrm{\underline{f}ib}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {<}\ {2}\ {?}\ {\mathrm{n}}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}ib}}\ {\mathrm{n}}\ {-}\ {1}{)}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ib}}\ {\mathrm{n}}\ {-}\ {2}\ {\}}uf‾ib ← { n → n < 2 ? n⋄ (uf‾ib n − 1) + uf‾ib n − 2 }{{}^{\mathrm{u}}\mathrm{\underline{f}ib}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {<}\ {2}\ {?}\ {\mathrm{n}}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}ib}}\ {\mathrm{n}}\ {-}\ {1}{)}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ib}}\ {\mathrm{n}}\ {-}\ {2}\ {\}}
10'u:f_ib e_ach o_ffsets 15{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}ib}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {15}’uf‾ib e‾ach o‾ffsets 15{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}ib}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {15}
13u:f_ibs := { n ->{{}^{\mathrm{u}}\mathrm{\underline{f}ibs}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}uf‾ibs ← { n →{{}^{\mathrm{u}}\mathrm{\underline{f}ibs}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
14 n <= 2 ? n t_ake 0 1\ \ {\mathrm{n}}\ {\leq}\ {2}\ {?}\ {\mathrm{n}}\ {\mathrm{\underline{t}ake}}\ {0}\ {1}  n ≤ 2 ? n t‾ake 0 1\ \ {\mathrm{n}}\ {\leq}\ {2}\ {?}\ {\mathrm{n}}\ {\mathrm{\underline{t}ake}}\ {0}\ {1}
15 f := u:f_ibs n - 1\ \ {\mathrm{f}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ibs}}\ {\mathrm{n}}\ {-}\ {1}  f ← uf‾ibs n − 1\ \ {\mathrm{f}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ibs}}\ {\mathrm{n}}\ {-}\ {1}
16 f c_at '+ r_/ -2 t_ake f\ \ {\mathrm{f}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {-2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{f}}  f c‾at ’+ r‾/ −2 t‾ake f\ \ {\mathrm{f}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {-2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{f}}
17}{\}}}{\}}
18u:f_ibs 20{{}^{\mathrm{u}}\mathrm{\underline{f}ibs}}\ {20}uf‾ibs 20{{}^{\mathrm{u}}\mathrm{\underline{f}ibs}}\ {20}
22q := 2 2 r_eshape 1 1 1 0{\mathrm{q}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {1}\ {0}q ← 2 2 r‾eshape 1 1 1 0{\mathrm{q}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {1}\ {0}
23u:p_ow := { n -> n = 1 ? q; q '+ '* i_nner u:p_ow n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {1}\ {?}\ {\mathrm{q}}{\diamond}\ {\mathrm{q}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}up‾ow ← { n → n = 1 ? q⋄ q ’+ ’× i‾nner up‾ow n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {1}\ {?}\ {\mathrm{q}}{\diamond}\ {\mathrm{q}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
24u:p_ow 10{{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {10}up‾ow 10{{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {10}
252 s_elect r_avel u:p_ow 30 # F(30){2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{\underline{r}avel}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {30}2 s‾elect r‾avel up‾ow 30{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{\underline{r}avel}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {30}
31"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
32u:F_ib := { ~s_elf n -> n < 2 ? n; (s_elf n - 1) + s_elf n - 2 }{{}^{\mathrm{u}}\mathrm{\underline{F}ib}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {<}\ {2}\ {?}\ {\mathrm{n}}{\diamond}\ {(}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}{)}\ {+}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {2}\ {\}}uF‾ib ← { ∼s‾elf n → n < 2 ? n⋄ (s‾elf n − 1) + s‾elf n − 2 }{{}^{\mathrm{u}}\mathrm{\underline{F}ib}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {<}\ {2}\ {?}\ {\mathrm{n}}{\diamond}\ {(}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}{)}\ {+}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {2}\ {\}}
33'{ 'u:F_ib c:Y_ _r } e_ach o_ffsets 15{\text{'}}{\{}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}ib}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {15}’{ ’uF‾ib cY‾ _r } e‾ach o‾ffsets 15{\text{'}}{\{}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}ib}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {15}
40"u:f_ib5" c:Y_< "{ ~s_elf n -> n < 2 ? n; (s_elf n - 1) + s_elf n - 2 }"{\text{"u:f\_ib5"}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}{<}}\ {\text{"\{ \textasciitilde{}s\_elf n -> n < 2 ? n; (s\_elf n - 1) + s\_elf n - 2 \}"}}"u:f_ib5" cY‾< "{ ~s_elf n -> n < 2 ? n; (s_elf n - 1) + s_elf n - 2 }"{\text{"u:f\_ib5"}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}{<}}\ {\text{"\{ \textasciitilde{}s\_elf n -> n < 2 ? n; (s\_elf n - 1) + s\_elf n - 2 \}"}}
41'u:f_ib5 e_ach o_ffsets 15{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}ib5}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {15}’uf‾ib5 e‾ach o‾ffsets 15{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}ib5}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {15}

demos/classics/gcd.xtl

5u:g_cd := { a b -> b = 0 ? a; b u:g_cd a m_od b }{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{b}}\ {=}\ {0}\ {?}\ {\mathrm{a}}{\diamond}\ {\mathrm{b}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{a}}\ {\mathrm{\underline{m}od}}\ {\mathrm{b}}\ {\}}ug‾cd ← { a b → b = 0 ? a⋄ b ug‾cd a m‾od b }{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{b}}\ {=}\ {0}\ {?}\ {\mathrm{a}}{\diamond}\ {\mathrm{b}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{a}}\ {\mathrm{\underline{m}od}}\ {\mathrm{b}}\ {\}}
648 u:g_cd 18{48}\ {{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {18}48 ug‾cd 18{48}\ {{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {18}
10'u:g_cd r_/ 84 126 210{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{\underline{r}}{/}}\ {84}\ {126}\ {210}’ug‾cd r‾/ 84 126 210{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{\underline{r}}{/}}\ {84}\ {126}\ {210}
1112 'u:g_cd e_ach 8 9 10 11 12{12}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{\underline{e}ach}}\ {8}\ {9}\ {10}\ {11}\ {12}12 ’ug‾cd e‾ach 8 9 10 11 12{12}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{\underline{e}ach}}\ {8}\ {9}\ {10}\ {11}\ {12}
15u:l_cm := { a b -> (a * b) d_iv a u:g_cd b }{{}^{\mathrm{u}}\mathrm{\underline{l}cm}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{\mathrm{a}}\ {\times}\ {\mathrm{b}}{)}\ {\mathrm{\underline{d}iv}}\ {\mathrm{a}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{b}}\ {\}}ul‾cm ← { a b → (a × b) d‾iv a ug‾cd b }{{}^{\mathrm{u}}\mathrm{\underline{l}cm}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{\mathrm{a}}\ {\times}\ {\mathrm{b}}{)}\ {\mathrm{\underline{d}iv}}\ {\mathrm{a}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{b}}\ {\}}
16'u:l_cm r_/ r_ange 10{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{l}cm}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{r}ange}}\ {10}’ul‾cm r‾/ r‾ange 10{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{l}cm}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{r}ange}}\ {10}
19n := r_ange 12{\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {12}n ← r‾ange 12{\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {12}
20(w_here 1 = 12 'u:g_cd e_ach n) s_elect n{(}{\mathrm{\underline{w}here}}\ {1}\ {=}\ {12}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}(w‾here 1 = 12 ’ug‾cd e‾ach n) s‾elect n{(}{\mathrm{\underline{w}here}}\ {1}\ {=}\ {12}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}

demos/classics/hanoi.xtl

11u:h_anoi := { n pegs ->{{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{pegs}}\ {\to}uh‾anoi ← { n pegs →{{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{pegs}}\ {\to}
12 n = 0 ? 0 2 r_eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}  n = 0 ? 0 2 r‾eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}
13 first := (n - 1) u:h_anoi 1 3 2 s_elect pegs\ \ {\mathrm{first}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}  first ← (n − 1) uh‾anoi 1 3 2 s‾elect pegs\ \ {\mathrm{first}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}
14 last := (n - 1) u:h_anoi 3 2 1 s_elect pegs\ \ {\mathrm{last}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {3}\ {2}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}  last ← (n − 1) uh‾anoi 3 2 1 s‾elect pegs\ \ {\mathrm{last}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {3}\ {2}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}
15 first c_at (1 2 r_eshape 2 t_ake pegs) c_at last\ \ {\mathrm{first}}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{pegs}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{last}}  first c‾at (1 2 r‾eshape 2 t‾ake pegs) c‾at last\ \ {\mathrm{first}}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{pegs}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{last}}
16}{\}}}{\}}
173 u:h_anoi 1 3 2{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}3 uh‾anoi 1 3 2{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}
18'{ t_ally _r u:h_anoi 1 3 2 } e_ach r_ange 10 # 2^n - 1 moves{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {10}’{ t‾ally _r uh‾anoi 1 3 2 } e‾ach r‾ange 10{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {10}
27u:m_oves := { n ->{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}um‾oves ← { n →{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
28 k := r_ange (2 ^ n) - 1\ \ {\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {(}{2}\ {\mathbin{\hat{}}}\ {\mathrm{n}}{)}\ {-}\ {1}  k ← r‾ange (2 ^ n) − 1\ \ {\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {(}{2}\ {\mathbin{\hat{}}}\ {\mathrm{n}}{)}\ {-}\ {1}
29 d := 1 + '+ r_/_2 0 = k 'm_od t_able 2 ^ r_ange n\ \ {\mathrm{d}}\ {\leftarrow}\ {1}\ {+}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  d ← 1 + ’+ r‾/2 0 = k ’m‾od t‾able 2 ^ r‾ange n\ \ {\mathrm{d}}\ {\leftarrow}\ {1}\ {+}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
30 m := k d_iv 2 ^ d\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{k}}\ {\mathrm{\underline{d}iv}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{d}}  m ← k d‾iv 2 ^ d\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{k}}\ {\mathrm{\underline{d}iv}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{d}}
31 s := 1 + 0 = (n - d) m_od 2\ \ {\mathrm{s}}\ {\leftarrow}\ {1}\ {+}\ {0}\ {=}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{d}}{)}\ {\mathrm{\underline{m}od}}\ {2}  s ← 1 + 0 = (n − d) m‾od 2\ \ {\mathrm{s}}\ {\leftarrow}\ {1}\ {+}\ {0}\ {=}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{d}}{)}\ {\mathrm{\underline{m}od}}\ {2}
32 from := 1 + (s * m) m_od 3\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{s}}\ {\times}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}od}}\ {3}  from ← 1 + (s × m) m‾od 3\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{s}}\ {\times}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}od}}\ {3}
33 to := 1 + (s * m + 1) m_od 3\ \ {\mathrm{to}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{s}}\ {\times}\ {\mathrm{m}}\ {+}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {3}  to ← 1 + (s × m + 1) m‾od 3\ \ {\mathrm{to}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{s}}\ {\times}\ {\mathrm{m}}\ {+}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {3}
34 o_\ (2 c_at t_ally from) r_eshape from c_at to\ \ {\mathrm{\underline{o}}{\backslash}}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{from}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{from}}\ {\mathrm{\underline{c}at}}\ {\mathrm{to}}  o‾\ (2 c‾at t‾ally from) r‾eshape from c‾at to\ \ {\mathrm{\underline{o}}{\backslash}}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{from}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{from}}\ {\mathrm{\underline{c}at}}\ {\mathrm{to}}
35}{\}}}{\}}
36u:m_oves 3{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {3}um‾oves 3{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {3}
37'{ (u:m_oves _r) m_atch _r u:h_anoi 1 3 2 } e_ach r_ange 10 # the same moves{\text{'}}{\{}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {\_\mathrm{r}}{)}\ {\mathrm{\underline{m}atch}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {10}’{ (um‾oves _r) m‾atch _r uh‾anoi 1 3 2 } e‾ach r‾ange 10{\text{'}}{\{}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {\_\mathrm{r}}{)}\ {\mathrm{\underline{m}atch}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {10}
46u:m_ove := { p m ->{{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{m}}\ {\to}um‾ove ← { p m →{{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{m}}\ {\to}
47 from := 1 s_elect m\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}  from ← 1 s‾elect m\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
48 disk := p i_ndexOf from\ \ {\mathrm{disk}}\ {\leftarrow}\ {\mathrm{p}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{from}}  disk ← p i‾ndexOf from\ \ {\mathrm{disk}}\ {\leftarrow}\ {\mathrm{p}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{from}}
49 p + ((2 s_elect m) - from) * disk = r_ange t_ally p\ \ {\mathrm{p}}\ {+}\ {(}{(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {-}\ {\mathrm{from}}{)}\ {\times}\ {\mathrm{disk}}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}  p + ((2 s‾elect m) − from) × disk = r‾ange t‾ally p\ \ {\mathrm{p}}\ {+}\ {(}{(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {-}\ {\mathrm{from}}{)}\ {\times}\ {\mathrm{disk}}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}
50}{\}}}{\}}
51(3 r_eshape 1) u:m_ove 1 3{(}{3}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {1}\ {3}(3 r‾eshape 1) um‾ove 1 3{(}{3}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {1}\ {3}
56u:s_lots := { p ->{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}us‾lots ← { p →{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}
57 n := t_ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}  n ← t‾ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}
58 (r_ange n) '{ r j -> r s_elect (0 - n) t_ake 0 c_at w_here p = j } t_able 1 2 3\ \ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\mathrm{r}}\ {\mathrm{j}}\ {\to}\ {\mathrm{r}}\ {\mathrm{\underline{s}elect}}\ {(}{0}\ {-}\ {\mathrm{n}}{)}\ {\mathrm{\underline{t}ake}}\ {0}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{w}here}}\ {\mathrm{p}}\ {=}\ {\mathrm{j}}\ {\}}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}  (r‾ange n) ’{ r j → r s‾elect (0 − n) t‾ake 0 c‾at w‾here p = j } t‾able 1 2 3\ \ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\mathrm{r}}\ {\mathrm{j}}\ {\to}\ {\mathrm{r}}\ {\mathrm{\underline{s}elect}}\ {(}{0}\ {-}\ {\mathrm{n}}{)}\ {\mathrm{\underline{t}ake}}\ {0}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{w}here}}\ {\mathrm{p}}\ {=}\ {\mathrm{j}}\ {\}}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}
59}{\}}}{\}}
60u:s_lots 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {1}\ {2}\ {3}us‾lots 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {1}\ {2}\ {3}
64u:p_icture := { p ->{{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}up‾icture ← { p →{{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}
65 n := t_ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}  n ← t‾ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}
66 w := 1 + 2 * n\ \ {\mathrm{w}}\ {\leftarrow}\ {1}\ {+}\ {2}\ {\times}\ {\mathrm{n}}  w ← 1 + 2 × n\ \ {\mathrm{w}}\ {\leftarrow}\ {1}\ {+}\ {2}\ {\times}\ {\mathrm{n}}
67 bars := (u:s_lots p) '{ s x -> s > a_bs x } t_able (o_ffsets w) - n\ \ {\mathrm{bars}}\ {\leftarrow}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\mathrm{p}}{)}\ {\text{'}}{\{}\ {\mathrm{s}}\ {\mathrm{x}}\ {\to}\ {\mathrm{s}}\ {>}\ {\mathrm{\underline{a}bs}}\ {\mathrm{x}}\ {\}}\ {\mathrm{\underline{t}able}}\ {(}{\mathrm{\underline{o}ffsets}}\ {\mathrm{w}}{)}\ {-}\ {\mathrm{n}}  bars ← (us‾lots p) ’{ s x → s > a‾bs x } t‾able (o‾ffsets w) − n\ \ {\mathrm{bars}}\ {\leftarrow}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\mathrm{p}}{)}\ {\text{'}}{\{}\ {\mathrm{s}}\ {\mathrm{x}}\ {\to}\ {\mathrm{s}}\ {>}\ {\mathrm{\underline{a}bs}}\ {\mathrm{x}}\ {\}}\ {\mathrm{\underline{t}able}}\ {(}{\mathrm{\underline{o}ffsets}}\ {\mathrm{w}}{)}\ {-}\ {\mathrm{n}}
68 (n c_at 3 * w) r_eshape r_avel bars\ \ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {3}\ {\times}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{bars}}  (n c‾at 3 × w) r‾eshape r‾avel bars\ \ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {3}\ {\times}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{bars}}
69}{\}}}{\}}
72u:p_lane := { m -> (1 c_at s_hape m) r_eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}up‾lane ← { m → (1 c‾at s‾hape m) r‾eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}
73u:p_lay := { p moves ->{{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{moves}}\ {\to}up‾lay ← { p moves →{{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{moves}}\ {\to}
74 frame := u:p_lane u:p_icture p\ \ {\mathrm{frame}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{p}}  frame ← up‾lane up‾icture p\ \ {\mathrm{frame}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{p}}
75 0 = t_ally moves ? frame\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{moves}}\ {?}\ {\mathrm{frame}}  0 = t‾ally moves ? frame\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{moves}}\ {?}\ {\mathrm{frame}}
76 frame c_at (p u:m_ove f_irst moves) u:p_lay 1 d_rop moves\ \ {\mathrm{frame}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{p}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{moves}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{moves}}  frame c‾at (p um‾ove f‾irst moves) up‾lay 1 d‾rop moves\ \ {\mathrm{frame}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{p}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{moves}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{moves}}
77}{\}}}{\}}
78moves := 4 u:h_anoi 1 3 2{\mathrm{moves}}\ {\leftarrow}\ {4}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}moves ← 4 uh‾anoi 1 3 2{\mathrm{moves}}\ {\leftarrow}\ {4}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}
79s_hape (4 r_eshape 1) u:p_lay moves{\mathrm{\underline{s}hape}}\ {(}{4}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\mathrm{moves}}s‾hape (4 r‾eshape 1) up‾lay moves{\mathrm{\underline{s}hape}}\ {(}{4}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\mathrm{moves}}
80watched := []S_HOW []G_RID (4 r_eshape 1) u:p_lay moves{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{4}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\mathrm{moves}}watched ← □S‾HOW □G‾RID (4 r‾eshape 1) up‾lay moves{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{4}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\mathrm{moves}}

demos/classics/histogram.xtl

6v := 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}\ {8}\ {9}\ {7}\ {9}v ← 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}\ {8}\ {9}\ {7}\ {9}
7u := s_ort u_nique v{\mathrm{u}}\ {\leftarrow}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{v}}u ← s‾ort u‾nique v{\mathrm{u}}\ {\leftarrow}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{v}}
8u{\mathrm{u}}u{\mathrm{u}}
9counts := '+ r_/_2 u '= t_able v{\mathrm{counts}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{u}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{v}}counts ← ’+ r‾/2 u ’= t‾able v{\mathrm{counts}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{u}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{v}}
10counts{\mathrm{counts}}counts{\mathrm{counts}}
13(g_rade 0 - counts) s_elect u{(}{\mathrm{\underline{g}rade}}\ {0}\ {-}\ {\mathrm{counts}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{u}}(g‾rade 0 − counts) s‾elect u{(}{\mathrm{\underline{g}rade}}\ {0}\ {-}\ {\mathrm{counts}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{u}}
17bars := (1 + counts '>= t_able r_ange 'm_ax r_/ counts) s_elect " *"{\mathrm{bars}}\ {\leftarrow}\ {(}{1}\ {+}\ {\mathrm{counts}}\ {\text{'}}{\geq}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{counts}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" *"}}bars ← (1 + counts ’≥ t‾able r‾ange ’m‾ax r‾/ counts) s‾elect " *"{\mathrm{bars}}\ {\leftarrow}\ {(}{1}\ {+}\ {\mathrm{counts}}\ {\text{'}}{\geq}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{counts}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" *"}}
18bars{\mathrm{bars}}bars{\mathrm{bars}}
21text := "the quick brown fox jumps over the lazy dog and the cat"{\mathrm{text}}\ {\leftarrow}\ {\text{"the quick brown fox jumps over the lazy dog and the cat"}}text ← "the quick brown fox jumps over the lazy dog and the cat"{\mathrm{text}}\ {\leftarrow}\ {\text{"the quick brown fox jumps over the lazy dog and the cat"}}
22space := f_irst " " # a one-character string is a vector{\mathrm{space}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}space ← f‾irst " "{\mathrm{space}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}
23letters := s_ort u_nique (w_here text != space) s_elect text{\mathrm{letters}}\ {\leftarrow}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{text}}\ {\neq}\ {\mathrm{space}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{text}}letters ← s‾ort u‾nique (w‾here text ≠ space) s‾elect text{\mathrm{letters}}\ {\leftarrow}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{text}}\ {\neq}\ {\mathrm{space}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{text}}
24letters{\mathrm{letters}}letters{\mathrm{letters}}
25n := '+ r_/_2 letters '= t_able text{\mathrm{n}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{letters}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{text}}n ← ’+ r‾/2 letters ’= t‾able text{\mathrm{n}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{letters}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{text}}
26n{\mathrm{n}}n{\mathrm{n}}
27(n i_ndexOf 'm_ax r_/ n) s_elect letters # the first of the most common (e, o, t: 4){(}{\mathrm{n}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{letters}}(n i‾ndexOf ’m‾ax r‾/ n) s‾elect letters{(}{\mathrm{n}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{letters}}
30tall := (r_ev r_ange 'm_ax r_/ n) '<= t_able n{\mathrm{tall}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ange}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}{)}\ {\text{'}}{\leq}\ {\mathrm{\underline{t}able}}\ {\mathrm{n}}tall ← (r‾ev r‾ange ’m‾ax r‾/ n) ’≤ t‾able n{\mathrm{tall}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ange}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}{)}\ {\text{'}}{\leq}\ {\mathrm{\underline{t}able}}\ {\mathrm{n}}
31shown := []S_HOW []G_RID tall{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{tall}}shown ← □S‾HOW □G‾RID tall{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{tall}}

demos/classics/life-drawn.xtl

9u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}
13u:f_rames := { n b ->{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}uf‾rames ← { n b →{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}
14 n = 1 ? (1 c_at s_hape b) r_eshape b\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}  n = 1 ? (1 c‾at s‾hape b) r‾eshape b\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}
15 b c_at (n - 1) u:f_rames u:l_ife b\ \ {\mathrm{b}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{b}}  b c‾at (n − 1) uf‾rames ul‾ife b\ \ {\mathrm{b}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{b}}
16}{\}}}{\}}
22glider := 10 t_ake 10 t_ake_2 3 3 r_eshape 0 1 0 0 0 1 1 1 1{\mathrm{glider}}\ {\leftarrow}\ {10}\ {\mathrm{\underline{t}ake}}\ {10}\ {{\mathrm{\underline{t}ake}}_{2}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}glider ← 10 t‾ake 10 t‾ake2 3 3 r‾eshape 0 1 0 0 0 1 1 1 1{\mathrm{glider}}\ {\leftarrow}\ {10}\ {\mathrm{\underline{t}ake}}\ {10}\ {{\mathrm{\underline{t}ake}}_{2}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}
23(u:l_ife^40 glider) m_atch glider{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{40}\ {\mathrm{glider}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{glider}}(ul‾ife40 glider) m‾atch glider{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{40}\ {\mathrm{glider}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{glider}}
24torus := []S_HOW []G_RID 40 u:f_rames glider{\mathrm{torus}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\mathrm{glider}}torus ← □S‾HOW □G‾RID 40 uf‾rames glider{\mathrm{torus}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\mathrm{glider}}
30row := 0 c_at (10 r_eshape 1) c_at 0{\mathrm{row}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {(}{10}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {0}row ← 0 c‾at (10 r‾eshape 1) c‾at 0{\mathrm{row}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {(}{10}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {0}
31mask := row '* t_able row{\mathrm{mask}}\ {\leftarrow}\ {\mathrm{row}}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{row}}mask ← row ’× t‾able row{\mathrm{mask}}\ {\leftarrow}\ {\mathrm{row}}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{row}}
32u:b_oxed := { mask * u:l_ife _r }{{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}\ {\leftarrow}\ {\{}\ {\mathrm{mask}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\_\mathrm{r}}\ {\}}ub‾oxed ← { mask × ul‾ife _r }{{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}\ {\leftarrow}\ {\{}\ {\mathrm{mask}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\_\mathrm{r}}\ {\}}
33u:b_oxedFrames := { n b ->{{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}ub‾oxedFrames ← { n b →{{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}
34 n = 1 ? (1 c_at s_hape b) r_eshape b\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}  n = 1 ? (1 c‾at s‾hape b) r‾eshape b\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}
35 b c_at (n - 1) u:b_oxedFrames u:b_oxed b\ \ {\mathrm{b}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}\ {\mathrm{b}}  b c‾at (n − 1) ub‾oxedFrames ub‾oxed b\ \ {\mathrm{b}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}\ {\mathrm{b}}
36}{\}}}{\}}
40start := -1 o_- -1 o_-_2 12 t_ake 12 t_ake_2 3 3 r_eshape 0 1 0 0 0 1 1 1 1{\mathrm{start}}\ {\leftarrow}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {12}\ {\mathrm{\underline{t}ake}}\ {12}\ {{\mathrm{\underline{t}ake}}_{2}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}start ← −1 o‾− −1 o‾−2 12 t‾ake 12 t‾ake2 3 3 r‾eshape 0 1 0 0 0 1 1 1 1{\mathrm{start}}\ {\leftarrow}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {12}\ {\mathrm{\underline{t}ake}}\ {12}\ {{\mathrm{\underline{t}ake}}_{2}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}
41boxed := []S_HOW []G_RID 40 u:b_oxedFrames start{\mathrm{boxed}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {\mathrm{start}}boxed ← □S‾HOW □G‾RID 40 ub‾oxedFrames start{\mathrm{boxed}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {\mathrm{start}}
42'+ r_/_12 u:b_oxed^40 start # four cells: the block{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}^{40}\ {\mathrm{start}}’+ r‾/12 ub‾oxed40 start{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}^{40}\ {\mathrm{start}}

demos/classics/magic.xtl

7n := 5{\mathrm{n}}\ {\leftarrow}\ {5}n ← 5{\mathrm{n}}\ {\leftarrow}\ {5}
8o := o_ffsets n{\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}o ← o‾ffsets n{\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}
9h := (n + 1) d_iv 2{\mathrm{h}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {+}\ {1}{)}\ {\mathrm{\underline{d}iv}}\ {2}h ← (n + 1) d‾iv 2{\mathrm{h}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {+}\ {1}{)}\ {\mathrm{\underline{d}iv}}\ {2}
12a := (h + o) o_- o{\mathrm{a}}\ {\leftarrow}\ {(}{\mathrm{h}}\ {+}\ {\mathrm{o}}{)}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{o}}a ← (h + o) o‾− o{\mathrm{a}}\ {\leftarrow}\ {(}{\mathrm{h}}\ {+}\ {\mathrm{o}}{)}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{o}}
13a{\mathrm{a}}a{\mathrm{a}}
14b := (h * o) o_- (1 + 2 * o) m_od n{\mathrm{b}}\ {\leftarrow}\ {(}{\mathrm{h}}\ {\times}\ {\mathrm{o}}{)}\ {\mathrm{\underline{o}}{-}}\ {(}{1}\ {+}\ {2}\ {\times}\ {\mathrm{o}}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}b ← (h × o) o‾− (1 + 2 × o) m‾od n{\mathrm{b}}\ {\leftarrow}\ {(}{\mathrm{h}}\ {\times}\ {\mathrm{o}}{)}\ {\mathrm{\underline{o}}{-}}\ {(}{1}\ {+}\ {2}\ {\times}\ {\mathrm{o}}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}
15b{\mathrm{b}}b{\mathrm{b}}
16m := 1 + (n * a) + b # a gives the n's, b the units{\mathrm{m}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{n}}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}m ← 1 + (n × a) + b{\mathrm{m}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{n}}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}
17m{\mathrm{m}}m{\mathrm{m}}
20'+ r_/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
21'+ r_/_2 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}’+ r‾/2 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}
22'+ r_/ '+ r_/ m * o '= t_able o{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {\times}\ {\mathrm{o}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{o}}’+ r‾/ ’+ r‾/ m × o ’= t‾able o{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {\times}\ {\mathrm{o}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{o}}
23'+ r_/ '+ r_/ m * o '= t_able r_ev o{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {\times}\ {\mathrm{o}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{o}}’+ r‾/ ’+ r‾/ m × o ’= t‾able r‾ev o{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {\times}\ {\mathrm{o}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{o}}
24(s_ort (n * n) r_eshape m) m_atch r_ange n * n{(}{\mathrm{\underline{s}ort}}\ {(}{\mathrm{n}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\times}\ {\mathrm{n}}(s‾ort (n × n) r‾eshape m) m‾atch r‾ange n × n{(}{\mathrm{\underline{s}ort}}\ {(}{\mathrm{n}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\times}\ {\mathrm{n}}
27u:s_iamese := { n ->{{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}us‾iamese ← { n →{{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
28 o := o_ffsets n\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}  o ← o‾ffsets n\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}
29 h := (n + 1) d_iv 2\ \ {\mathrm{h}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {+}\ {1}{)}\ {\mathrm{\underline{d}iv}}\ {2}  h ← (n + 1) d‾iv 2\ \ {\mathrm{h}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {+}\ {1}{)}\ {\mathrm{\underline{d}iv}}\ {2}
30 1 + (n * (h + o) o_- o) + (h * o) o_- (1 + 2 * o) m_od n\ \ {1}\ {+}\ {(}{\mathrm{n}}\ {\times}\ {(}{\mathrm{h}}\ {+}\ {\mathrm{o}}{)}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{o}}{)}\ {+}\ {(}{\mathrm{h}}\ {\times}\ {\mathrm{o}}{)}\ {\mathrm{\underline{o}}{-}}\ {(}{1}\ {+}\ {2}\ {\times}\ {\mathrm{o}}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}  1 + (n × (h + o) o‾− o) + (h × o) o‾− (1 + 2 × o) m‾od n\ \ {1}\ {+}\ {(}{\mathrm{n}}\ {\times}\ {(}{\mathrm{h}}\ {+}\ {\mathrm{o}}{)}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{o}}{)}\ {+}\ {(}{\mathrm{h}}\ {\times}\ {\mathrm{o}}{)}\ {\mathrm{\underline{o}}{-}}\ {(}{1}\ {+}\ {2}\ {\times}\ {\mathrm{o}}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}
31}{\}}}{\}}
32u:m_agic := { m ->{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}um‾agic ← { m →{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}
33 n := t_ally m\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{m}}  n ← t‾ally m\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{m}}
34 s := (n * 1 + n * n) d_iv 2\ \ {\mathrm{s}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {\times}\ {1}\ {+}\ {\mathrm{n}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{d}iv}}\ {2}  s ← (n × 1 + n × n) d‾iv 2\ \ {\mathrm{s}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {\times}\ {1}\ {+}\ {\mathrm{n}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{d}iv}}\ {2}
35 o := o_ffsets n\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}  o ← o‾ffsets n\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}
36 r := '& r_/ s = ('+ r_/ m) c_at '+ r_/_2 m\ \ {\mathrm{r}}\ {\leftarrow}\ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}\ {=}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}  r ← ’∧ r‾/ s = (’+ r‾/ m) c‾at ’+ r‾/2 m\ \ {\mathrm{r}}\ {\leftarrow}\ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}\ {=}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}
37 d := s = '+ r_/ '+ r_/ m * o '= t_able o\ \ {\mathrm{d}}\ {\leftarrow}\ {\mathrm{s}}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {\times}\ {\mathrm{o}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{o}}  d ← s = ’+ r‾/ ’+ r‾/ m × o ’= t‾able o\ \ {\mathrm{d}}\ {\leftarrow}\ {\mathrm{s}}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {\times}\ {\mathrm{o}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{o}}
38 e := s = '+ r_/ '+ r_/ m * o '= t_able r_ev o\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{s}}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {\times}\ {\mathrm{o}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{o}}  e ← s = ’+ r‾/ ’+ r‾/ m × o ’= t‾able r‾ev o\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{s}}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {\times}\ {\mathrm{o}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{o}}
39 r & d & e & (s_ort (n * n) r_eshape m) m_atch r_ange n * n\ \ {\mathrm{r}}\ {\wedge}\ {\mathrm{d}}\ {\wedge}\ {\mathrm{e}}\ {\wedge}\ {(}{\mathrm{\underline{s}ort}}\ {(}{\mathrm{n}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\times}\ {\mathrm{n}}  r ∧ d ∧ e ∧ (s‾ort (n × n) r‾eshape m) m‾atch r‾ange n × n\ \ {\mathrm{r}}\ {\wedge}\ {\mathrm{d}}\ {\wedge}\ {\mathrm{e}}\ {\wedge}\ {(}{\mathrm{\underline{s}ort}}\ {(}{\mathrm{n}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\times}\ {\mathrm{n}}
40}{\}}}{\}}
41u:s_iamese 3{{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}\ {3}us‾iamese 3{{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}\ {3}
42'[u:m_agic u:s_iamese] e_ach 3 5 7 9 11{\text{'}}{[}{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}{]}\ {\mathrm{\underline{e}ach}}\ {3}\ {5}\ {7}\ {9}\ {11}’[um‾agic us‾iamese] e‾ach 3 5 7 9 11{\text{'}}{[}{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}{]}\ {\mathrm{\underline{e}ach}}\ {3}\ {5}\ {7}\ {9}\ {11}
43u:m_agic u:s_iamese 7{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}\ {7}um‾agic us‾iamese 7{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}\ {7}
44u:m_agic 3 3 r_eshape r_ange 9 # counting is not magic{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {9}um‾agic 3 3 r‾eshape r‾ange 9{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {9}
45shown := []S_HOW []G_RID u:s_iamese 7{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}\ {7}shown ← □S‾HOW □G‾RID us‾iamese 7{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}iamese}}\ {7}
51k := 4 4 r_eshape r_ange 16{\mathrm{k}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {16}k ← 4 4 r‾eshape r‾ange 16{\mathrm{k}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {16}
52c := 1 0 0 1{\mathrm{c}}\ {\leftarrow}\ {1}\ {0}\ {0}\ {1}c ← 1 0 0 1{\mathrm{c}}\ {\leftarrow}\ {1}\ {0}\ {0}\ {1}
53d := k + (17 - 2 * k) * c '= t_able c{\mathrm{d}}\ {\leftarrow}\ {\mathrm{k}}\ {+}\ {(}{17}\ {-}\ {2}\ {\times}\ {\mathrm{k}}{)}\ {\times}\ {\mathrm{c}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{c}}d ← k + (17 − 2 × k) × c ’= t‾able c{\mathrm{d}}\ {\leftarrow}\ {\mathrm{k}}\ {+}\ {(}{17}\ {-}\ {2}\ {\times}\ {\mathrm{k}}{)}\ {\times}\ {\mathrm{c}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{c}}
54d{\mathrm{d}}d{\mathrm{d}}
55durer := 1 3 2 4 s_elect_2 d{\mathrm{durer}}\ {\leftarrow}\ {1}\ {3}\ {2}\ {4}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{d}}durer ← 1 3 2 4 s‾elect2 d{\mathrm{durer}}\ {\leftarrow}\ {1}\ {3}\ {2}\ {4}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{d}}
56durer{\mathrm{durer}}durer{\mathrm{durer}}
57u:m_agic durer{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {\mathrm{durer}}um‾agic durer{{}^{\mathrm{u}}\mathrm{\underline{m}agic}}\ {\mathrm{durer}}

demos/classics/mandelbrot.xtl

13u:c_entred := { n -> (f_loat o_ffsets n) - (n - 1) / 2 }{{}^{\mathrm{u}}\mathrm{\underline{c}entred}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}{)}\ {-}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {\div}\ {2}\ {\}}uc‾entred ← { n → (f‾loat o‾ffsets n) − (n − 1) ÷ 2 }{{}^{\mathrm{u}}\mathrm{\underline{c}entred}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}{)}\ {-}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {\div}\ {2}\ {\}}
14u:r_e := { size view ->{{}^{\mathrm{u}}\mathrm{\underline{r}e}}\ {\leftarrow}\ {\{}\ {\mathrm{size}}\ {\mathrm{view}}\ {\to}ur‾e ← { size view →{{}^{\mathrm{u}}\mathrm{\underline{r}e}}\ {\leftarrow}\ {\{}\ {\mathrm{size}}\ {\mathrm{view}}\ {\to}
15 (1 s_elect view) + (3 s_elect view) * (u:c_entred 2 s_elect size) / f_loat 2 s_elect size\ \ {(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{view}}{)}\ {+}\ {(}{3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{view}}{)}\ {\times}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{c}entred}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}  (1 s‾elect view) + (3 s‾elect view) × (uc‾entred 2 s‾elect size) ÷ f‾loat 2 s‾elect size\ \ {(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{view}}{)}\ {+}\ {(}{3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{view}}{)}\ {\times}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{c}entred}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}
16}{\}}}{\}}
17u:i_m := { size view ->{{}^{\mathrm{u}}\mathrm{\underline{i}m}}\ {\leftarrow}\ {\{}\ {\mathrm{size}}\ {\mathrm{view}}\ {\to}ui‾m ← { size view →{{}^{\mathrm{u}}\mathrm{\underline{i}m}}\ {\leftarrow}\ {\{}\ {\mathrm{size}}\ {\mathrm{view}}\ {\to}
18 (2 s_elect view) - (3 s_elect view) * (u:c_entred 1 s_elect size) / f_loat 2 s_elect size\ \ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{view}}{)}\ {-}\ {(}{3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{view}}{)}\ {\times}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{c}entred}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}  (2 s‾elect view) − (3 s‾elect view) × (uc‾entred 1 s‾elect size) ÷ f‾loat 2 s‾elect size\ \ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{view}}{)}\ {-}\ {(}{3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{view}}{)}\ {\times}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{c}entred}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}
19}{\}}}{\}}
22u:p_lane := { m -> (1 c_at s_hape m) r_eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}up‾lane ← { m → (1 c‾at s‾hape m) r‾eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}
29u:c_ounts := { size view ->{{}^{\mathrm{u}}\mathrm{\underline{c}ounts}}\ {\leftarrow}\ {\{}\ {\mathrm{size}}\ {\mathrm{view}}\ {\to}uc‾ounts ← { size view →{{}^{\mathrm{u}}\mathrm{\underline{c}ounts}}\ {\leftarrow}\ {\{}\ {\mathrm{size}}\ {\mathrm{view}}\ {\to}
30 n := 3 s_elect size\ \ {\mathrm{n}}\ {\leftarrow}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}  n ← 3 s‾elect size\ \ {\mathrm{n}}\ {\leftarrow}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}
31 cr := (o_ffsets 1 s_elect size) 'r_ight t_able size u:r_e view\ \ {\mathrm{cr}}\ {\leftarrow}\ {(}{\mathrm{\underline{o}ffsets}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}{)}\ {\text{'}}{\mathrm{\underline{r}ight}}\ {\mathrm{\underline{t}able}}\ {\mathrm{size}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}e}}\ {\mathrm{view}}  cr ← (o‾ffsets 1 s‾elect size) ’r‾ight t‾able size ur‾e view\ \ {\mathrm{cr}}\ {\leftarrow}\ {(}{\mathrm{\underline{o}ffsets}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}{)}\ {\text{'}}{\mathrm{\underline{r}ight}}\ {\mathrm{\underline{t}able}}\ {\mathrm{size}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}e}}\ {\mathrm{view}}
32 ci := (size u:i_m view) 'l_eft t_able o_ffsets 2 s_elect size\ \ {\mathrm{ci}}\ {\leftarrow}\ {(}{\mathrm{size}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}m}}\ {\mathrm{view}}{)}\ {\text{'}}{\mathrm{\underline{l}eft}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{o}ffsets}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}  ci ← (size ui‾m view) ’l‾eft t‾able o‾ffsets 2 s‾elect size\ \ {\mathrm{ci}}\ {\leftarrow}\ {(}{\mathrm{size}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}m}}\ {\mathrm{view}}{)}\ {\text{'}}{\mathrm{\underline{l}eft}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{o}ffsets}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{size}}
33 s_tep := { s ->\ \ {\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}  s‾tep ← { s →\ \ {\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
34 zr := 1 s_elect s\ \ \ \ {\mathrm{zr}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}    zr ← 1 s‾elect s\ \ \ \ {\mathrm{zr}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}
35 zi := 2 s_elect s\ \ \ \ {\mathrm{zi}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}    zi ← 2 s‾elect s\ \ \ \ {\mathrm{zi}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}
36 keep := f_loat 4 >= (zr * zr) + zi * zi\ \ \ \ {\mathrm{keep}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {4}\ {\geq}\ {(}{\mathrm{zr}}\ {\times}\ {\mathrm{zr}}{)}\ {+}\ {\mathrm{zi}}\ {\times}\ {\mathrm{zi}}    keep ← f‾loat 4 ≥ (zr × zr) + zi × zi\ \ \ \ {\mathrm{keep}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {4}\ {\geq}\ {(}{\mathrm{zr}}\ {\times}\ {\mathrm{zr}}{)}\ {+}\ {\mathrm{zi}}\ {\times}\ {\mathrm{zi}}
37 a := (keep * cr + (zr * zr) - zi * zi) + (1 - keep) * zr\ \ \ \ {\mathrm{a}}\ {\leftarrow}\ {(}{\mathrm{keep}}\ {\times}\ {\mathrm{cr}}\ {+}\ {(}{\mathrm{zr}}\ {\times}\ {\mathrm{zr}}{)}\ {-}\ {\mathrm{zi}}\ {\times}\ {\mathrm{zi}}{)}\ {+}\ {(}{1}\ {-}\ {\mathrm{keep}}{)}\ {\times}\ {\mathrm{zr}}    a ← (keep × cr + (zr × zr) − zi × zi) + (1 − keep) × zr\ \ \ \ {\mathrm{a}}\ {\leftarrow}\ {(}{\mathrm{keep}}\ {\times}\ {\mathrm{cr}}\ {+}\ {(}{\mathrm{zr}}\ {\times}\ {\mathrm{zr}}{)}\ {-}\ {\mathrm{zi}}\ {\times}\ {\mathrm{zi}}{)}\ {+}\ {(}{1}\ {-}\ {\mathrm{keep}}{)}\ {\times}\ {\mathrm{zr}}
38 b := (keep * ci + 2 * zr * zi) + (1 - keep) * zi\ \ \ \ {\mathrm{b}}\ {\leftarrow}\ {(}{\mathrm{keep}}\ {\times}\ {\mathrm{ci}}\ {+}\ {2}\ {\times}\ {\mathrm{zr}}\ {\times}\ {\mathrm{zi}}{)}\ {+}\ {(}{1}\ {-}\ {\mathrm{keep}}{)}\ {\times}\ {\mathrm{zi}}    b ← (keep × ci + 2 × zr × zi) + (1 − keep) × zi\ \ \ \ {\mathrm{b}}\ {\leftarrow}\ {(}{\mathrm{keep}}\ {\times}\ {\mathrm{ci}}\ {+}\ {2}\ {\times}\ {\mathrm{zr}}\ {\times}\ {\mathrm{zi}}{)}\ {+}\ {(}{1}\ {-}\ {\mathrm{keep}}{)}\ {\times}\ {\mathrm{zi}}
39 (u:p_lane a) c_at (u:p_lane b) c_at u:p_lane keep + 3 s_elect s\ \ \ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{keep}}\ {+}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}    (up‾lane a) c‾at (up‾lane b) c‾at up‾lane keep + 3 s‾elect s\ \ \ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{keep}}\ {+}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}
40 }\ \ {\}}  }\ \ {\}}
41 c := 3 s_elect n 's_tep p_ower (3 c_at 2 t_ake size) r_eshape 0.0\ \ {\mathrm{c}}\ {\leftarrow}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}\ {\text{'}}{\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{3}\ {\mathrm{\underline{c}at}}\ {2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{r}eshape}}\ {0.0}  c ← 3 s‾elect n ’s‾tep p‾ower (3 c‾at 2 t‾ake size) r‾eshape 0.0\ \ {\mathrm{c}}\ {\leftarrow}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}\ {\text{'}}{\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{3}\ {\mathrm{\underline{c}at}}\ {2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{r}eshape}}\ {0.0}
42 c * f_loat c < f_loat n\ \ {\mathrm{c}}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{c}}\ {<}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}  c × f‾loat c < f‾loat n\ \ {\mathrm{c}}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{c}}\ {<}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}
43}{\}}}{\}}
46still := []S_HOW []G_RID 90 135 40 u:c_ounts -0.6 0.0 3.0{\mathrm{still}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {90}\ {135}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ounts}}\ {-0.6}\ {0.0}\ {3.0}still ← □S‾HOW □G‾RID 90 135 40 uc‾ounts −0.6 0.0 3.0{\mathrm{still}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {90}\ {135}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ounts}}\ {-0.6}\ {0.0}\ {3.0}
51u:z_oom := { k ->{{}^{\mathrm{u}}\mathrm{\underline{z}oom}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}uz‾oom ← { k →{{}^{\mathrm{u}}\mathrm{\underline{z}oom}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}
52 shrink := 0.75 ^ f_loat k\ \ {\mathrm{shrink}}\ {\leftarrow}\ {0.75}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}  shrink ← 0.75 ^ f‾loat k\ \ {\mathrm{shrink}}\ {\leftarrow}\ {0.75}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}
53 t := 1 - shrink\ \ {\mathrm{t}}\ {\leftarrow}\ {1}\ {-}\ {\mathrm{shrink}}  t ← 1 − shrink\ \ {\mathrm{t}}\ {\leftarrow}\ {1}\ {-}\ {\mathrm{shrink}}
54 view := (-0.6 + t * -0.1436) c_at (0.1318 * t) c_at 3.0 * shrink\ \ {\mathrm{view}}\ {\leftarrow}\ {(}{-0.6}\ {+}\ {\mathrm{t}}\ {\times}\ {-0.1436}{)}\ {\mathrm{\underline{c}at}}\ {(}{0.1318}\ {\times}\ {\mathrm{t}}{)}\ {\mathrm{\underline{c}at}}\ {3.0}\ {\times}\ {\mathrm{shrink}}  view ← (−0.6 + t × −0.1436) c‾at (0.1318 × t) c‾at 3.0 × shrink\ \ {\mathrm{view}}\ {\leftarrow}\ {(}{-0.6}\ {+}\ {\mathrm{t}}\ {\times}\ {-0.1436}{)}\ {\mathrm{\underline{c}at}}\ {(}{0.1318}\ {\times}\ {\mathrm{t}}{)}\ {\mathrm{\underline{c}at}}\ {3.0}\ {\times}\ {\mathrm{shrink}}
55 u:p_lane (60 90 c_at 24 + 4 * k) u:c_ounts view\ \ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {(}{60}\ {90}\ {\mathrm{\underline{c}at}}\ {24}\ {+}\ {4}\ {\times}\ {\mathrm{k}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ounts}}\ {\mathrm{view}}  up‾lane (60 90 c‾at 24 + 4 × k) uc‾ounts view\ \ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {(}{60}\ {90}\ {\mathrm{\underline{c}at}}\ {24}\ {+}\ {4}\ {\times}\ {\mathrm{k}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ounts}}\ {\mathrm{view}}
56}{\}}}{\}}
57u:f_rames := { k -> k = 0 ? u:z_oom 0; (u:f_rames k - 1) c_at u:z_oom k }{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {=}\ {0}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{z}oom}}\ {0}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{z}oom}}\ {\mathrm{k}}\ {\}}uf‾rames ← { k → k = 0 ? uz‾oom 0⋄ (uf‾rames k − 1) c‾at uz‾oom k }{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {=}\ {0}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{z}oom}}\ {0}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{z}oom}}\ {\mathrm{k}}\ {\}}
58zoom := []S_HOW []G_RID u:f_rames 11{\mathrm{zoom}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {11}zoom ← □S‾HOW □G‾RID uf‾rames 11{\mathrm{zoom}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {11}
63u:o_ver := { k -> u:p_lane 60 90 30 u:c_ounts (-1.6 + 0.16 * f_loat k) c_at 0.0 1.0 }{{}^{\mathrm{u}}\mathrm{\underline{o}ver}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {60}\ {90}\ {30}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ounts}}\ {(}{-1.6}\ {+}\ {0.16}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {1.0}\ {\}}uo‾ver ← { k → up‾lane 60 90 30 uc‾ounts (−1.6 + 0.16 × f‾loat k) c‾at 0.0 1.0 }{{}^{\mathrm{u}}\mathrm{\underline{o}ver}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {60}\ {90}\ {30}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ounts}}\ {(}{-1.6}\ {+}\ {0.16}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {1.0}\ {\}}
64u:p_ass := { k -> k = 0 ? u:o_ver 0; (u:p_ass k - 1) c_at u:o_ver k }{{}^{\mathrm{u}}\mathrm{\underline{p}ass}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {=}\ {0}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{o}ver}}\ {0}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}ass}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}ver}}\ {\mathrm{k}}\ {\}}up‾ass ← { k → k = 0 ? uo‾ver 0⋄ (up‾ass k − 1) c‾at uo‾ver k }{{}^{\mathrm{u}}\mathrm{\underline{p}ass}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {=}\ {0}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{o}ver}}\ {0}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}ass}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}ver}}\ {\mathrm{k}}\ {\}}
65flyover := []S_HOW []G_RID u:p_ass 11{\mathrm{flyover}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ass}}\ {11}flyover ← □S‾HOW □G‾RID up‾ass 11{\mathrm{flyover}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ass}}\ {11}

demos/classics/mastermind-play.xtl

7u:s_core := { s g ->{{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\mathrm{g}}\ {\to}us‾core ← { s g →{{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\mathrm{g}}\ {\to}
8 black := '+ r_/ s = g\ \ {\mathrm{black}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}\ {=}\ {\mathrm{g}}  black ← ’+ r‾/ s = g\ \ {\mathrm{black}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}\ {=}\ {\mathrm{g}}
9 both := '+ r_/ ('+ r_/_2 (r_ange 6) '= t_able s) m_in '+ r_/_2 (r_ange 6) '= t_able g\ \ {\mathrm{both}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}  both ← ’+ r‾/ (’+ r‾/2 (r‾ange 6) ’= t‾able s) m‾in ’+ r‾/2 (r‾ange 6) ’= t‾able g\ \ {\mathrm{both}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}
10 black c_at both - black\ \ {\mathrm{black}}\ {\mathrm{\underline{c}at}}\ {\mathrm{both}}\ {-}\ {\mathrm{black}}  black c‾at both − black\ \ {\mathrm{black}}\ {\mathrm{\underline{c}at}}\ {\mathrm{both}}\ {-}\ {\mathrm{black}}
11}{\}}}{\}}
12u:p_egs := { r ->{{}^{\mathrm{u}}\mathrm{\underline{p}egs}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}up‾egs ← { r →{{}^{\mathrm{u}}\mathrm{\underline{p}egs}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}
13 0 = '+ r_/ r ? "none"\ \ {0}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{r}}\ {?}\ {\text{"none"}}  0 = ’+ r‾/ r ? "none"\ \ {0}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{r}}\ {?}\ {\text{"none"}}
14 ((1 t_ake r) r_eshape "*") c_at (-1 t_ake r) r_eshape "o"\ \ {(}{(}{1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{"*"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{"o"}}  ((1 t‾ake r) r‾eshape "*") c‾at (−1 t‾ake r) r‾eshape "o"\ \ {(}{(}{1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{"*"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{"o"}}
15}{\}}}{\}}
16secret := r_oll! 6 6 6 6{\mathrm{secret}}\ {\leftarrow}\ {\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}\ {6}secret ← r‾oll! 6 6 6 6{\mathrm{secret}}\ {\leftarrow}\ {\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}\ {6}
19u:a_sk := { n ->{{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}ua‾sk ← { n →{{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
20 shown := p_rint! @ f_ormat< "guess {n} (four digits, 1 to 6):"\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"guess \{n\} (four digits, 1 to 6):"}}  shown ← p‾rint! @ f‾ormat< "guess {n} (four digits, 1 to 6):"\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"guess \{n\} (four digits, 1 to 6):"}}
21 t := []R_EAD @\ \ {\mathrm{t}}\ {\leftarrow}\ {\square \mathrm{\underline{R}EAD}}\ {@}  t ← □R‾EAD @\ \ {\mathrm{t}}\ {\leftarrow}\ {\square \mathrm{\underline{R}EAD}}\ {@}
22 g := "123456" i_ndexOf t\ \ {\mathrm{g}}\ {\leftarrow}\ {\text{"123456"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{t}}  g ← "123456" i‾ndexOf t\ \ {\mathrm{g}}\ {\leftarrow}\ {\text{"123456"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{t}}
23 (4 = t_ally t) & '& r_/ g <= 6 ? g; u:a_sk n\ \ {(}{4}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{t}}{)}\ {\wedge}\ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{g}}\ {\leq}\ {6}\ {?}\ {\mathrm{g}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\mathrm{n}}  (4 = t‾ally t) ∧ ’∧ r‾/ g ≤ 6 ? g⋄ ua‾sk n\ \ {(}{4}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{t}}{)}\ {\wedge}\ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{g}}\ {\leq}\ {6}\ {?}\ {\mathrm{g}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\mathrm{n}}
24}{\}}}{\}}
27u:t_urn := { n ->{{}^{\mathrm{u}}\mathrm{\underline{t}urn}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}ut‾urn ← { n →{{}^{\mathrm{u}}\mathrm{\underline{t}urn}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
28 g := u:a_sk n\ \ {\mathrm{g}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\mathrm{n}}  g ← ua‾sk n\ \ {\mathrm{g}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\mathrm{n}}
29 r := secret u:s_core g\ \ {\mathrm{r}}\ {\leftarrow}\ {\mathrm{secret}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\mathrm{g}}  r ← secret us‾core g\ \ {\mathrm{r}}\ {\leftarrow}\ {\mathrm{secret}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\mathrm{g}}
30 shown := p_rint! @ f_ormat< "{g} {u:p_egs r}"\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"\{g\} \{u:p\_egs r\}"}}  shown ← p‾rint! @ f‾ormat< "{g} {u:p_egs r}"\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"\{g\} \{u:p\_egs r\}"}}
31 4 = f_irst r ? @ f_ormat< "solved in {n}"\ \ {4}\ {=}\ {\mathrm{\underline{f}irst}}\ {\mathrm{r}}\ {?}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"solved in \{n\}"}}  4 = f‾irst r ? @ f‾ormat< "solved in {n}"\ \ {4}\ {=}\ {\mathrm{\underline{f}irst}}\ {\mathrm{r}}\ {?}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"solved in \{n\}"}}
32 n = 10 ? @ f_ormat< "out of guesses: it was {secret}"\ \ {\mathrm{n}}\ {=}\ {10}\ {?}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"out of guesses: it was \{secret\}"}}  n = 10 ? @ f‾ormat< "out of guesses: it was {secret}"\ \ {\mathrm{n}}\ {=}\ {10}\ {?}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"out of guesses: it was \{secret\}"}}
33 u:t_urn n + 1\ \ {{}^{\mathrm{u}}\mathrm{\underline{t}urn}}\ {\mathrm{n}}\ {+}\ {1}  ut‾urn n + 1\ \ {{}^{\mathrm{u}}\mathrm{\underline{t}urn}}\ {\mathrm{n}}\ {+}\ {1}
34}{\}}}{\}}
35u:t_urn 1{{}^{\mathrm{u}}\mathrm{\underline{t}urn}}\ {1}ut‾urn 1{{}^{\mathrm{u}}\mathrm{\underline{t}urn}}\ {1}

demos/classics/mastermind.xtl

7secret := 1 1 2 3{\mathrm{secret}}\ {\leftarrow}\ {1}\ {1}\ {2}\ {3}secret ← 1 1 2 3{\mathrm{secret}}\ {\leftarrow}\ {1}\ {1}\ {2}\ {3}
8guess := 3 1 1 4{\mathrm{guess}}\ {\leftarrow}\ {3}\ {1}\ {1}\ {4}guess ← 3 1 1 4{\mathrm{guess}}\ {\leftarrow}\ {3}\ {1}\ {1}\ {4}
9'+ r_/ secret = guess # black: equal in place{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{secret}}\ {=}\ {\mathrm{guess}}’+ r‾/ secret = guess{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{secret}}\ {=}\ {\mathrm{guess}}
10c := '+ r_/_2 (r_ange 6) '= t_able secret{\mathrm{c}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{secret}}c ← ’+ r‾/2 (r‾ange 6) ’= t‾able secret{\mathrm{c}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{secret}}
11c # how many of each color{\mathrm{c}}c{\mathrm{c}}
12c m_in '+ r_/_2 (r_ange 6) '= t_able guess # colors both have{\mathrm{c}}\ {\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{guess}}c m‾in ’+ r‾/2 (r‾ange 6) ’= t‾able guess{\mathrm{c}}\ {\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{guess}}
15u:s_core := { s g ->{{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\mathrm{g}}\ {\to}us‾core ← { s g →{{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\mathrm{g}}\ {\to}
16 black := '+ r_/ s = g\ \ {\mathrm{black}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}\ {=}\ {\mathrm{g}}  black ← ’+ r‾/ s = g\ \ {\mathrm{black}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}\ {=}\ {\mathrm{g}}
17 both := '+ r_/ ('+ r_/_2 (r_ange 6) '= t_able s) m_in '+ r_/_2 (r_ange 6) '= t_able g\ \ {\mathrm{both}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}  both ← ’+ r‾/ (’+ r‾/2 (r‾ange 6) ’= t‾able s) m‾in ’+ r‾/2 (r‾ange 6) ’= t‾able g\ \ {\mathrm{both}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}
18 black c_at both - black\ \ {\mathrm{black}}\ {\mathrm{\underline{c}at}}\ {\mathrm{both}}\ {-}\ {\mathrm{black}}  black c‾at both − black\ \ {\mathrm{black}}\ {\mathrm{\underline{c}at}}\ {\mathrm{both}}\ {-}\ {\mathrm{black}}
19}{\}}}{\}}
20secret u:s_core guess{\mathrm{secret}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\mathrm{guess}}secret us‾core guess{\mathrm{secret}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\mathrm{guess}}
21secret u:s_core secret{\mathrm{secret}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\mathrm{secret}}secret us‾core secret{\mathrm{secret}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\mathrm{secret}}
25codes := o_\ 1 + 6 6 6 6 e_ncode o_ffsets 1296{\mathrm{codes}}\ {\leftarrow}\ {\mathrm{\underline{o}}{\backslash}}\ {1}\ {+}\ {6}\ {6}\ {6}\ {6}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{o}ffsets}}\ {1296}codes ← o‾\ 1 + 6 6 6 6 e‾ncode o‾ffsets 1296{\mathrm{codes}}\ {\leftarrow}\ {\mathrm{\underline{o}}{\backslash}}\ {1}\ {+}\ {6}\ {6}\ {6}\ {6}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{o}ffsets}}\ {1296}
26t_ally codes{\mathrm{\underline{t}ally}}\ {\mathrm{codes}}t‾ally codes{\mathrm{\underline{t}ally}}\ {\mathrm{codes}}
273 t_ake codes{3}\ {\mathrm{\underline{t}ake}}\ {\mathrm{codes}}3 t‾ake codes{3}\ {\mathrm{\underline{t}ake}}\ {\mathrm{codes}}
30u:s_cores := { c g ->{{}^{\mathrm{u}}\mathrm{\underline{s}cores}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{g}}\ {\to}us‾cores ← { c g →{{}^{\mathrm{u}}\mathrm{\underline{s}cores}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{g}}\ {\to}
31 n := t_ally c\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{c}}  n ← t‾ally c\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{c}}
32 black := '+ r_/_2 c = (n c_at 4) r_eshape g\ \ {\mathrm{black}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{c}}\ {=}\ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {4}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{g}}  black ← ’+ r‾/2 c = (n c‾at 4) r‾eshape g\ \ {\mathrm{black}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{c}}\ {=}\ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {4}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{g}}
33 have := '+ r_/_2 c '= t_able r_ange 6\ \ {\mathrm{have}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{c}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {6}  have ← ’+ r‾/2 c ’= t‾able r‾ange 6\ \ {\mathrm{have}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{c}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {6}
34 want := (n c_at 6) r_eshape '+ r_/_2 (r_ange 6) '= t_able g\ \ {\mathrm{want}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {6}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}  want ← (n c‾at 6) r‾eshape ’+ r‾/2 (r‾ange 6) ’= t‾able g\ \ {\mathrm{want}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {6}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}
35 both := '+ r_/_2 have m_in want\ \ {\mathrm{both}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{have}}\ {\mathrm{\underline{m}in}}\ {\mathrm{want}}  both ← ’+ r‾/2 have m‾in want\ \ {\mathrm{both}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{have}}\ {\mathrm{\underline{m}in}}\ {\mathrm{want}}
36 (10 * black) + both - black\ \ {(}{10}\ {\times}\ {\mathrm{black}}{)}\ {+}\ {\mathrm{both}}\ {-}\ {\mathrm{black}}  (10 × black) + both − black\ \ {(}{10}\ {\times}\ {\mathrm{black}}{)}\ {+}\ {\mathrm{both}}\ {-}\ {\mathrm{black}}
37}{\}}}{\}}
38x := codes u:s_cores 1 1 2 2{\mathrm{x}}\ {\leftarrow}\ {\mathrm{codes}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}cores}}\ {1}\ {1}\ {2}\ {2}x ← codes us‾cores 1 1 2 2{\mathrm{x}}\ {\leftarrow}\ {\mathrm{codes}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}cores}}\ {1}\ {1}\ {2}\ {2}
395 t_ake x{5}\ {\mathrm{\underline{t}ake}}\ {\mathrm{x}}5 t‾ake x{5}\ {\mathrm{\underline{t}ake}}\ {\mathrm{x}}
40u_nique x # the scores 1 1 2 2 can get{\mathrm{\underline{u}nique}}\ {\mathrm{x}}u‾nique x{\mathrm{\underline{u}nique}}\ {\mathrm{x}}
45u:s_olve := { c s ->{{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{s}}\ {\to}us‾olve ← { c s →{{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{s}}\ {\to}
46 g := 4 r_eshape 1 s_elect c\ \ {\mathrm{g}}\ {\leftarrow}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{c}}  g ← 4 r‾eshape 1 s‾elect c\ \ {\mathrm{g}}\ {\leftarrow}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{c}}
47 r := s u:s_core g\ \ {\mathrm{r}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\mathrm{g}}  r ← s us‾core g\ \ {\mathrm{r}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}core}}\ {\mathrm{g}}
48 row := 1 6 r_eshape g c_at r\ \ {\mathrm{row}}\ {\leftarrow}\ {1}\ {6}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {\mathrm{r}}  row ← 1 6 r‾eshape g c‾at r\ \ {\mathrm{row}}\ {\leftarrow}\ {1}\ {6}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {\mathrm{r}}
49 k := '+ r_/ 10 1 * r\ \ {\mathrm{k}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {10}\ {1}\ {\times}\ {\mathrm{r}}  k ← ’+ r‾/ 10 1 × r\ \ {\mathrm{k}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {10}\ {1}\ {\times}\ {\mathrm{r}}
50 4 = f_irst r ? row; row c_at ((w_here k = c u:s_cores g) s_elect c) u:s_olve s\ \ {4}\ {=}\ {\mathrm{\underline{f}irst}}\ {\mathrm{r}}\ {?}\ {\mathrm{row}}{\diamond}\ {\mathrm{row}}\ {\mathrm{\underline{c}at}}\ {(}{(}{\mathrm{\underline{w}here}}\ {\mathrm{k}}\ {=}\ {\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}cores}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{c}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {\mathrm{s}}  4 = f‾irst r ? row⋄ row c‾at ((w‾here k = c us‾cores g) s‾elect c) us‾olve s\ \ {4}\ {=}\ {\mathrm{\underline{f}irst}}\ {\mathrm{r}}\ {?}\ {\mathrm{row}}{\diamond}\ {\mathrm{row}}\ {\mathrm{\underline{c}at}}\ {(}{(}{\mathrm{\underline{w}here}}\ {\mathrm{k}}\ {=}\ {\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}cores}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{c}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {\mathrm{s}}
51}{\}}}{\}}
52codes u:s_olve 6 5 3 3{\mathrm{codes}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {6}\ {5}\ {3}\ {3}codes us‾olve 6 5 3 3{\mathrm{codes}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {6}\ {5}\ {3}\ {3}
53secrets := 3 4 r_eshape 4 1 6 2 5 3 3 6 2 4 1 5{\mathrm{secrets}}\ {\leftarrow}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {4}\ {1}\ {6}\ {2}\ {5}\ {3}\ {3}\ {6}\ {2}\ {4}\ {1}\ {5}secrets ← 3 4 r‾eshape 4 1 6 2 5 3 3 6 2 4 1 5{\mathrm{secrets}}\ {\leftarrow}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {4}\ {1}\ {6}\ {2}\ {5}\ {3}\ {3}\ {6}\ {2}\ {4}\ {1}\ {5}
54'{ t_ally codes u:s_olve 4 r_eshape _r s_elect secrets } e_ach r_ange 3{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\mathrm{codes}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\_\mathrm{r}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{secrets}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {3}’{ t‾ally codes us‾olve 4 r‾eshape _r s‾elect secrets } e‾ach r‾ange 3{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\mathrm{codes}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\_\mathrm{r}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{secrets}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {3}
57n := '{ t_ally codes u:s_olve 4 r_eshape (37 * _r) s_elect codes } e_ach r_ange 35{\mathrm{n}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\mathrm{codes}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {4}\ {\mathrm{\underline{r}eshape}}\ {(}{37}\ {\times}\ {\_\mathrm{r}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{codes}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {35}n ← ’{ t‾ally codes us‾olve 4 r‾eshape (37 × _r) s‾elect codes } e‾ach r‾ange 35{\mathrm{n}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\mathrm{codes}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}olve}}\ {4}\ {\mathrm{\underline{r}eshape}}\ {(}{37}\ {\times}\ {\_\mathrm{r}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{codes}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {35}
58'+ r_/_2 (r_ange 8) '= t_able n # games won in 1, 2, ... 8{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {8}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{n}}’+ r‾/2 (r‾ange 8) ’= t‾able n{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {8}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{n}}
59(f_loat '+ r_/ n) / f_loat t_ally n # the average{(}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{n}}(f‾loat ’+ r‾/ n) ÷ f‾loat t‾ally n{(}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{n}}

demos/classics/matmul.xtl

5a := 2 3 r_eshape 1 2 3 4 5 6{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}a ← 2 3 r‾eshape 1 2 3 4 5 6{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}
6b := 3 2 r_eshape 7 8 9 10 11 12{\mathrm{b}}\ {\leftarrow}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {7}\ {8}\ {9}\ {10}\ {11}\ {12}b ← 3 2 r‾eshape 7 8 9 10 11 12{\mathrm{b}}\ {\leftarrow}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {7}\ {8}\ {9}\ {10}\ {11}\ {12}
7a '+ '* i_nner b{\mathrm{a}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{b}}a ’+ ’× i‾nner b{\mathrm{a}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{b}}
11i := 3 3 r_eshape 1 0 0 0{\mathrm{i}}\ {\leftarrow}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {0}\ {0}\ {0}i ← 3 3 r‾eshape 1 0 0 0{\mathrm{i}}\ {\leftarrow}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {0}\ {0}\ {0}
12i{\mathrm{i}}i{\mathrm{i}}
13(i '+ '* i_nner b) m_atch b{(}{\mathrm{i}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{b}}(i ’+ ’× i‾nner b) m‾atch b{(}{\mathrm{i}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{b}}
14(a '+ '* i_nner b) m_atch b '+ '* i_nner a{(}{\mathrm{a}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{b}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{a}}(a ’+ ’× i‾nner b) m‾atch b ’+ ’× i‾nner a{(}{\mathrm{a}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{b}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{a}}
19g := 4 4 r_eshape 0 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0{\mathrm{g}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {1}\ {1}\ \ {1}\ {0}\ {1}\ {0}\ \ {1}\ {1}\ {0}\ {1}\ \ {1}\ {0}\ {1}\ {0}g ← 4 4 r‾eshape 0 1 1 1  1 0 1 0  1 1 0 1  1 0 1 0{\mathrm{g}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {1}\ {1}\ \ {1}\ {0}\ {1}\ {0}\ \ {1}\ {1}\ {0}\ {1}\ \ {1}\ {0}\ {1}\ {0}
20u:p_ow := { m k -> k = 1 ? m; m '+ '* i_nner m u:p_ow k - 1 }{{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {=}\ {1}\ {?}\ {\mathrm{m}}{\diamond}\ {\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{m}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\mathrm{k}}\ {-}\ {1}\ {\}}up‾ow ← { m k → k = 1 ? m⋄ m ’+ ’× i‾nner m up‾ow k − 1 }{{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {=}\ {1}\ {?}\ {\mathrm{m}}{\diamond}\ {\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{m}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\mathrm{k}}\ {-}\ {1}\ {\}}
21g u:p_ow 3{\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {3}g up‾ow 3{\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {3}
221 s_elect g u:p_ow 3{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {3}1 s‾elect g up‾ow 3{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {3}
26words := 3 4 r_eshape "rootrateroam"{\mathrm{words}}\ {\leftarrow}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\text{"rootrateroam"}}words ← 3 4 r‾eshape "rootrateroam"{\mathrm{words}}\ {\leftarrow}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\text{"rootrateroam"}}
27words '+ '= i_nner "roat"{\mathrm{words}}\ {\text{'}}{+}\ {\text{'}}{=}\ {\mathrm{\underline{i}nner}}\ {\text{"roat"}}words ’+ ’= i‾nner "roat"{\mathrm{words}}\ {\text{'}}{+}\ {\text{'}}{=}\ {\mathrm{\underline{i}nner}}\ {\text{"roat"}}

demos/classics/mini-apl.xtl

16u:t_okens := { s ->{{}^{\mathrm{u}}\mathrm{\underline{t}okens}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}ut‾okens ← { s →{{}^{\mathrm{u}}\mathrm{\underline{t}okens}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
17 num := 0 + s m_ember? "0123456789."\ \ {\mathrm{num}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789."}}  num ← 0 + s m‾ember? "0123456789."\ \ {\mathrm{num}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789."}}
18 par := 0 + s m_ember? "()"\ \ {\mathrm{par}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"()"}}  par ← 0 + s m‾ember? "()"\ \ {\mathrm{par}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"()"}}
19 c := num + (3 * par) + 2 * (s != f_irst " ") & (num + par) = 0\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{num}}\ {+}\ {(}{3}\ {\times}\ {\mathrm{par}}{)}\ {+}\ {2}\ {\times}\ {(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\wedge}\ {(}{\mathrm{num}}\ {+}\ {\mathrm{par}}{)}\ {=}\ {0}  c ← num + (3 × par) + 2 × (s ≠ f‾irst " ") ∧ (num + par) = 0\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{num}}\ {+}\ {(}{3}\ {\times}\ {\mathrm{par}}{)}\ {+}\ {2}\ {\times}\ {(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\wedge}\ {(}{\mathrm{num}}\ {+}\ {\mathrm{par}}{)}\ {=}\ {0}
20 starts := (c != 0) & (c = 3) | c != 0 c_at -1 d_rop c\ \ {\mathrm{starts}}\ {\leftarrow}\ {(}{\mathrm{c}}\ {\neq}\ {0}{)}\ {\wedge}\ {(}{\mathrm{c}}\ {=}\ {3}{)}\ {\vee}\ {\mathrm{c}}\ {\neq}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{c}}  starts ← (c ≠ 0) ∧ (c = 3) ∨ c ≠ 0 c‾at −1 d‾rop c\ \ {\mathrm{starts}}\ {\leftarrow}\ {(}{\mathrm{c}}\ {\neq}\ {0}{)}\ {\wedge}\ {(}{\mathrm{c}}\ {=}\ {3}{)}\ {\vee}\ {\mathrm{c}}\ {\neq}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{c}}
21 ((c != 0) * '+ s_\ starts) p_artition s\ \ {(}{(}{\mathrm{c}}\ {\neq}\ {0}{)}\ {\times}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{starts}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}  ((c ≠ 0) × ’+ s‾\ starts) p‾artition s\ \ {(}{(}{\mathrm{c}}\ {\neq}\ {0}{)}\ {\times}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{starts}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}
22}{\}}}{\}}
23t := u:t_okens "2*(3 + 4) - 10"{\mathrm{t}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}okens}}\ {\text{"2*(3 + 4) - 10"}}t ← ut‾okens "2*(3 + 4) - 10"{\mathrm{t}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}okens}}\ {\text{"2*(3 + 4) - 10"}}
24t{\mathrm{t}}t{\mathrm{t}}
27u:k_ind := { b ->{{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}uk‾ind ← { b →{{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}
28 d := d_isclose b\ \ {\mathrm{d}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}  d ← d‾isclose b\ \ {\mathrm{d}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}
29 f_irst d m_ember? "0123456789." ? 1\ \ {\mathrm{\underline{f}irst}}\ {\mathrm{d}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789."}}\ {?}\ {1}  f‾irst d m‾ember? "0123456789." ? 1\ \ {\mathrm{\underline{f}irst}}\ {\mathrm{d}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789."}}\ {?}\ {1}
30 d m_atch "(" ? 3\ \ {\mathrm{d}}\ {\mathrm{\underline{m}atch}}\ {\text{"("}}\ {?}\ {3}  d m‾atch "(" ? 3\ \ {\mathrm{d}}\ {\mathrm{\underline{m}atch}}\ {\text{"("}}\ {?}\ {3}
31 d m_atch ")" ? 4\ \ {\mathrm{d}}\ {\mathrm{\underline{m}atch}}\ {\text{")"}}\ {?}\ {4}  d m‾atch ")" ? 4\ \ {\mathrm{d}}\ {\mathrm{\underline{m}atch}}\ {\text{")"}}\ {?}\ {4}
32 2\ \ {2}  2\ \ {2}
33}{\}}}{\}}
34'u:k_ind e_ach t{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{t}}’uk‾ind e‾ach t{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{t}}
43u:e_xt := { a b -> 1 = t_ally a ? (t_ally b) r_eshape a; a }{{}^{\mathrm{u}}\mathrm{\underline{e}xt}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {1}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{a}}\ {?}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{a}}{\diamond}\ {\mathrm{a}}\ {\}}ue‾xt ← { a b → 1 = t‾ally a ? (t‾ally b) r‾eshape a⋄ a }{{}^{\mathrm{u}}\mathrm{\underline{e}xt}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {1}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{a}}\ {?}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{a}}{\diamond}\ {\mathrm{a}}\ {\}}
44u:p_ick := { o pv ->{{}^{\mathrm{u}}\mathrm{\underline{p}ick}}\ {\leftarrow}\ {\{}\ {\mathrm{o}}\ {\mathrm{pv}}\ {\to}up‾ick ← { o pv →{{}^{\mathrm{u}}\mathrm{\underline{p}ick}}\ {\leftarrow}\ {\{}\ {\mathrm{o}}\ {\mathrm{pv}}\ {\to}
45 p := (d_isclose 1 s_elect pv) - o\ \ {\mathrm{p}}\ {\leftarrow}\ {(}{\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pv}}{)}\ {-}\ {\mathrm{o}}  p ← (d‾isclose 1 s‾elect pv) − o\ \ {\mathrm{p}}\ {\leftarrow}\ {(}{\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pv}}{)}\ {-}\ {\mathrm{o}}
46 v := d_isclose 2 s_elect pv\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pv}}  v ← d‾isclose 2 s‾elect pv\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pv}}
47 lo := f_loor p\ \ {\mathrm{lo}}\ {\leftarrow}\ {\mathrm{\underline{f}loor}}\ {\mathrm{p}}  lo ← f‾loor p\ \ {\mathrm{lo}}\ {\leftarrow}\ {\mathrm{\underline{f}loor}}\ {\mathrm{p}}
48 f := p - f_loat lo\ \ {\mathrm{f}}\ {\leftarrow}\ {\mathrm{p}}\ {-}\ {\mathrm{\underline{f}loat}}\ {\mathrm{lo}}  f ← p − f‾loat lo\ \ {\mathrm{f}}\ {\leftarrow}\ {\mathrm{p}}\ {-}\ {\mathrm{\underline{f}loat}}\ {\mathrm{lo}}
49 n := t_ally v\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}  n ← t‾ally v\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}
50 c_lip := { k -> 1 + 0 m_ax (n - 1) m_in k }\ \ {\mathrm{\underline{c}lip}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {1}\ {+}\ {0}\ {\mathrm{\underline{m}ax}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{k}}\ {\}}  c‾lip ← { k → 1 + 0 m‾ax (n − 1) m‾in k }\ \ {\mathrm{\underline{c}lip}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {1}\ {+}\ {0}\ {\mathrm{\underline{m}ax}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{k}}\ {\}}
51 ((1 - f) * (c_lip lo) s_elect v) + f * (c_lip lo + 1) s_elect v\ \ {(}{(}{1}\ {-}\ {\mathrm{f}}{)}\ {\times}\ {(}{\mathrm{\underline{c}lip}}\ {\mathrm{lo}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}{)}\ {+}\ {\mathrm{f}}\ {\times}\ {(}{\mathrm{\underline{c}lip}}\ {\mathrm{lo}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}  ((1 − f) × (c‾lip lo) s‾elect v) + f × (c‾lip lo + 1) s‾elect v\ \ {(}{(}{1}\ {-}\ {\mathrm{f}}{)}\ {\times}\ {(}{\mathrm{\underline{c}lip}}\ {\mathrm{lo}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}{)}\ {+}\ {\mathrm{f}}\ {\times}\ {(}{\mathrm{\underline{c}lip}}\ {\mathrm{lo}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
52}{\}}}{\}}
53u:d_yad := { op olr ->{{}^{\mathrm{u}}\mathrm{\underline{d}yad}}\ {\leftarrow}\ {\{}\ {\mathrm{op}}\ {\mathrm{olr}}\ {\to}ud‾yad ← { op olr →{{}^{\mathrm{u}}\mathrm{\underline{d}yad}}\ {\leftarrow}\ {\{}\ {\mathrm{op}}\ {\mathrm{olr}}\ {\to}
54 o := f_irst d_isclose 1 s_elect olr\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{olr}}  o ← f‾irst d‾isclose 1 s‾elect olr\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{olr}}
55 a := d_isclose 2 s_elect olr\ \ {\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{olr}}  a ← d‾isclose 2 s‾elect olr\ \ {\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{olr}}
56 b := d_isclose 3 s_elect olr\ \ {\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{olr}}  b ← d‾isclose 3 s‾elect olr\ \ {\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{olr}}
57 op m_atch "pick" ? o u:p_ick (e_nclose a) c_at e_nclose b\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"pick"}}\ {?}\ {\mathrm{o}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ick}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{b}}  op m‾atch "pick" ? o up‾ick (e‾nclose a) c‾at e‾nclose b\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"pick"}}\ {?}\ {\mathrm{o}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ick}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{b}}
58 op m_atch "iota" ? o + f_loat (a i_ndexOf b) - 1\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"iota"}}\ {?}\ {\mathrm{o}}\ {+}\ {\mathrm{\underline{f}loat}}\ {(}{\mathrm{a}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{b}}{)}\ {-}\ {1}  op m‾atch "iota" ? o + f‾loat (a i‾ndexOf b) − 1\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"iota"}}\ {?}\ {\mathrm{o}}\ {+}\ {\mathrm{\underline{f}loat}}\ {(}{\mathrm{a}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{b}}{)}\ {-}\ {1}
59 l := a u:e_xt b\ \ {\mathrm{l}}\ {\leftarrow}\ {\mathrm{a}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}xt}}\ {\mathrm{b}}  l ← a ue‾xt b\ \ {\mathrm{l}}\ {\leftarrow}\ {\mathrm{a}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}xt}}\ {\mathrm{b}}
60 r := b u:e_xt a\ \ {\mathrm{r}}\ {\leftarrow}\ {\mathrm{b}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}xt}}\ {\mathrm{a}}  r ← b ue‾xt a\ \ {\mathrm{r}}\ {\leftarrow}\ {\mathrm{b}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}xt}}\ {\mathrm{a}}
61 op m_atch "+" ? l + r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"+"}}\ {?}\ {\mathrm{l}}\ {+}\ {\mathrm{r}}  op m‾atch "+" ? l + r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"+"}}\ {?}\ {\mathrm{l}}\ {+}\ {\mathrm{r}}
62 op m_atch "-" ? l - r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"-"}}\ {?}\ {\mathrm{l}}\ {-}\ {\mathrm{r}}  op m‾atch "-" ? l − r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"-"}}\ {?}\ {\mathrm{l}}\ {-}\ {\mathrm{r}}
63 op m_atch "*" ? l * r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"*"}}\ {?}\ {\mathrm{l}}\ {\times}\ {\mathrm{r}}  op m‾atch "*" ? l × r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"*"}}\ {?}\ {\mathrm{l}}\ {\times}\ {\mathrm{r}}
64 op m_atch "%" ? l / r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"\%"}}\ {?}\ {\mathrm{l}}\ {\div}\ {\mathrm{r}}  op m‾atch "%" ? l ÷ r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"\%"}}\ {?}\ {\mathrm{l}}\ {\div}\ {\mathrm{r}}
65 op m_atch "max" ? l 'm_ax e_ach r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"max"}}\ {?}\ {\mathrm{l}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{r}}  op m‾atch "max" ? l ’m‾ax e‾ach r\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"max"}}\ {?}\ {\mathrm{l}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{r}}
66 l 'm_in e_ach r\ \ {\mathrm{l}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{r}}  l ’m‾in e‾ach r\ \ {\mathrm{l}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{r}}
67}{\}}}{\}}
68u:m_onad := { op ov ->{{}^{\mathrm{u}}\mathrm{\underline{m}onad}}\ {\leftarrow}\ {\{}\ {\mathrm{op}}\ {\mathrm{ov}}\ {\to}um‾onad ← { op ov →{{}^{\mathrm{u}}\mathrm{\underline{m}onad}}\ {\leftarrow}\ {\{}\ {\mathrm{op}}\ {\mathrm{ov}}\ {\to}
69 o := f_irst d_isclose 1 s_elect ov\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ov}}  o ← f‾irst d‾isclose 1 s‾elect ov\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ov}}
70 v := d_isclose 2 s_elect ov\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ov}}  v ← d‾isclose 2 s‾elect ov\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ov}}
71 op m_atch "-" ? n_eg v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"-"}}\ {?}\ {\mathrm{\underline{n}eg}}\ {\mathrm{v}}  op m‾atch "-" ? n‾eg v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"-"}}\ {?}\ {\mathrm{\underline{n}eg}}\ {\mathrm{v}}
72 op m_atch "i" ? o + f_loat o_ffsets f_loor f_irst v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"i"}}\ {?}\ {\mathrm{o}}\ {+}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{\underline{f}loor}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}  op m‾atch "i" ? o + f‾loat o‾ffsets f‾loor f‾irst v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"i"}}\ {?}\ {\mathrm{o}}\ {+}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{\underline{f}loor}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}
73 op m_atch "r" ? r_ev v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"r"}}\ {?}\ {\mathrm{\underline{r}ev}}\ {\mathrm{v}}  op m‾atch "r" ? r‾ev v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"r"}}\ {?}\ {\mathrm{\underline{r}ev}}\ {\mathrm{v}}
74 op m_atch "*/" ? 1 r_eshape '* r_/ v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"*/"}}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}  op m‾atch "*/" ? 1 r‾eshape ’× r‾/ v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"*/"}}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
75 op m_atch "-/" ? 1 r_eshape '- r_/ v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"-/"}}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}  op m‾atch "-/" ? 1 r‾eshape ’− r‾/ v\ \ {\mathrm{op}}\ {\mathrm{\underline{m}atch}}\ {\text{"-/"}}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
76 1 r_eshape '+ r_/ v\ \ {1}\ {\mathrm{\underline{r}eshape}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}  1 r‾eshape ’+ r‾/ v\ \ {1}\ {\mathrm{\underline{r}eshape}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
77}{\}}}{\}}
83u:w_idth := { t ->{{}^{\mathrm{u}}\mathrm{\underline{w}idth}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\to}uw‾idth ← { t →{{}^{\mathrm{u}}\mathrm{\underline{w}idth}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\to}
84 k := 'u:k_ind e_ach t\ \ {\mathrm{k}}\ {\leftarrow}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{t}}  k ← ’uk‾ind e‾ach t\ \ {\mathrm{k}}\ {\leftarrow}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{t}}
85 4 != (t_ally k) s_elect k ? '+ r_/ '& s_\ r_ev k = 1\ \ {4}\ {\neq}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}\ {?}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{\wedge}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{k}}\ {=}\ {1}  4 ≠ (t‾ally k) s‾elect k ? ’+ r‾/ ’∧ s‾\ r‾ev k = 1\ \ {4}\ {\neq}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}\ {?}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{\wedge}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{k}}\ {=}\ {1}
86 depth := '+ s_\ r_ev (k = 4) - k = 3\ \ {\mathrm{depth}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{\underline{r}ev}}\ {(}{\mathrm{k}}\ {=}\ {4}{)}\ {-}\ {\mathrm{k}}\ {=}\ {3}  depth ← ’+ s‾\ r‾ev (k = 4) − k = 3\ \ {\mathrm{depth}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{\underline{r}ev}}\ {(}{\mathrm{k}}\ {=}\ {4}{)}\ {-}\ {\mathrm{k}}\ {=}\ {3}
87 f_irst w_here depth = 0\ \ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{w}here}}\ {\mathrm{depth}}\ {=}\ {0}  f‾irst w‾here depth = 0\ \ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{w}here}}\ {\mathrm{depth}}\ {=}\ {0}
88}{\}}}{\}}
89u:o_perand := { o t ->{{}^{\mathrm{u}}\mathrm{\underline{o}perand}}\ {\leftarrow}\ {\{}\ {\mathrm{o}}\ {\mathrm{t}}\ {\to}uo‾perand ← { o t →{{}^{\mathrm{u}}\mathrm{\underline{o}perand}}\ {\leftarrow}\ {\{}\ {\mathrm{o}}\ {\mathrm{t}}\ {\to}
90 w := u:w_idth t\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{w}idth}}\ {\mathrm{t}}  w ← uw‾idth t\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{w}idth}}\ {\mathrm{t}}
91 g := (n_eg w) t_ake t\ \ {\mathrm{g}}\ {\leftarrow}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{t}}  g ← (n‾eg w) t‾ake t\ \ {\mathrm{g}}\ {\leftarrow}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{t}}
92 4 = u:k_ind (t_ally g) s_elect g ? o u:e_val -1 d_rop 1 d_rop g\ \ {4}\ {=}\ {{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {?}\ {\mathrm{o}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}val}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{g}}  4 = uk‾ind (t‾ally g) s‾elect g ? o ue‾val −1 d‾rop 1 d‾rop g\ \ {4}\ {=}\ {{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {?}\ {\mathrm{o}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}val}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{g}}
93 '{ f_irst n_umbers d_isclose _r } e_ach g\ \ {\text{'}}{\{}\ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{n}umbers}}\ {\mathrm{\underline{d}isclose}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{g}}  ’{ f‾irst n‾umbers d‾isclose _r } e‾ach g\ \ {\text{'}}{\{}\ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{n}umbers}}\ {\mathrm{\underline{d}isclose}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{g}}
94}{\}}}{\}}
99u:r_un := { t ov ->{{}^{\mathrm{u}}\mathrm{\underline{r}un}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\mathrm{ov}}\ {\to}ur‾un ← { t ov →{{}^{\mathrm{u}}\mathrm{\underline{r}un}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\mathrm{ov}}\ {\to}
100 o := d_isclose 1 s_elect ov\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ov}}  o ← d‾isclose 1 s‾elect ov\ \ {\mathrm{o}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ov}}
101 v := d_isclose 2 s_elect ov\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ov}}  v ← d‾isclose 2 s‾elect ov\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ov}}
102 0 = t_ally t ? v\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{t}}\ {?}\ {\mathrm{v}}  0 = t‾ally t ? v\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{t}}\ {?}\ {\mathrm{v}}
103 op := d_isclose (t_ally t) s_elect t\ \ {\mathrm{op}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}  op ← d‾isclose (t‾ally t) s‾elect t\ \ {\mathrm{op}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}
104 rest := -1 d_rop t\ \ {\mathrm{rest}}\ {\leftarrow}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{t}}  rest ← −1 d‾rop t\ \ {\mathrm{rest}}\ {\leftarrow}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{t}}
105 last := 'u:k_ind e_ach rest\ \ {\mathrm{last}}\ {\leftarrow}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{rest}}  last ← ’uk‾ind e‾ach rest\ \ {\mathrm{last}}\ {\leftarrow}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{k}ind}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{rest}}
106 (0 = t_ally rest) | 2 = f_irst -1 t_ake 0 c_at last ? rest u:r_un (e_nclose o) c_at e_nclose op u:m_onad ov\ \ {(}{0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{rest}}{)}\ {\vee}\ {2}\ {=}\ {\mathrm{\underline{f}irst}}\ {-1}\ {\mathrm{\underline{t}ake}}\ {0}\ {\mathrm{\underline{c}at}}\ {\mathrm{last}}\ {?}\ {\mathrm{rest}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}un}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{o}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{op}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}onad}}\ {\mathrm{ov}}  (0 = t‾ally rest) ∨ 2 = f‾irst −1 t‾ake 0 c‾at last ? rest ur‾un (e‾nclose o) c‾at e‾nclose op um‾onad ov\ \ {(}{0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{rest}}{)}\ {\vee}\ {2}\ {=}\ {\mathrm{\underline{f}irst}}\ {-1}\ {\mathrm{\underline{t}ake}}\ {0}\ {\mathrm{\underline{c}at}}\ {\mathrm{last}}\ {?}\ {\mathrm{rest}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}un}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{o}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{op}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}onad}}\ {\mathrm{ov}}
107 left := (f_irst o) u:o_perand rest\ \ {\mathrm{left}}\ {\leftarrow}\ {(}{\mathrm{\underline{f}irst}}\ {\mathrm{o}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{o}perand}}\ {\mathrm{rest}}  left ← (f‾irst o) uo‾perand rest\ \ {\mathrm{left}}\ {\leftarrow}\ {(}{\mathrm{\underline{f}irst}}\ {\mathrm{o}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{o}perand}}\ {\mathrm{rest}}
108 w := u:w_idth rest\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{w}idth}}\ {\mathrm{rest}}  w ← uw‾idth rest\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{w}idth}}\ {\mathrm{rest}}
109 ((n_eg w) d_rop rest) u:r_un (e_nclose o) c_at e_nclose op u:d_yad (e_nclose o) c_at (e_nclose left) c_at e_nclose v\ \ {(}{(}{\mathrm{\underline{n}eg}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{d}rop}}\ {\mathrm{rest}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}un}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{o}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{op}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}yad}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{o}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{left}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{v}}  ((n‾eg w) d‾rop rest) ur‾un (e‾nclose o) c‾at e‾nclose op ud‾yad (e‾nclose o) c‾at (e‾nclose left) c‾at e‾nclose v\ \ {(}{(}{\mathrm{\underline{n}eg}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{d}rop}}\ {\mathrm{rest}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}un}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{o}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{op}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}yad}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{o}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{left}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{v}}
110}{\}}}{\}}
111u:e_val := { o t -> ((n_eg u:w_idth t) d_rop t) u:r_un (e_nclose 1 r_eshape o) c_at e_nclose o u:o_perand t }{{}^{\mathrm{u}}\mathrm{\underline{e}val}}\ {\leftarrow}\ {\{}\ {\mathrm{o}}\ {\mathrm{t}}\ {\to}\ {(}{(}{\mathrm{\underline{n}eg}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}idth}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{d}rop}}\ {\mathrm{t}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}un}}\ {(}{\mathrm{\underline{e}nclose}}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{o}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{o}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}perand}}\ {\mathrm{t}}\ {\}}ue‾val ← { o t → ((n‾eg uw‾idth t) d‾rop t) ur‾un (e‾nclose 1 r‾eshape o) c‾at e‾nclose o uo‾perand t }{{}^{\mathrm{u}}\mathrm{\underline{e}val}}\ {\leftarrow}\ {\{}\ {\mathrm{o}}\ {\mathrm{t}}\ {\to}\ {(}{(}{\mathrm{\underline{n}eg}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}idth}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{d}rop}}\ {\mathrm{t}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}un}}\ {(}{\mathrm{\underline{e}nclose}}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{o}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{o}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}perand}}\ {\mathrm{t}}\ {\}}
115u:i_nterp := { o s -> o u:e_val u:t_okens s }{{}^{\mathrm{u}}\mathrm{\underline{i}nterp}}\ {\leftarrow}\ {\{}\ {\mathrm{o}}\ {\mathrm{s}}\ {\to}\ {\mathrm{o}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}val}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}okens}}\ {\mathrm{s}}\ {\}}ui‾nterp ← { o s → o ue‾val ut‾okens s }{{}^{\mathrm{u}}\mathrm{\underline{i}nterp}}\ {\leftarrow}\ {\{}\ {\mathrm{o}}\ {\mathrm{s}}\ {\to}\ {\mathrm{o}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}val}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}okens}}\ {\mathrm{s}}\ {\}}
116u:a_pl := { s -> 1.0 u:i_nterp s }{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {1.0}\ {{}^{\mathrm{u}}\mathrm{\underline{i}nterp}}\ {\mathrm{s}}\ {\}}ua‾pl ← { s → 1.0 ui‾nterp s }{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {1.0}\ {{}^{\mathrm{u}}\mathrm{\underline{i}nterp}}\ {\mathrm{s}}\ {\}}
119u:a_pl "1 2 3 + 10"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"1 2 3 + 10"}}ua‾pl "1 2 3 + 10"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"1 2 3 + 10"}}
120u:a_pl "2 * 3 + 4" # right to left: 2 * 7{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"2 * 3 + 4"}}ua‾pl "2 * 3 + 4"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"2 * 3 + 4"}}
121u:a_pl "(2 * 3) + 4"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"(2 * 3) + 4"}}ua‾pl "(2 * 3) + 4"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"(2 * 3) + 4"}}
122u:a_pl "2*(3 + 4) - 10" # 2 * ((3 + 4) - 10){{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"2*(3 + 4) - 10"}}ua‾pl "2*(3 + 4) - 10"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"2*(3 + 4) - 10"}}
123u:a_pl "+/ i 10"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"+/ i 10"}}ua‾pl "+/ i 10"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"+/ i 10"}}
124u:a_pl "2 * i 5"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"2 * i 5"}}ua‾pl "2 * i 5"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"2 * i 5"}}
125u:a_pl "r i 4"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"r i 4"}}ua‾pl "r i 4"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"r i 4"}}
126u:a_pl "-/ 1 2 3" # 1 - (2 - 3){{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"-/ 1 2 3"}}ua‾pl "-/ 1 2 3"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"-/ 1 2 3"}}
127u:a_pl "1 % 4"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"1 \% 4"}}ua‾pl "1 % 4"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"1 \% 4"}}
128u:a_pl "(1 2 3 max 3 2 1) * -1"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"(1 2 3 max 3 2 1) * -1"}}ua‾pl "(1 2 3 max 3 2 1) * -1"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"(1 2 3 max 3 2 1) * -1"}}
129u:a_pl "*/ i 6" # 6 factorial{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"*/ i 6"}}ua‾pl "*/ i 6"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"*/ i 6"}}
130u:a_pl "+/ (i 5) * i 5" # 1 + 4 + 9 + 16 + 25{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"+/ (i 5) * i 5"}}ua‾pl "+/ (i 5) * i 5"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"+/ (i 5) * i 5"}}
131u:a_pl "2 4 pick 10 20 30 40"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"2 4 pick 10 20 30 40"}}ua‾pl "2 4 pick 10 20 30 40"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"2 4 pick 10 20 30 40"}}
132u:a_pl "10 20 30 iota 30 10 99"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"10 20 30 iota 30 10 99"}}ua‾pl "10 20 30 iota 30 10 99"{{}^{\mathrm{u}}\mathrm{\underline{a}pl}}\ {\text{"10 20 30 iota 30 10 99"}}
141u:s_how := { v -> '& r_/ v = f_loat f_loor v ? f_ormat f_loor v; f_ormat v }{{}^{\mathrm{u}}\mathrm{\underline{s}how}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}\ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}\ {=}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{f}loor}}\ {\mathrm{v}}\ {?}\ {\mathrm{\underline{f}ormat}}\ {\mathrm{\underline{f}loor}}\ {\mathrm{v}}{\diamond}\ {\mathrm{\underline{f}ormat}}\ {\mathrm{v}}\ {\}}us‾how ← { v → ’∧ r‾/ v = f‾loat f‾loor v ? f‾ormat f‾loor v⋄ f‾ormat v }{{}^{\mathrm{u}}\mathrm{\underline{s}how}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}\ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}\ {=}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{f}loor}}\ {\mathrm{v}}\ {?}\ {\mathrm{\underline{f}ormat}}\ {\mathrm{\underline{f}loor}}\ {\mathrm{v}}{\diamond}\ {\mathrm{\underline{f}ormat}}\ {\mathrm{v}}\ {\}}
142u:s_ay := { st text -> shown := p_rint! text; st }{{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{text}}\ {\to}\ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{text}}{\diamond}\ {\mathrm{st}}\ {\}}us‾ay ← { st text → shown ← p‾rint! text⋄ st }{{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{text}}\ {\to}\ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{text}}{\diamond}\ {\mathrm{st}}\ {\}}
143u:o_rigin := { st line ->{{}^{\mathrm{u}}\mathrm{\underline{o}rigin}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{line}}\ {\to}uo‾rigin ← { st line →{{}^{\mathrm{u}}\mathrm{\underline{o}rigin}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{line}}\ {\to}
144 x := 1 s_elect st\ \ {\mathrm{x}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{st}}  x ← 1 s‾elect st\ \ {\mathrm{x}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{st}}
145 o := 2 s_elect st\ \ {\mathrm{o}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{st}}  o ← 2 s‾elect st\ \ {\mathrm{o}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{st}}
146 v := n_umbers 7 d_rop line\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{n}umbers}}\ {7}\ {\mathrm{\underline{d}rop}}\ {\mathrm{line}}  v ← n‾umbers 7 d‾rop line\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{n}umbers}}\ {7}\ {\mathrm{\underline{d}rop}}\ {\mathrm{line}}
147 n_ot (7 t_ake line) m_atch ")ORIGIN" ? st u:s_ay "INCORRECT COMMAND"\ \ {\mathrm{\underline{n}ot}}\ {(}{7}\ {\mathrm{\underline{t}ake}}\ {\mathrm{line}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{")ORIGIN"}}\ {?}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\text{"INCORRECT COMMAND"}}  n‾ot (7 t‾ake line) m‾atch ")ORIGIN" ? st us‾ay "INCORRECT COMMAND"\ \ {\mathrm{\underline{n}ot}}\ {(}{7}\ {\mathrm{\underline{t}ake}}\ {\mathrm{line}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{")ORIGIN"}}\ {?}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\text{"INCORRECT COMMAND"}}
148 0 = t_ally v ? st u:s_ay "IS " c_at u:s_how o\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\text{"IS "}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}how}}\ {\mathrm{o}}  0 = t‾ally v ? st us‾ay "IS " c‾at us‾how o\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\text{"IS "}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}how}}\ {\mathrm{o}}
149 ok := (1 = t_ally v) & ((f_irst v) m_ember? 0.0 1.0) | (x = 1) & 0.5 = f_irst v\ \ {\mathrm{ok}}\ {\leftarrow}\ {(}{1}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {\wedge}\ {(}{(}{\mathrm{\underline{f}irst}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{m}ember}{?}}\ {0.0}\ {1.0}{)}\ {\vee}\ {(}{\mathrm{x}}\ {=}\ {1}{)}\ {\wedge}\ {0.5}\ {=}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}  ok ← (1 = t‾ally v) ∧ ((f‾irst v) m‾ember? 0.0 1.0) ∨ (x = 1) ∧ 0.5 = f‾irst v\ \ {\mathrm{ok}}\ {\leftarrow}\ {(}{1}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {\wedge}\ {(}{(}{\mathrm{\underline{f}irst}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{m}ember}{?}}\ {0.0}\ {1.0}{)}\ {\vee}\ {(}{\mathrm{x}}\ {=}\ {1}{)}\ {\wedge}\ {0.5}\ {=}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}
150 n_ot ok ? st u:s_ay "INCORRECT COMMAND"\ \ {\mathrm{\underline{n}ot}}\ {\mathrm{ok}}\ {?}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\text{"INCORRECT COMMAND"}}  n‾ot ok ? st us‾ay "INCORRECT COMMAND"\ \ {\mathrm{\underline{n}ot}}\ {\mathrm{ok}}\ {?}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\text{"INCORRECT COMMAND"}}
151 (x c_at f_irst v) u:s_ay "WAS " c_at u:s_how o\ \ {(}{\mathrm{x}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\text{"WAS "}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}how}}\ {\mathrm{o}}  (x c‾at f‾irst v) us‾ay "WAS " c‾at us‾how o\ \ {(}{\mathrm{x}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {\text{"WAS "}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}how}}\ {\mathrm{o}}
152}{\}}}{\}}
153u:l_ine := { st line ->{{}^{\mathrm{u}}\mathrm{\underline{l}ine}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{line}}\ {\to}ul‾ine ← { st line →{{}^{\mathrm{u}}\mathrm{\underline{l}ine}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{line}}\ {\to}
154 echo := p_rint! " " c_at line\ \ {\mathrm{echo}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{line}}  echo ← p‾rint! " " c‾at line\ \ {\mathrm{echo}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{line}}
155 (f_irst line) = f_irst ")" ? st u:o_rigin line\ \ {(}{\mathrm{\underline{f}irst}}\ {\mathrm{line}}{)}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{")"}}\ {?}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}rigin}}\ {\mathrm{line}}  (f‾irst line) = f‾irst ")" ? st uo‾rigin line\ \ {(}{\mathrm{\underline{f}irst}}\ {\mathrm{line}}{)}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{")"}}\ {?}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}rigin}}\ {\mathrm{line}}
156 st u:s_ay u:s_how (2 s_elect st) u:i_nterp line\ \ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}how}}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{st}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}nterp}}\ {\mathrm{line}}  st us‾ay us‾how (2 s‾elect st) ui‾nterp line\ \ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ay}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}how}}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{st}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}nterp}}\ {\mathrm{line}}
157}{\}}}{\}}
158u:s_ession := { st lines ->{{}^{\mathrm{u}}\mathrm{\underline{s}ession}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{lines}}\ {\to}us‾ession ← { st lines →{{}^{\mathrm{u}}\mathrm{\underline{s}ession}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{lines}}\ {\to}
159 0 = t_ally lines ? st\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{lines}}\ {?}\ {\mathrm{st}}  0 = t‾ally lines ? st\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{lines}}\ {?}\ {\mathrm{st}}
160 next := st u:l_ine d_isclose 1 s_elect lines\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ine}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{lines}}  next ← st ul‾ine d‾isclose 1 s‾elect lines\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{st}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ine}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{lines}}
161 next u:s_ession 1 d_rop lines\ \ {\mathrm{next}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ession}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{lines}}  next us‾ession 1 d‾rop lines\ \ {\mathrm{next}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ession}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{lines}}
162}{\}}}{\}}
165off := 0 1 u:s_ession "i 4" ")ORIGIN 0" "i 4" "1 pick 10 20 30" "10 20 30 iota 20" ")ORIGIN 0.5" ")ORIGIN" ")ORIGIN 1" "i 4"{\mathrm{off}}\ {\leftarrow}\ {0}\ {1}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ession}}\ {\text{"i 4"}}\ {\text{")ORIGIN 0"}}\ {\text{"i 4"}}\ {\text{"1 pick 10 20 30"}}\ {\text{"10 20 30 iota 20"}}\ {\text{")ORIGIN 0.5"}}\ {\text{")ORIGIN"}}\ {\text{")ORIGIN 1"}}\ {\text{"i 4"}}off ← 0 1 us‾ession "i 4" ")ORIGIN 0" "i 4" "1 pick 10 20 30" "10 20 30 iota 20" ")ORIGIN 0.5" ")ORIGIN" ")ORIGIN 1" "i 4"{\mathrm{off}}\ {\leftarrow}\ {0}\ {1}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ession}}\ {\text{"i 4"}}\ {\text{")ORIGIN 0"}}\ {\text{"i 4"}}\ {\text{"1 pick 10 20 30"}}\ {\text{"10 20 30 iota 20"}}\ {\text{")ORIGIN 0.5"}}\ {\text{")ORIGIN"}}\ {\text{")ORIGIN 1"}}\ {\text{"i 4"}}
172on := 1 1 u:s_ession ")ORIGIN 0.5" "i 4" "+/ i 4" "0.5 1.5 pick 10 20 30 40" "1 2 pick 10 20 30 40" "10 20 30 iota 30 10 99" "(i 3) pick 10 20 30" ")ORIGIN 1" "i 4"{\mathrm{on}}\ {\leftarrow}\ {1}\ {1}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ession}}\ {\text{")ORIGIN 0.5"}}\ {\text{"i 4"}}\ {\text{"+/ i 4"}}\ {\text{"0.5 1.5 pick 10 20 30 40"}}\ {\text{"1 2 pick 10 20 30 40"}}\ {\text{"10 20 30 iota 30 10 99"}}\ {\text{"(i 3) pick 10 20 30"}}\ {\text{")ORIGIN 1"}}\ {\text{"i 4"}}on ← 1 1 us‾ession ")ORIGIN 0.5" "i 4" "+/ i 4" "0.5 1.5 pick 10 20 30 40" "1 2 pick 10 20 30 40" "10 20 30 iota 30 10 99" "(i 3) pick 10 20 30" ")ORIGIN 1" "i 4"{\mathrm{on}}\ {\leftarrow}\ {1}\ {1}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ession}}\ {\text{")ORIGIN 0.5"}}\ {\text{"i 4"}}\ {\text{"+/ i 4"}}\ {\text{"0.5 1.5 pick 10 20 30 40"}}\ {\text{"1 2 pick 10 20 30 40"}}\ {\text{"10 20 30 iota 30 10 99"}}\ {\text{"(i 3) pick 10 20 30"}}\ {\text{")ORIGIN 1"}}\ {\text{"i 4"}}

demos/classics/pascal.xtl

11u:n_ext := { _r + -1 o_- _r }{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {\_\mathrm{r}}\ {\}}un‾ext ← { _r + −1 o‾− _r }{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {\_\mathrm{r}}\ {\}}
12u:n_ext 1 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {1}\ {0}\ {0}\ {0}\ {0}un‾ext 1 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {1}\ {0}\ {0}\ {0}\ {0}
13u:n_ext^4 1 0 0 0 0 # a superscript repeats a function: row 5{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}^{4}\ {1}\ {0}\ {0}\ {0}\ {0}un‾ext4 1 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}^{4}\ {1}\ {0}\ {0}\ {0}\ {0}
17u:r_ows := { n r ->{{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{r}}\ {\to}ur‾ows ← { n r →{{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{r}}\ {\to}
18 n = 1 ? (1 c_at s_hape r) r_eshape r\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{r}}  n = 1 ? (1 c‾at s‾hape r) r‾eshape r\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{r}}
19 r c_at (n - 1) u:r_ows u:n_ext r\ \ {\mathrm{r}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\mathrm{r}}  r c‾at (n − 1) ur‾ows un‾ext r\ \ {\mathrm{r}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\mathrm{r}}
20}{\}}}{\}}
217 u:r_ows 7 t_ake 1{7}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {7}\ {\mathrm{\underline{t}ake}}\ {1}7 ur‾ows 7 t‾ake 1{7}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {7}\ {\mathrm{\underline{t}ake}}\ {1}
27u:f_act := ['* r_/ r_ange] # the empty product is 1, so 0 gives 1{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {[}{\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{r}ange}}{]}uf‾act ← [’× r‾/ r‾ange]{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {[}{\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{r}ange}}{]}
28u:c_hoose := { k n -> k > n ? 0; (u:f_act n) d_iv (u:f_act k) * u:f_act n - k }{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{n}}\ {\to}\ {\mathrm{k}}\ {>}\ {\mathrm{n}}\ {?}\ {0}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{d}iv}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{k}}{)}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {\mathrm{k}}\ {\}}uc‾hoose ← { k n → k > n ? 0⋄ (uf‾act n) d‾iv (uf‾act k) × uf‾act n − k }{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{n}}\ {\to}\ {\mathrm{k}}\ {>}\ {\mathrm{n}}\ {?}\ {0}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{d}iv}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{k}}{)}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {\mathrm{k}}\ {\}}
292 u:c_hoose 5{2}\ {{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {5}2 uc‾hoose 5{2}\ {{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {5}
30(o_ffsets 7) 'u:c_hoose t_able o_ffsets 7{(}{\mathrm{\underline{o}ffsets}}\ {7}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{o}ffsets}}\ {7}(o‾ffsets 7) ’uc‾hoose t‾able o‾ffsets 7{(}{\mathrm{\underline{o}ffsets}}\ {7}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{o}ffsets}}\ {7}
36u:l_ine := { w r ->{{}^{\mathrm{u}}\mathrm{\underline{l}ine}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\mathrm{r}}\ {\to}ul‾ine ← { w r →{{}^{\mathrm{u}}\mathrm{\underline{l}ine}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\mathrm{r}}\ {\to}
37 text := f_ormat (w_here r > 0) s_elect r\ \ {\mathrm{text}}\ {\leftarrow}\ {\mathrm{\underline{f}ormat}}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{r}}\ {>}\ {0}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}  text ← f‾ormat (w‾here r > 0) s‾elect r\ \ {\mathrm{text}}\ {\leftarrow}\ {\mathrm{\underline{f}ormat}}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{r}}\ {>}\ {0}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}
38 pad := (w - t_ally text) d_iv 2\ \ {\mathrm{pad}}\ {\leftarrow}\ {(}{\mathrm{w}}\ {-}\ {\mathrm{\underline{t}ally}}\ {\mathrm{text}}{)}\ {\mathrm{\underline{d}iv}}\ {2}  pad ← (w − t‾ally text) d‾iv 2\ \ {\mathrm{pad}}\ {\leftarrow}\ {(}{\mathrm{w}}\ {-}\ {\mathrm{\underline{t}ally}}\ {\mathrm{text}}{)}\ {\mathrm{\underline{d}iv}}\ {2}
39 w t_ake (0 - pad + t_ally text) t_ake text\ \ {\mathrm{w}}\ {\mathrm{\underline{t}ake}}\ {(}{0}\ {-}\ {\mathrm{pad}}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{text}}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{text}}  w t‾ake (0 − pad + t‾ally text) t‾ake text\ \ {\mathrm{w}}\ {\mathrm{\underline{t}ake}}\ {(}{0}\ {-}\ {\mathrm{pad}}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{text}}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{text}}
40}{\}}}{\}}
41u:t_riangle := { n r ->{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{r}}\ {\to}ut‾riangle ← { n r →{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{r}}\ {\to}
42 w := 3 * t_ally r\ \ {\mathrm{w}}\ {\leftarrow}\ {3}\ {\times}\ {\mathrm{\underline{t}ally}}\ {\mathrm{r}}  w ← 3 × t‾ally r\ \ {\mathrm{w}}\ {\leftarrow}\ {3}\ {\times}\ {\mathrm{\underline{t}ally}}\ {\mathrm{r}}
43 n = 0 ? (0 c_at w) r_eshape " "\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {(}{0}\ {\mathrm{\underline{c}at}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{" "}}  n = 0 ? (0 c‾at w) r‾eshape " "\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {(}{0}\ {\mathrm{\underline{c}at}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{" "}}
44 (w u:l_ine r) c_at (n - 1) u:t_riangle u:n_ext r\ \ {(}{\mathrm{w}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ine}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\mathrm{r}}  (w ul‾ine r) c‾at (n − 1) ut‾riangle un‾ext r\ \ {(}{\mathrm{w}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ine}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\mathrm{r}}
45}{\}}}{\}}
467 u:t_riangle 7 t_ake 1{7}\ {{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {7}\ {\mathrm{\underline{t}ake}}\ {1}7 ut‾riangle 7 t‾ake 1{7}\ {{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {7}\ {\mathrm{\underline{t}ake}}\ {1}
51(1 + (16 u:r_ows 16 t_ake 1) m_od 2) s_elect " *"{(}{1}\ {+}\ {(}{16}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {16}\ {\mathrm{\underline{t}ake}}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {2}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" *"}}(1 + (16 ur‾ows 16 t‾ake 1) m‾od 2) s‾elect " *"{(}{1}\ {+}\ {(}{16}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {16}\ {\mathrm{\underline{t}ake}}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {2}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" *"}}
57sierpinski := []S_HOW []G_RID (32 u:r_ows 32 t_ake 1) m_od 2{\mathrm{sierpinski}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{32}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {32}\ {\mathrm{\underline{t}ake}}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {2}sierpinski ← □S‾HOW □G‾RID (32 ur‾ows 32 t‾ake 1) m‾od 2{\mathrm{sierpinski}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{32}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {32}\ {\mathrm{\underline{t}ake}}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {2}
58binomials := []S_HOW []G_RID (o_ffsets 12) 'u:c_hoose t_able o_ffsets 12{\mathrm{binomials}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{\mathrm{\underline{o}ffsets}}\ {12}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{o}ffsets}}\ {12}binomials ← □S‾HOW □G‾RID (o‾ffsets 12) ’uc‾hoose t‾able o‾ffsets 12{\mathrm{binomials}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{\mathrm{\underline{o}ffsets}}\ {12}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{o}ffsets}}\ {12}
64rows := '{ k -> (o_ffsets k) 'u:c_hoose e_ach k - 1 } m_ap r_ange 7{\mathrm{rows}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{o}ffsets}}\ {\mathrm{k}}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{k}}\ {-}\ {1}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {7}rows ← ’{ k → (o‾ffsets k) ’uc‾hoose e‾ach k − 1 } m‾ap r‾ange 7{\mathrm{rows}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{o}ffsets}}\ {\mathrm{k}}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{c}hoose}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{k}}\ {-}\ {1}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {7}
657 1 r_eshape rows{7}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{rows}}7 1 r‾eshape rows{7}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{rows}}
66'['+ r_/ d_isclose] e_ach rows # each row sums to a power of 2{\text{'}}{[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\mathrm{rows}}’[’+ r‾/ d‾isclose] e‾ach rows{\text{'}}{[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\mathrm{rows}}

demos/classics/primes.xtl

5a := r_ange 12{\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {12}a ← r‾ange 12{\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {12}
6a 'm_od t_able a # row i: i modulo 1, 2, ..., 12{\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}a ’m‾od t‾able a{\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}
70 = a 'm_od t_able a # 1 where the column divides the row{0}\ {=}\ {\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}0 = a ’m‾od t‾able a{0}\ {=}\ {\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}
10u:d_ivisors := { a -> '+ r_/_2 0 = a 'm_od t_able a }{{}^{\mathrm{u}}\mathrm{\underline{d}ivisors}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\to}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}\ {\}}ud‾ivisors ← { a → ’+ r‾/2 0 = a ’m‾od t‾able a }{{}^{\mathrm{u}}\mathrm{\underline{d}ivisors}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\to}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}\ {\}}
11u:d_ivisors r_ange 12{{}^{\mathrm{u}}\mathrm{\underline{d}ivisors}}\ {\mathrm{\underline{r}ange}}\ {12}ud‾ivisors r‾ange 12{{}^{\mathrm{u}}\mathrm{\underline{d}ivisors}}\ {\mathrm{\underline{r}ange}}\ {12}
14u:p_rimes := { n -> a := r_ange n; (w_here 2 = u:d_ivisors a) s_elect a }{{}^{\mathrm{u}}\mathrm{\underline{p}rimes}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}{\diamond}\ {(}{\mathrm{\underline{w}here}}\ {2}\ {=}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ivisors}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{a}}\ {\}}up‾rimes ← { n → a ← r‾ange n⋄ (w‾here 2 = ud‾ivisors a) s‾elect a }{{}^{\mathrm{u}}\mathrm{\underline{p}rimes}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}{\diamond}\ {(}{\mathrm{\underline{w}here}}\ {2}\ {=}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ivisors}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{a}}\ {\}}
15u:p_rimes 50{{}^{\mathrm{u}}\mathrm{\underline{p}rimes}}\ {50}up‾rimes 50{{}^{\mathrm{u}}\mathrm{\underline{p}rimes}}\ {50}
19u:p_roperSum := { n -> a := r_ange n - 1; '+ r_/ (w_here 0 = n m_od a) s_elect a }{{}^{\mathrm{u}}\mathrm{\underline{p}roperSum}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {-}\ {1}{\diamond}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{w}here}}\ {0}\ {=}\ {\mathrm{n}}\ {\mathrm{\underline{m}od}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{a}}\ {\}}up‾roperSum ← { n → a ← r‾ange n − 1⋄ ’+ r‾/ (w‾here 0 = n m‾od a) s‾elect a }{{}^{\mathrm{u}}\mathrm{\underline{p}roperSum}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {-}\ {1}{\diamond}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{w}here}}\ {0}\ {=}\ {\mathrm{n}}\ {\mathrm{\underline{m}od}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{a}}\ {\}}
20'u:p_roperSum e_ach 6 28 12{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{p}roperSum}}\ {\mathrm{\underline{e}ach}}\ {6}\ {28}\ {12}’up‾roperSum e‾ach 6 28 12{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{p}roperSum}}\ {\mathrm{\underline{e}ach}}\ {6}\ {28}\ {12}

demos/classics/queens.xtl

9u:e_xtend := { n P ->{{}^{\mathrm{u}}\mathrm{\underline{e}xtend}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{P}}\ {\to}ue‾xtend ← { n P →{{}^{\mathrm{u}}\mathrm{\underline{e}xtend}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{P}}\ {\to}
10 m := t_ally P\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{P}}  m ← t‾ally P\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{P}}
11 k := 1 + f_irst 1 d_rop s_hape P\ \ {\mathrm{k}}\ {\leftarrow}\ {1}\ {+}\ {\mathrm{\underline{f}irst}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{P}}  k ← 1 + f‾irst 1 d‾rop s‾hape P\ \ {\mathrm{k}}\ {\leftarrow}\ {1}\ {+}\ {\mathrm{\underline{f}irst}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{P}}
12 M := (n r_eplicate P) c_at_2 (m * n) r_eshape r_ange n\ \ {\mathrm{M}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{P}}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {(}{\mathrm{m}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  M ← (n r‾eplicate P) c‾at2 (m × n) r‾eshape r‾ange n\ \ {\mathrm{M}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{P}}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {(}{\mathrm{m}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
13 c := -1 t_ake_2 M # the new queen's column\ \ {\mathrm{c}}\ {\leftarrow}\ {-1}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{M}}  c ← −1 t‾ake2 M\ \ {\mathrm{c}}\ {\leftarrow}\ {-1}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{M}}
14 Q := -1 d_rop_2 M # the earlier ones\ \ {\mathrm{Q}}\ {\leftarrow}\ {-1}\ {{\mathrm{\underline{d}rop}}_{2}}\ {\mathrm{M}}  Q ← −1 d‾rop2 M\ \ {\mathrm{Q}}\ {\leftarrow}\ {-1}\ {{\mathrm{\underline{d}rop}}_{2}}\ {\mathrm{M}}
15 C := (k - 1) r_eplicate_2 c # the new column beside each\ \ {\mathrm{C}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {-}\ {1}{)}\ {{\mathrm{\underline{r}eplicate}}_{2}}\ {\mathrm{c}}  C ← (k − 1) r‾eplicate2 c\ \ {\mathrm{C}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {-}\ {1}{)}\ {{\mathrm{\underline{r}eplicate}}_{2}}\ {\mathrm{c}}
16 d := ((m * n) c_at k - 1) r_eshape k - r_ange k - 1 # rows apart\ \ {\mathrm{d}}\ {\leftarrow}\ {(}{(}{\mathrm{m}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{k}}\ {-}\ {\mathrm{\underline{r}ange}}\ {\mathrm{k}}\ {-}\ {1}  d ← ((m × n) c‾at k − 1) r‾eshape k − r‾ange k − 1\ \ {\mathrm{d}}\ {\leftarrow}\ {(}{(}{\mathrm{m}}\ {\times}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{k}}\ {-}\ {\mathrm{\underline{r}ange}}\ {\mathrm{k}}\ {-}\ {1}
17 (n_ot '| r_/_2 (Q = C) | d = a_bs Q - C) r_eplicate M\ \ {(}{\mathrm{\underline{n}ot}}\ {\text{'}}{\vee}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{Q}}\ {=}\ {\mathrm{C}}{)}\ {\vee}\ {\mathrm{d}}\ {=}\ {\mathrm{\underline{a}bs}}\ {\mathrm{Q}}\ {-}\ {\mathrm{C}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{M}}  (n‾ot ’∨ r‾/2 (Q = C) ∨ d = a‾bs Q − C) r‾eplicate M\ \ {(}{\mathrm{\underline{n}ot}}\ {\text{'}}{\vee}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{Q}}\ {=}\ {\mathrm{C}}{)}\ {\vee}\ {\mathrm{d}}\ {=}\ {\mathrm{\underline{a}bs}}\ {\mathrm{Q}}\ {-}\ {\mathrm{C}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{M}}
18}{\}}}{\}}
19u:p_lace := { n k ->{{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{k}}\ {\to}up‾lace ← { n k →{{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{k}}\ {\to}
20 k = 1 ? (n c_at 1) r_eshape r_ange n\ \ {\mathrm{k}}\ {=}\ {1}\ {?}\ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {1}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  k = 1 ? (n c‾at 1) r‾eshape r‾ange n\ \ {\mathrm{k}}\ {=}\ {1}\ {?}\ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {1}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
21 n u:e_xtend n u:p_lace k - 1\ \ {\mathrm{n}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}xtend}}\ {\mathrm{n}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {\mathrm{k}}\ {-}\ {1}  n ue‾xtend n up‾lace k − 1\ \ {\mathrm{n}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}xtend}}\ {\mathrm{n}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {\mathrm{k}}\ {-}\ {1}
22}{\}}}{\}}
234 u:p_lace 4{4}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {4}4 up‾lace 4{4}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {4}
24'{ t_ally _r u:p_lace _r } e_ach 1 2 3 4 5 6 7 8 # solutions for n = 1..8{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}\ {7}\ {8}’{ t‾ally _r up‾lace _r } e‾ach 1 2 3 4 5 6 7 8{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}\ {7}\ {8}
28s := 6 u:p_lace 6{\mathrm{s}}\ {\leftarrow}\ {6}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {6}s ← 6 up‾lace 6{\mathrm{s}}\ {\leftarrow}\ {6}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {6}
29(r_ange t_ally s) p_artition s{(}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}(r‾ange t‾ally s) p‾artition s{(}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}
30'{ r -> (1 + (r_avel d_isclose r) '= t_able r_ange 6) s_elect ".Q" } m_ap (r_ange t_ally s) p_artition s{\text{'}}{\{}\ {\mathrm{r}}\ {\to}\ {(}{1}\ {+}\ {(}{\mathrm{\underline{r}avel}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{r}}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {\mathrm{\underline{s}elect}}\ {\text{".Q"}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}’{ r → (1 + (r‾avel d‾isclose r) ’= t‾able r‾ange 6) s‾elect ".Q" } m‾ap (r‾ange t‾ally s) p‾artition s{\text{'}}{\{}\ {\mathrm{r}}\ {\to}\ {(}{1}\ {+}\ {(}{\mathrm{\underline{r}avel}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{r}}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {\mathrm{\underline{s}elect}}\ {\text{".Q"}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}
33e := 8 u:p_lace 8{\mathrm{e}}\ {\leftarrow}\ {8}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {8}e ← 8 up‾lace 8{\mathrm{e}}\ {\leftarrow}\ {8}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lace}}\ {8}
34shown := []S_HOW []G_RID e '= t_able r_ange 8{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{e}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {8}shown ← □S‾HOW □G‾RID e ’= t‾able r‾ange 8{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{e}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {8}

demos/classics/quicksort.xtl

6u:q_sort := { v ->{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}uq‾sort ← { v →{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}
7 2 > t_ally v ? v\ \ {2}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}  2 > t‾ally v ? v\ \ {2}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}
8 p := f_irst v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}  p ← f‾irst v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}
9 below := (w_here v < p) s_elect v\ \ {\mathrm{below}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {<}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}  below ← (w‾here v < p) s‾elect v\ \ {\mathrm{below}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {<}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
10 same := (w_here v = p) s_elect v\ \ {\mathrm{same}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {=}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}  same ← (w‾here v = p) s‾elect v\ \ {\mathrm{same}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {=}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
11 above := (w_here v > p) s_elect v\ \ {\mathrm{above}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}  above ← (w‾here v > p) s‾elect v\ \ {\mathrm{above}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
12 (u:q_sort below) c_at same c_at u:q_sort above\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{below}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{same}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{above}}  (uq‾sort below) c‾at same c‾at uq‾sort above\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{below}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{same}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{above}}
13}{\}}}{\}}
14u:q_sort 3 1 4 1 5 9 2 6 5 3 5{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}uq‾sort 3 1 4 1 5 9 2 6 5 3 5{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}
15u:q_sort "the quick brown fox" # characters compare in ASCII order{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\text{"the quick brown fox"}}uq‾sort "the quick brown fox"{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\text{"the quick brown fox"}}
18v := 3 1 4 1 5 9 2 6 5 3 5{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}v ← 3 1 4 1 5 9 2 6 5 3 5{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}
19v < 3{\mathrm{v}}\ {<}\ {3}v < 3{\mathrm{v}}\ {<}\ {3}
20v > 3{\mathrm{v}}\ {>}\ {3}v > 3{\mathrm{v}}\ {>}\ {3}
24r := r_oll! 50 r_eshape 100{\mathrm{r}}\ {\leftarrow}\ {\mathrm{\underline{r}oll}{!}}\ {50}\ {\mathrm{\underline{r}eshape}}\ {100}r ← r‾oll! 50 r‾eshape 100{\mathrm{r}}\ {\leftarrow}\ {\mathrm{\underline{r}oll}{!}}\ {50}\ {\mathrm{\underline{r}eshape}}\ {100}
25(u:q_sort r) m_atch s_ort r{(}{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{s}ort}}\ {\mathrm{r}}(uq‾sort r) m‾atch s‾ort r{(}{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{s}ort}}\ {\mathrm{r}}
28g_rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}g‾rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}
29(g_rade v) s_elect v{(}{\mathrm{\underline{g}rade}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}(g‾rade v) s‾elect v{(}{\mathrm{\underline{g}rade}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}

demos/classics/rle.xtl

6v := "aaabccddddde"{\mathrm{v}}\ {\leftarrow}\ {\text{"aaabccddddde"}}v ← "aaabccddddde"{\mathrm{v}}\ {\leftarrow}\ {\text{"aaabccddddde"}}
7starts := 1 c_at (1 d_rop v) != -1 d_rop v{\mathrm{starts}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {\neq}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}starts ← 1 c‾at (1 d‾rop v) ≠ −1 d‾rop v{\mathrm{starts}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {\neq}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}
8starts # 1 where a run begins{\mathrm{starts}}starts{\mathrm{starts}}
9p := w_here starts{\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{starts}}p ← w‾here starts{\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{starts}}
10p s_elect v # the items{\mathrm{p}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}p s‾elect v{\mathrm{p}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
11((1 d_rop p) c_at 1 + t_ally v) - p # the lengths{(}{(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {-}\ {\mathrm{p}}((1 d‾rop p) c‾at 1 + t‾ally v) − p{(}{(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {-}\ {\mathrm{p}}
14u:r_le := { v ->{{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}ur‾le ← { v →{{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}
15 p := w_here 1 c_at (1 d_rop v) != -1 d_rop v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {\neq}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}  p ← w‾here 1 c‾at (1 d‾rop v) ≠ −1 d‾rop v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {\neq}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}
16 lengths := ((1 d_rop p) c_at 1 + t_ally v) - p\ \ {\mathrm{lengths}}\ {\leftarrow}\ {(}{(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {-}\ {\mathrm{p}}  lengths ← ((1 d‾rop p) c‾at 1 + t‾ally v) − p\ \ {\mathrm{lengths}}\ {\leftarrow}\ {(}{(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {-}\ {\mathrm{p}}
17 (2 c_at t_ally p) r_eshape (p s_elect v) c_at lengths\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{\mathrm{p}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{lengths}}  (2 c‾at t‾ally p) r‾eshape (p s‾elect v) c‾at lengths\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{\mathrm{p}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{lengths}}
18}{\}}}{\}}
19u:r_le 5 5 5 2 2 7 7 7 7 1{{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {5}\ {5}\ {5}\ {2}\ {2}\ {7}\ {7}\ {7}\ {7}\ {1}ur‾le 5 5 5 2 2 7 7 7 7 1{{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {5}\ {5}\ {5}\ {2}\ {2}\ {7}\ {7}\ {7}\ {7}\ {1}
223 1 2 5 1 r_eplicate "abcde" # the runs above, decoded{3}\ {1}\ {2}\ {5}\ {1}\ {\mathrm{\underline{r}eplicate}}\ {\text{"abcde"}}3 1 2 5 1 r‾eplicate "abcde"{3}\ {1}\ {2}\ {5}\ {1}\ {\mathrm{\underline{r}eplicate}}\ {\text{"abcde"}}
23u:r_ld := { r -> (2 s_elect r) r_eplicate 1 s_elect r }{{}^{\mathrm{u}}\mathrm{\underline{r}ld}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}\ {\}}ur‾ld ← { r → (2 s‾elect r) r‾eplicate 1 s‾elect r }{{}^{\mathrm{u}}\mathrm{\underline{r}ld}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}\ {\}}
24u:r_ld u:r_le 5 5 5 2 2 7 7 7 7 1{{}^{\mathrm{u}}\mathrm{\underline{r}ld}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {5}\ {5}\ {5}\ {2}\ {2}\ {7}\ {7}\ {7}\ {7}\ {1}ur‾ld ur‾le 5 5 5 2 2 7 7 7 7 1{{}^{\mathrm{u}}\mathrm{\underline{r}ld}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {5}\ {5}\ {5}\ {2}\ {2}\ {7}\ {7}\ {7}\ {7}\ {1}
25w := 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1{\mathrm{w}}\ {\leftarrow}\ {1}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}w ← 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1{\mathrm{w}}\ {\leftarrow}\ {1}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}
26(u:r_ld u:r_le w) m_atch w{(}{{}^{\mathrm{u}}\mathrm{\underline{r}ld}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{w}}(ur‾ld ur‾le w) m‾atch w{(}{{}^{\mathrm{u}}\mathrm{\underline{r}ld}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{w}}
29tosses := 1 1 0 1 1 1 1 0 0 1 0 1 1 1 0{\mathrm{tosses}}\ {\leftarrow}\ {1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {1}\ {0}\ {0}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}tosses ← 1 1 0 1 1 1 1 0 0 1 0 1 1 1 0{\mathrm{tosses}}\ {\leftarrow}\ {1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {1}\ {0}\ {0}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}
30runs := u:r_le tosses{\mathrm{runs}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {\mathrm{tosses}}runs ← ur‾le tosses{\mathrm{runs}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{r}le}}\ {\mathrm{tosses}}
31'm_ax r_/ (w_here 1 = 1 s_elect runs) s_elect 2 s_elect runs{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{w}here}}\ {1}\ {=}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{runs}}{)}\ {\mathrm{\underline{s}elect}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{runs}}’m‾ax r‾/ (w‾here 1 = 1 s‾elect runs) s‾elect 2 s‾elect runs{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{w}here}}\ {1}\ {=}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{runs}}{)}\ {\mathrm{\underline{s}elect}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{runs}}

demos/classics/roman.xtl

7d := 10 10 10 10 e_ncode 1994{\mathrm{d}}\ {\leftarrow}\ {10}\ {10}\ {10}\ {10}\ {\mathrm{\underline{e}ncode}}\ {1994}d ← 10 10 10 10 e‾ncode 1994{\mathrm{d}}\ {\leftarrow}\ {10}\ {10}\ {10}\ {10}\ {\mathrm{\underline{e}ncode}}\ {1994}
8d{\mathrm{d}}d{\mathrm{d}}
11p := 10 4 r_eshape 0 0 0 0 1 0 0 0 1 1 0 0 1 1 1 0 1 2 0 0 2 0 0 0 2 1 0 0 2 1 1 0 2 1 1 1 1 3 0 0{\mathrm{p}}\ {\leftarrow}\ {10}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {0}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}\ {2}\ {0}\ {0}\ {2}\ {0}\ {0}\ {0}\ {2}\ {1}\ {0}\ {0}\ {2}\ {1}\ {1}\ {0}\ {2}\ {1}\ {1}\ {1}\ {1}\ {3}\ {0}\ {0}p ← 10 4 r‾eshape 0 0 0 0 1 0 0 0 1 1 0 0 1 1 1 0 1 2 0 0 2 0 0 0 2 1 0 0 2 1 1 0 2 1 1 1 1 3 0 0{\mathrm{p}}\ {\leftarrow}\ {10}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {0}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}\ {2}\ {0}\ {0}\ {2}\ {0}\ {0}\ {0}\ {2}\ {1}\ {0}\ {0}\ {2}\ {1}\ {1}\ {0}\ {2}\ {1}\ {1}\ {1}\ {1}\ {3}\ {0}\ {0}
12p{\mathrm{p}}p{\mathrm{p}}
13k := (1 + d) s_elect p # one row of positions per place{\mathrm{k}}\ {\leftarrow}\ {(}{1}\ {+}\ {\mathrm{d}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}k ← (1 + d) s‾elect p{\mathrm{k}}\ {\leftarrow}\ {(}{1}\ {+}\ {\mathrm{d}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
14k{\mathrm{k}}k{\mathrm{k}}
15letters := "M CDMXLCIVX" # one, five, ten for each place{\mathrm{letters}}\ {\leftarrow}\ {\text{"M CDMXLCIVX"}}letters ← "M CDMXLCIVX"{\mathrm{letters}}\ {\leftarrow}\ {\text{"M CDMXLCIVX"}}
16at := k + 3 * (r_ange 4) '- t_able 4 r_eshape 1{\mathrm{at}}\ {\leftarrow}\ {\mathrm{k}}\ {+}\ {3}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {4}{)}\ {\text{'}}{-}\ {\mathrm{\underline{t}able}}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}at ← k + 3 × (r‾ange 4) ’− t‾able 4 r‾eshape 1{\mathrm{at}}\ {\leftarrow}\ {\mathrm{k}}\ {+}\ {3}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {4}{)}\ {\text{'}}{-}\ {\mathrm{\underline{t}able}}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}
17((r_avel 0 < k) r_eplicate r_avel at) s_elect letters{(}{(}{\mathrm{\underline{r}avel}}\ {0}\ {<}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{at}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{letters}}((r‾avel 0 < k) r‾eplicate r‾avel at) s‾elect letters{(}{(}{\mathrm{\underline{r}avel}}\ {0}\ {<}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{at}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{letters}}
19u:r_oman := { n ->{{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}ur‾oman ← { n →{{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
20 k := (1 + 10 10 10 10 e_ncode n) s_elect p\ \ {\mathrm{k}}\ {\leftarrow}\ {(}{1}\ {+}\ {10}\ {10}\ {10}\ {10}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}  k ← (1 + 10 10 10 10 e‾ncode n) s‾elect p\ \ {\mathrm{k}}\ {\leftarrow}\ {(}{1}\ {+}\ {10}\ {10}\ {10}\ {10}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
21 at := k + 3 * (r_ange 4) '- t_able 4 r_eshape 1\ \ {\mathrm{at}}\ {\leftarrow}\ {\mathrm{k}}\ {+}\ {3}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {4}{)}\ {\text{'}}{-}\ {\mathrm{\underline{t}able}}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}  at ← k + 3 × (r‾ange 4) ’− t‾able 4 r‾eshape 1\ \ {\mathrm{at}}\ {\leftarrow}\ {\mathrm{k}}\ {+}\ {3}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {4}{)}\ {\text{'}}{-}\ {\mathrm{\underline{t}able}}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}
22 ((r_avel 0 < k) r_eplicate r_avel at) s_elect letters\ \ {(}{(}{\mathrm{\underline{r}avel}}\ {0}\ {<}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{at}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{letters}}  ((r‾avel 0 < k) r‾eplicate r‾avel at) s‾elect letters\ \ {(}{(}{\mathrm{\underline{r}avel}}\ {0}\ {<}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{at}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{letters}}
23}{\}}}{\}}
24u:r_oman 2026{{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {2026}ur‾oman 2026{{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {2026}
25u:r_oman 3999{{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {3999}ur‾oman 3999{{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {3999}
26u:r_oman 444{{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {444}ur‾oman 444{{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {444}
29u:v_alue := { s ->{{}^{\mathrm{u}}\mathrm{\underline{v}alue}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}uv‾alue ← { s →{{}^{\mathrm{u}}\mathrm{\underline{v}alue}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
30 v := ("IVXLCDM" i_ndexOf s) s_elect 1 5 10 50 100 500 1000\ \ {\mathrm{v}}\ {\leftarrow}\ {(}{\text{"IVXLCDM"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {1}\ {5}\ {10}\ {50}\ {100}\ {500}\ {1000}  v ← ("IVXLCDM" i‾ndexOf s) s‾elect 1 5 10 50 100 500 1000\ \ {\mathrm{v}}\ {\leftarrow}\ {(}{\text{"IVXLCDM"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {1}\ {5}\ {10}\ {50}\ {100}\ {500}\ {1000}
31 '+ r_/ v * 1 - 2 * v < (1 d_rop v) c_at 0\ \ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}\ {\times}\ {1}\ {-}\ {2}\ {\times}\ {\mathrm{v}}\ {<}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{c}at}}\ {0}  ’+ r‾/ v × 1 − 2 × v < (1 d‾rop v) c‾at 0\ \ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}\ {\times}\ {1}\ {-}\ {2}\ {\times}\ {\mathrm{v}}\ {<}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{c}at}}\ {0}
32}{\}}}{\}}
33u:v_alue "MCMXCIV"{{}^{\mathrm{u}}\mathrm{\underline{v}alue}}\ {\text{"MCMXCIV"}}uv‾alue "MCMXCIV"{{}^{\mathrm{u}}\mathrm{\underline{v}alue}}\ {\text{"MCMXCIV"}}
34u:v_alue "MMXXVI"{{}^{\mathrm{u}}\mathrm{\underline{v}alue}}\ {\text{"MMXXVI"}}uv‾alue "MMXXVI"{{}^{\mathrm{u}}\mathrm{\underline{v}alue}}\ {\text{"MMXXVI"}}
37'& r_/ '{ _r = u:v_alue u:r_oman _r } e_ach r_ange 3999{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {=}\ {{}^{\mathrm{u}}\mathrm{\underline{v}alue}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {3999}’∧ r‾/ ’{ _r = uv‾alue ur‾oman _r } e‾ach r‾ange 3999{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {=}\ {{}^{\mathrm{u}}\mathrm{\underline{v}alue}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}oman}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {3999}

demos/classics/sequences.xtl

10c := 1 -3 0 2{\mathrm{c}}\ {\leftarrow}\ {1}\ {-3}\ {0}\ {2}c ← 1 −3 0 2{\mathrm{c}}\ {\leftarrow}\ {1}\ {-3}\ {0}\ {2}
11u:h_orner := { c x -> '{ a b -> a + x * b } r_/ c }{{}^{\mathrm{u}}\mathrm{\underline{h}orner}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{x}}\ {\to}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {+}\ {\mathrm{x}}\ {\times}\ {\mathrm{b}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{c}}\ {\}}uh‾orner ← { c x → ’{ a b → a + x × b } r‾/ c }{{}^{\mathrm{u}}\mathrm{\underline{h}orner}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{x}}\ {\to}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {+}\ {\mathrm{x}}\ {\times}\ {\mathrm{b}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{c}}\ {\}}
12c u:h_orner 2{\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}orner}}\ {2}c uh‾orner 2{\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}orner}}\ {2}
13c u:h_orner -2 -1 0 1 2 3{\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}orner}}\ {-2}\ {-1}\ {0}\ {1}\ {2}\ {3}c uh‾orner −2 −1 0 1 2 3{\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}orner}}\ {-2}\ {-1}\ {0}\ {1}\ {2}\ {3}
16u:b_yPowers := { c x -> '+ r_/ c * x ^ o_ffsets t_ally c }{{}^{\mathrm{u}}\mathrm{\underline{b}yPowers}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{x}}\ {\to}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{c}}\ {\times}\ {\mathrm{x}}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{c}}\ {\}}ub‾yPowers ← { c x → ’+ r‾/ c × x ^ o‾ffsets t‾ally c }{{}^{\mathrm{u}}\mathrm{\underline{b}yPowers}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{x}}\ {\to}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{c}}\ {\times}\ {\mathrm{x}}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{c}}\ {\}}
17c u:b_yPowers 2{\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}yPowers}}\ {2}c ub‾yPowers 2{\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}yPowers}}\ {2}
22u:d_iff := { v -> (1 d_rop v) - -1 d_rop v }{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {-}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}\ {\}}ud‾iff ← { v → (1 d‾rop v) − −1 d‾rop v }{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {-}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}\ {\}}
23squares := (r_ange 8) ^ 2{\mathrm{squares}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ange}}\ {8}{)}\ {\mathbin{\hat{}}}\ {2}squares ← (r‾ange 8) ^ 2{\mathrm{squares}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ange}}\ {8}{)}\ {\mathbin{\hat{}}}\ {2}
24squares{\mathrm{squares}}squares{\mathrm{squares}}
25u:d_iff squares # the odd numbers{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}\ {\mathrm{squares}}ud‾iff squares{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}\ {\mathrm{squares}}
26u:d_iff^2 squares # a constant: squares are degree 2{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}^{2}\ {\mathrm{squares}}ud‾iff2 squares{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}^{2}\ {\mathrm{squares}}
27u:d_iff^3 (r_ange 8) ^ 3 # 6 = 3!, for cubes{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}^{3}\ {(}{\mathrm{\underline{r}ange}}\ {8}{)}\ {\mathbin{\hat{}}}\ {3}ud‾iff3 (r‾ange 8) ^ 3{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}^{3}\ {(}{\mathrm{\underline{r}ange}}\ {8}{)}\ {\mathbin{\hat{}}}\ {3}
31u:d_iff^3 c u:h_orner o_ffsets 8{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}^{3}\ {\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}orner}}\ {\mathrm{\underline{o}ffsets}}\ {8}ud‾iff3 c uh‾orner o‾ffsets 8{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}^{3}\ {\mathrm{c}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}orner}}\ {\mathrm{\underline{o}ffsets}}\ {8}
36v := 3 5 4 8 7 9 12 10 14 13{\mathrm{v}}\ {\leftarrow}\ {3}\ {5}\ {4}\ {8}\ {7}\ {9}\ {12}\ {10}\ {14}\ {13}v ← 3 5 4 8 7 9 12 10 14 13{\mathrm{v}}\ {\leftarrow}\ {3}\ {5}\ {4}\ {8}\ {7}\ {9}\ {12}\ {10}\ {14}\ {13}
37u:w_indows := { n v ->{{}^{\mathrm{u}}\mathrm{\underline{w}indows}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{v}}\ {\to}uw‾indows ← { n v →{{}^{\mathrm{u}}\mathrm{\underline{w}indows}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{v}}\ {\to}
38 (r_ange 1 + (t_ally v) - n) '{ i j -> (i + j - 1) s_elect v } t_able r_ange n\ \ {(}{\mathrm{\underline{r}ange}}\ {1}\ {+}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {-}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\mathrm{i}}\ {\mathrm{j}}\ {\to}\ {(}{\mathrm{i}}\ {+}\ {\mathrm{j}}\ {-}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}\ {\}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  (r‾ange 1 + (t‾ally v) − n) ’{ i j → (i + j − 1) s‾elect v } t‾able r‾ange n\ \ {(}{\mathrm{\underline{r}ange}}\ {1}\ {+}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {-}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\mathrm{i}}\ {\mathrm{j}}\ {\to}\ {(}{\mathrm{i}}\ {+}\ {\mathrm{j}}\ {-}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}\ {\}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
39}{\}}}{\}}
403 u:w_indows v{3}\ {{}^{\mathrm{u}}\mathrm{\underline{w}indows}}\ {\mathrm{v}}3 uw‾indows v{3}\ {{}^{\mathrm{u}}\mathrm{\underline{w}indows}}\ {\mathrm{v}}
41(f_loat '+ r_/_2 3 u:w_indows v) / 3{(}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {3}\ {{}^{\mathrm{u}}\mathrm{\underline{w}indows}}\ {\mathrm{v}}{)}\ {\div}\ {3}(f‾loat ’+ r‾/2 3 uw‾indows v) ÷ 3{(}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {3}\ {{}^{\mathrm{u}}\mathrm{\underline{w}indows}}\ {\mathrm{v}}{)}\ {\div}\ {3}
45u:m_oving := { n v ->{{}^{\mathrm{u}}\mathrm{\underline{m}oving}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{v}}\ {\to}um‾oving ← { n v →{{}^{\mathrm{u}}\mathrm{\underline{m}oving}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{v}}\ {\to}
46 s := 0 c_at '+ s_\ v\ \ {\mathrm{s}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}  s ← 0 c‾at ’+ s‾\ v\ \ {\mathrm{s}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}
47 (f_loat (n d_rop s) - (0 - n) d_rop s) / f_loat n\ \ {(}{\mathrm{\underline{f}loat}}\ {(}{\mathrm{n}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{s}}{)}\ {-}\ {(}{0}\ {-}\ {\mathrm{n}}{)}\ {\mathrm{\underline{d}rop}}\ {\mathrm{s}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}  (f‾loat (n d‾rop s) − (0 − n) d‾rop s) ÷ f‾loat n\ \ {(}{\mathrm{\underline{f}loat}}\ {(}{\mathrm{n}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{s}}{)}\ {-}\ {(}{0}\ {-}\ {\mathrm{n}}{)}\ {\mathrm{\underline{d}rop}}\ {\mathrm{s}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}
48}{\}}}{\}}
493 u:m_oving v{3}\ {{}^{\mathrm{u}}\mathrm{\underline{m}oving}}\ {\mathrm{v}}3 um‾oving v{3}\ {{}^{\mathrm{u}}\mathrm{\underline{m}oving}}\ {\mathrm{v}}

demos/classics/shortest.xtl

7w := 4 4 r_eshape 0 3 999 7 8 0 2 999 5 999 0 1 2 999 999 0{\mathrm{w}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {3}\ {999}\ {7}\ \ {8}\ {0}\ {2}\ {999}\ \ {5}\ {999}\ {0}\ {1}\ \ {2}\ {999}\ {999}\ {0}w ← 4 4 r‾eshape 0 3 999 7  8 0 2 999  5 999 0 1  2 999 999 0{\mathrm{w}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {3}\ {999}\ {7}\ \ {8}\ {0}\ {2}\ {999}\ \ {5}\ {999}\ {0}\ {1}\ \ {2}\ {999}\ {999}\ {0}
8w 'm_in '+ i_nner w{\mathrm{w}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {\mathrm{\underline{i}nner}}\ {\mathrm{w}}w ’m‾in ’+ i‾nner w{\mathrm{w}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {\mathrm{\underline{i}nner}}\ {\mathrm{w}}
10u:s_hortest := { d ->{{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}us‾hortest ← { d →{{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}
11 e := d 'm_in '+ i_nner d\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{d}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {\mathrm{\underline{i}nner}}\ {\mathrm{d}}  e ← d ’m‾in ’+ i‾nner d\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{d}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {\mathrm{\underline{i}nner}}\ {\mathrm{d}}
12 (e m_atch d) ? d\ \ {(}{\mathrm{e}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{d}}{)}\ {?}\ {\mathrm{d}}  (e m‾atch d) ? d\ \ {(}{\mathrm{e}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{d}}{)}\ {?}\ {\mathrm{d}}
13 u:s_hortest e\ \ {{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\mathrm{e}}  us‾hortest e\ \ {{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\mathrm{e}}
14}{\}}}{\}}
15d := u:s_hortest w{\mathrm{d}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\mathrm{w}}d ← us‾hortest w{\mathrm{d}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\mathrm{w}}
16d{\mathrm{d}}d{\mathrm{d}}
20c := 4 4 r_eshape 0 5 0 2 5 0 4 0 0 4 0 6 2 0 6 0{\mathrm{c}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {5}\ {0}\ {2}\ \ {5}\ {0}\ {4}\ {0}\ \ {0}\ {4}\ {0}\ {6}\ \ {2}\ {0}\ {6}\ {0}c ← 4 4 r‾eshape 0 5 0 2  5 0 4 0  0 4 0 6  2 0 6 0{\mathrm{c}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {5}\ {0}\ {2}\ \ {5}\ {0}\ {4}\ {0}\ \ {0}\ {4}\ {0}\ {6}\ \ {2}\ {0}\ {6}\ {0}
21u:w_idest := { d ->{{}^{\mathrm{u}}\mathrm{\underline{w}idest}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}uw‾idest ← { d →{{}^{\mathrm{u}}\mathrm{\underline{w}idest}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}
22 e := d m_ax d 'm_ax 'm_in i_nner d\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{d}}\ {\mathrm{\underline{m}ax}}\ {\mathrm{d}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{i}nner}}\ {\mathrm{d}}  e ← d m‾ax d ’m‾ax ’m‾in i‾nner d\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{d}}\ {\mathrm{\underline{m}ax}}\ {\mathrm{d}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{i}nner}}\ {\mathrm{d}}
23 (e m_atch d) ? d\ \ {(}{\mathrm{e}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{d}}{)}\ {?}\ {\mathrm{d}}  (e m‾atch d) ? d\ \ {(}{\mathrm{e}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{d}}{)}\ {?}\ {\mathrm{d}}
24 u:w_idest e\ \ {{}^{\mathrm{u}}\mathrm{\underline{w}idest}}\ {\mathrm{e}}  uw‾idest e\ \ {{}^{\mathrm{u}}\mathrm{\underline{w}idest}}\ {\mathrm{e}}
25}{\}}}{\}}
26u:w_idest c # (the diagonal is the best round trip){{}^{\mathrm{u}}\mathrm{\underline{w}idest}}\ {\mathrm{c}}uw‾idest c{{}^{\mathrm{u}}\mathrm{\underline{w}idest}}\ {\mathrm{c}}
29shown := []S_HOW []G_RID d{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{d}}shown ← □S‾HOW □G‾RID d{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{d}}

demos/classics/sieve.xtl

7u:s_ieve := { v ->{{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}us‾ieve ← { v →{{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}
8 0 = t_ally v ? v\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}  0 = t‾ally v ? v\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}
9 p := f_irst v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}  p ← f‾irst v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}
10 (p * p) > 'm_ax r_/ v ? v\ \ {(}{\mathrm{p}}\ {\times}\ {\mathrm{p}}{)}\ {>}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}  (p × p) > ’m‾ax r‾/ v ? v\ \ {(}{\mathrm{p}}\ {\times}\ {\mathrm{p}}{)}\ {>}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}
11 rest := 1 d_rop v\ \ {\mathrm{rest}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}  rest ← 1 d‾rop v\ \ {\mathrm{rest}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}
12 p c_at u:s_ieve (w_here 0 != rest m_od p) s_elect rest\ \ {\mathrm{p}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {(}{\mathrm{\underline{w}here}}\ {0}\ {\neq}\ {\mathrm{rest}}\ {\mathrm{\underline{m}od}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rest}}  p c‾at us‾ieve (w‾here 0 ≠ rest m‾od p) s‾elect rest\ \ {\mathrm{p}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {(}{\mathrm{\underline{w}here}}\ {0}\ {\neq}\ {\mathrm{rest}}\ {\mathrm{\underline{m}od}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rest}}
13}{\}}}{\}}
14u:s_ieve 1 d_rop r_ange 100{{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {100}us‾ieve 1 d‾rop r‾ange 100{{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {100}
17v := 1 d_rop r_ange 30{\mathrm{v}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {30}v ← 1 d‾rop r‾ange 30{\mathrm{v}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {30}
180 != v m_od 3{0}\ {\neq}\ {\mathrm{v}}\ {\mathrm{\underline{m}od}}\ {3}0 ≠ v m‾od 3{0}\ {\neq}\ {\mathrm{v}}\ {\mathrm{\underline{m}od}}\ {3}
19(w_here 0 != v m_od 3) s_elect v{(}{\mathrm{\underline{w}here}}\ {0}\ {\neq}\ {\mathrm{v}}\ {\mathrm{\underline{m}od}}\ {3}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}(w‾here 0 ≠ v m‾od 3) s‾elect v{(}{\mathrm{\underline{w}here}}\ {0}\ {\neq}\ {\mathrm{v}}\ {\mathrm{\underline{m}od}}\ {3}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
22p := u:s_ieve 1 d_rop r_ange 1000{\mathrm{p}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {1000}p ← us‾ieve 1 d‾rop r‾ange 1000{\mathrm{p}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {1000}
23t_ally p{\mathrm{\underline{t}ally}}\ {\mathrm{p}}t‾ally p{\mathrm{\underline{t}ally}}\ {\mathrm{p}}
24-1 t_ake p{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{p}}−1 t‾ake p{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{p}}

demos/classics/sorting.xtl

5v := 30 10 50 20 40{\mathrm{v}}\ {\leftarrow}\ {30}\ {10}\ {50}\ {20}\ {40}v ← 30 10 50 20 40{\mathrm{v}}\ {\leftarrow}\ {30}\ {10}\ {50}\ {20}\ {40}
6g_rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}g‾rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}
7(g_rade v) s_elect v{(}{\mathrm{\underline{g}rade}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}(g‾rade v) s‾elect v{(}{\mathrm{\underline{g}rade}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
8s_ort v # the same, in one step{\mathrm{\underline{s}ort}}\ {\mathrm{v}}s‾ort v{\mathrm{\underline{s}ort}}\ {\mathrm{v}}
9r_ev s_ort v # descending{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}ort}}\ {\mathrm{v}}r‾ev s‾ort v{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}ort}}\ {\mathrm{v}}
12names := 4 5 r_eshape "Alicebob carolDave "{\mathrm{names}}\ {\leftarrow}\ {4}\ {5}\ {\mathrm{\underline{r}eshape}}\ {\text{"Alicebob carolDave "}}names ← 4 5 r‾eshape "Alicebob carolDave "{\mathrm{names}}\ {\leftarrow}\ {4}\ {5}\ {\mathrm{\underline{r}eshape}}\ {\text{"Alicebob carolDave "}}
13ages := 34 27 45 19{\mathrm{ages}}\ {\leftarrow}\ {34}\ {27}\ {45}\ {19}ages ← 34 27 45 19{\mathrm{ages}}\ {\leftarrow}\ {34}\ {27}\ {45}\ {19}
14(g_rade ages) s_elect names{(}{\mathrm{\underline{g}rade}}\ {\mathrm{ages}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{names}}(g‾rade ages) s‾elect names{(}{\mathrm{\underline{g}rade}}\ {\mathrm{ages}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{names}}
15(g_rade ages) s_elect ages{(}{\mathrm{\underline{g}rade}}\ {\mathrm{ages}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ages}}(g‾rade ages) s‾elect ages{(}{\mathrm{\underline{g}rade}}\ {\mathrm{ages}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ages}}
18g_rade g_rade v{\mathrm{\underline{g}rade}}\ {\mathrm{\underline{g}rade}}\ {\mathrm{v}}g‾rade g‾rade v{\mathrm{\underline{g}rade}}\ {\mathrm{\underline{g}rade}}\ {\mathrm{v}}
23w := 3 1 4 1 5 9 2 6 5 3 5{\mathrm{w}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}w ← 3 1 4 1 5 9 2 6 5 3 5{\mathrm{w}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}
24u_nique w{\mathrm{\underline{u}nique}}\ {\mathrm{w}}u‾nique w{\mathrm{\underline{u}nique}}\ {\mathrm{w}}
25(w i_ndexOf w) = r_ange t_ally w{(}{\mathrm{w}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{w}}{)}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{w}}(w i‾ndexOf w) = r‾ange t‾ally w{(}{\mathrm{w}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{w}}{)}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{w}}
26(w_here (w i_ndexOf w) = r_ange t_ally w) s_elect w{(}{\mathrm{\underline{w}here}}\ {(}{\mathrm{w}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{w}}{)}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{w}}(w‾here (w i‾ndexOf w) = r‾ange t‾ally w) s‾elect w{(}{\mathrm{\underline{w}here}}\ {(}{\mathrm{w}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{w}}{)}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{w}}
29s := s_ort u_nique w{\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{w}}s ← s‾ort u‾nique w{\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{w}}
30(w_here 1 < '+ r_/_2 s '= t_able w) s_elect s{(}{\mathrm{\underline{w}here}}\ {1}\ {<}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{s}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}(w‾here 1 < ’+ r‾/2 s ’= t‾able w) s‾elect s{(}{\mathrm{\underline{w}here}}\ {1}\ {<}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{s}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}

demos/classics/truth.xtl

6t := 2 2 2 e_ncode o_ffsets 8{\mathrm{t}}\ {\leftarrow}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{o}ffsets}}\ {8}t ← 2 2 2 e‾ncode o‾ffsets 8{\mathrm{t}}\ {\leftarrow}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{o}ffsets}}\ {8}
7t # a, b and c, one row each{\mathrm{t}}t{\mathrm{t}}
8a := 1 s_elect t{\mathrm{a}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}a ← 1 s‾elect t{\mathrm{a}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}
9b := 2 s_elect t{\mathrm{b}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}b ← 2 s‾elect t{\mathrm{b}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}
10c := 3 s_elect t{\mathrm{c}}\ {\leftarrow}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}c ← 3 s‾elect t{\mathrm{c}}\ {\leftarrow}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}
112 d_ecode t # each column read back as its number{2}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{t}}2 d‾ecode t{2}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{t}}
16f := 0 + (a & b) | n_ot c{\mathrm{f}}\ {\leftarrow}\ {0}\ {+}\ {(}{\mathrm{a}}\ {\wedge}\ {\mathrm{b}}{)}\ {\vee}\ {\mathrm{\underline{n}ot}}\ {\mathrm{c}}f ← 0 + (a ∧ b) ∨ n‾ot c{\mathrm{f}}\ {\leftarrow}\ {0}\ {+}\ {(}{\mathrm{a}}\ {\wedge}\ {\mathrm{b}}{)}\ {\vee}\ {\mathrm{\underline{n}ot}}\ {\mathrm{c}}
17t c_at f{\mathrm{t}}\ {\mathrm{\underline{c}at}}\ {\mathrm{f}}t c‾at f{\mathrm{t}}\ {\mathrm{\underline{c}at}}\ {\mathrm{f}}
20'& r_/ (n_ot a & b) = (n_ot a) | n_ot b # De Morgan{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{a}}\ {\wedge}\ {\mathrm{b}}{)}\ {=}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{a}}{)}\ {\vee}\ {\mathrm{\underline{n}ot}}\ {\mathrm{b}}’∧ r‾/ (n‾ot a ∧ b) = (n‾ot a) ∨ n‾ot b{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{a}}\ {\wedge}\ {\mathrm{b}}{)}\ {=}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{a}}{)}\ {\vee}\ {\mathrm{\underline{n}ot}}\ {\mathrm{b}}
21'& r_/ (a & b | c) = (a & b) | a & c # distributive{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{a}}\ {\wedge}\ {\mathrm{b}}\ {\vee}\ {\mathrm{c}}{)}\ {=}\ {(}{\mathrm{a}}\ {\wedge}\ {\mathrm{b}}{)}\ {\vee}\ {\mathrm{a}}\ {\wedge}\ {\mathrm{c}}’∧ r‾/ (a ∧ b ∨ c) = (a ∧ b) ∨ a ∧ c{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{a}}\ {\wedge}\ {\mathrm{b}}\ {\vee}\ {\mathrm{c}}{)}\ {=}\ {(}{\mathrm{a}}\ {\wedge}\ {\mathrm{b}}{)}\ {\vee}\ {\mathrm{a}}\ {\wedge}\ {\mathrm{c}}
22'& r_/ (a | b) = a & b # not a law{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{a}}\ {\vee}\ {\mathrm{b}}{)}\ {=}\ {\mathrm{a}}\ {\wedge}\ {\mathrm{b}}’∧ r‾/ (a ∨ b) = a ∧ b{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{a}}\ {\vee}\ {\mathrm{b}}{)}\ {=}\ {\mathrm{a}}\ {\wedge}\ {\mathrm{b}}
25majority := 0 + 2 <= a + b + c{\mathrm{majority}}\ {\leftarrow}\ {0}\ {+}\ {2}\ {\leq}\ {\mathrm{a}}\ {+}\ {\mathrm{b}}\ {+}\ {\mathrm{c}}majority ← 0 + 2 ≤ a + b + c{\mathrm{majority}}\ {\leftarrow}\ {0}\ {+}\ {2}\ {\leq}\ {\mathrm{a}}\ {+}\ {\mathrm{b}}\ {+}\ {\mathrm{c}}
26majority{\mathrm{majority}}majority{\mathrm{majority}}
27majority r_eplicate_2 t{\mathrm{majority}}\ {{\mathrm{\underline{r}eplicate}}_{2}}\ {\mathrm{t}}majority r‾eplicate2 t{\mathrm{majority}}\ {{\mathrm{\underline{r}eplicate}}_{2}}\ {\mathrm{t}}
31n := a + b + c{\mathrm{n}}\ {\leftarrow}\ {\mathrm{a}}\ {+}\ {\mathrm{b}}\ {+}\ {\mathrm{c}}n ← a + b + c{\mathrm{n}}\ {\leftarrow}\ {\mathrm{a}}\ {+}\ {\mathrm{b}}\ {+}\ {\mathrm{c}}
32adder := 2 2 e_ncode n{\mathrm{adder}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{n}}adder ← 2 2 e‾ncode n{\mathrm{adder}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{n}}
33adder{\mathrm{adder}}adder{\mathrm{adder}}
34'& r_/ majority = 1 s_elect adder{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{majority}}\ {=}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{adder}}’∧ r‾/ majority = 1 s‾elect adder{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{majority}}\ {=}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{adder}}
35'& r_/ (a != b != c) = 2 s_elect adder{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{a}}\ {\neq}\ {\mathrm{b}}\ {\neq}\ {\mathrm{c}}{)}\ {=}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{adder}}’∧ r‾/ (a ≠ b ≠ c) = 2 s‾elect adder{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{a}}\ {\neq}\ {\mathrm{b}}\ {\neq}\ {\mathrm{c}}{)}\ {=}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{adder}}
40rule := 2 d_ecode r_ev a != b | c{\mathrm{rule}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{a}}\ {\neq}\ {\mathrm{b}}\ {\vee}\ {\mathrm{c}}rule ← 2 d‾ecode r‾ev a ≠ b ∨ c{\mathrm{rule}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{a}}\ {\neq}\ {\mathrm{b}}\ {\vee}\ {\mathrm{c}}
41rule{\mathrm{rule}}rule{\mathrm{rule}}

demos/classics/turtle.xtl

6"t:" u_se< "Turtle"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Turtle"}}"t:" u‾se< "Turtle"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Turtle"}}
11spiral := []S_HOW []P_ATH (r_ange 120) t:w_alk 120 r_eshape 89{\mathrm{spiral}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {(}{\mathrm{\underline{r}ange}}\ {120}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{w}alk}}\ {120}\ {\mathrm{\underline{r}eshape}}\ {89}spiral ← □S‾HOW □P‾ATH (r‾ange 120) tw‾alk 120 r‾eshape 89{\mathrm{spiral}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {(}{\mathrm{\underline{r}ange}}\ {120}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{w}alk}}\ {120}\ {\mathrm{\underline{r}eshape}}\ {89}
17u:k_och := { n ->{{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}uk‾och ← { n →{{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
18 n = 0 ? 1 r_eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}  n = 0 ? 1 r‾eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}
19 k := u:k_och n - 1\ \ {\mathrm{k}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {\mathrm{n}}\ {-}\ {1}  k ← uk‾och n − 1\ \ {\mathrm{k}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {\mathrm{n}}\ {-}\ {1}
20 k c_at (60 t:t_urn k) c_at (-120 t:t_urn k) c_at 60 t:t_urn k\ \ {\mathrm{k}}\ {\mathrm{\underline{c}at}}\ {(}{60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {(}{-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}  k c‾at (60 tt‾urn k) c‾at (−120 tt‾urn k) c‾at 60 tt‾urn k\ \ {\mathrm{k}}\ {\mathrm{\underline{c}at}}\ {(}{60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {(}{-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}
21}{\}}}{\}}
22t_ally u:k_och 3 # 4^3 steps{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {3}t‾ally uk‾och 3{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {3}
23side := u:k_och 3{\mathrm{side}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {3}side ← uk‾och 3{\mathrm{side}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {3}
24snowflake := []S_HOW []P_ATH t:p_oints side c_at (-120 t:t_urn side) c_at -120 t:t_urn side{\mathrm{snowflake}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {\mathrm{side}}\ {\mathrm{\underline{c}at}}\ {(}{-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{side}}{)}\ {\mathrm{\underline{c}at}}\ {-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{side}}snowflake ← □S‾HOW □P‾ATH tp‾oints side c‾at (−120 tt‾urn side) c‾at −120 tt‾urn side{\mathrm{snowflake}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {\mathrm{side}}\ {\mathrm{\underline{c}at}}\ {(}{-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{side}}{)}\ {\mathrm{\underline{c}at}}\ {-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{side}}
30u:a_rrow := { n s ->{{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{s}}\ {\to}ua‾rrow ← { n s →{{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{s}}\ {\to}
31 n = 0 ? 1 r_eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}  n = 0 ? 1 r‾eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}
32 outer := (n - 1) u:a_rrow n_eg s\ \ {\mathrm{outer}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\mathrm{\underline{n}eg}}\ {\mathrm{s}}  outer ← (n − 1) ua‾rrow n‾eg s\ \ {\mathrm{outer}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\mathrm{\underline{n}eg}}\ {\mathrm{s}}
33 outer c_at ((60 * s) t:t_urn (n - 1) u:a_rrow s) c_at (60 * s) t:t_urn outer\ \ {\mathrm{outer}}\ {\mathrm{\underline{c}at}}\ {(}{(}{60}\ {\times}\ {\mathrm{s}}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {(}{60}\ {\times}\ {\mathrm{s}}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{outer}}  outer c‾at ((60 × s) tt‾urn (n − 1) ua‾rrow s) c‾at (60 × s) tt‾urn outer\ \ {\mathrm{outer}}\ {\mathrm{\underline{c}at}}\ {(}{(}{60}\ {\times}\ {\mathrm{s}}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {(}{60}\ {\times}\ {\mathrm{s}}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{outer}}
34}{\}}}{\}}
35arrowhead := t:p_oints 6 u:a_rrow 1{\mathrm{arrowhead}}\ {\leftarrow}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {6}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {1}arrowhead ← tp‾oints 6 ua‾rrow 1{\mathrm{arrowhead}}\ {\leftarrow}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {6}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {1}
36s_hape arrowhead # 2 rows: 3^6 steps, one more point{\mathrm{\underline{s}hape}}\ {\mathrm{arrowhead}}s‾hape arrowhead{\mathrm{\underline{s}hape}}\ {\mathrm{arrowhead}}
37still := []S_HOW []P_ATH arrowhead{\mathrm{still}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {\mathrm{arrowhead}}still ← □S‾HOW □P‾ATH arrowhead{\mathrm{still}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {\mathrm{arrowhead}}
42n := 1 s_elect 1 d_rop s_hape arrowhead{\mathrm{n}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{arrowhead}}n ← 1 s‾elect 1 d‾rop s‾hape arrowhead{\mathrm{n}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{arrowhead}}
43u:u_pTo := { k -> ((f_loor k * n / 24) m_in r_ange n) s_elect_2 arrowhead }{{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{f}loor}}\ {\mathrm{k}}\ {\times}\ {\mathrm{n}}\ {\div}\ {24}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{arrowhead}}\ {\}}uu‾pTo ← { k → ((f‾loor k × n ÷ 24) m‾in r‾ange n) s‾elect2 arrowhead }{{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{f}loor}}\ {\mathrm{k}}\ {\times}\ {\mathrm{n}}\ {\div}\ {24}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{arrowhead}}\ {\}}
44u:d_rawing := { k ->{{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}ud‾rawing ← { k →{{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}
45 k = 1 ? (1 c_at s_hape u:u_pTo 1) r_eshape u:u_pTo 1\ \ {\mathrm{k}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {1}{)}\ {\mathrm{\underline{r}eshape}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {1}  k = 1 ? (1 c‾at s‾hape uu‾pTo 1) r‾eshape uu‾pTo 1\ \ {\mathrm{k}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {1}{)}\ {\mathrm{\underline{r}eshape}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {1}
46 (u:d_rawing k - 1) c_at u:u_pTo k\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\mathrm{k}}  (ud‾rawing k − 1) c‾at uu‾pTo k\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\mathrm{k}}
47}{\}}}{\}}
48drawing := []S_HOW []P_ATH u:d_rawing 24{\mathrm{drawing}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {24}drawing ← □S‾HOW □P‾ATH ud‾rawing 24{\mathrm{drawing}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {24}

demos/classics/wordfreq.xtl

6text := "the cat and the hat and the bat sat on the mat with the cat"{\mathrm{text}}\ {\leftarrow}\ {\text{"the cat and the hat and the bat sat on the mat with the cat"}}text ← "the cat and the hat and the bat sat on the mat with the cat"{\mathrm{text}}\ {\leftarrow}\ {\text{"the cat and the hat and the bat sat on the mat with the cat"}}
7words := (text != f_irst " ") p_artition text{\mathrm{words}}\ {\leftarrow}\ {(}{\mathrm{text}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{text}}words ← (text ≠ f‾irst " ") p‾artition text{\mathrm{words}}\ {\leftarrow}\ {(}{\mathrm{text}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{text}}
8t_ally words{\mathrm{\underline{t}ally}}\ {\mathrm{words}}t‾ally words{\mathrm{\underline{t}ally}}\ {\mathrm{words}}
9u := u_nique words{\mathrm{u}}\ {\leftarrow}\ {\mathrm{\underline{u}nique}}\ {\mathrm{words}}u ← u‾nique words{\mathrm{u}}\ {\leftarrow}\ {\mathrm{\underline{u}nique}}\ {\mathrm{words}}
10u{\mathrm{u}}u{\mathrm{u}}
11n := '+ r_/_2 u '= t_able words{\mathrm{n}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{u}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{words}}n ← ’+ r‾/2 u ’= t‾able words{\mathrm{n}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{u}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{words}}
12n{\mathrm{n}}n{\mathrm{n}}
13top := g_rade n_eg n # most frequent first, ties in order{\mathrm{top}}\ {\leftarrow}\ {\mathrm{\underline{g}rade}}\ {\mathrm{\underline{n}eg}}\ {\mathrm{n}}top ← g‾rade n‾eg n{\mathrm{top}}\ {\leftarrow}\ {\mathrm{\underline{g}rade}}\ {\mathrm{\underline{n}eg}}\ {\mathrm{n}}
144 t_ake top s_elect u{4}\ {\mathrm{\underline{t}ake}}\ {\mathrm{top}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{u}}4 t‾ake top s‾elect u{4}\ {\mathrm{\underline{t}ake}}\ {\mathrm{top}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{u}}
154 t_ake top s_elect n{4}\ {\mathrm{\underline{t}ake}}\ {\mathrm{top}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}4 t‾ake top s‾elect n{4}\ {\mathrm{\underline{t}ake}}\ {\mathrm{top}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}
18k := t_ally u{\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{u}}k ← t‾ally u{\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{u}}
19(2 c_at k) r_eshape (top s_elect u) c_at '{ f_ormat _r } m_ap top s_elect n{(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{\mathrm{top}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{u}}{)}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\{}\ {\mathrm{\underline{f}ormat}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{top}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}(2 c‾at k) r‾eshape (top s‾elect u) c‾at ’{ f‾ormat _r } m‾ap top s‾elect n{(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{\mathrm{top}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{u}}{)}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\{}\ {\mathrm{\underline{f}ormat}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{top}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}
22'[t_ally d_isclose] e_ach words{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\mathrm{words}}’[t‾ally d‾isclose] e‾ach words{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\mathrm{words}}
23'm_ax r_/ '[t_ally d_isclose] e_ach words # the longest{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\mathrm{words}}’m‾ax r‾/ ’[t‾ally d‾isclose] e‾ach words{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\mathrm{words}}

demos/combinators.xtl

5"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
9u:i_nc := { _r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}ui‾nc ← { _r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}
10u:d_ouble := { _r * 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}ud‾ouble ← { _r × 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}
131 c:K_ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}1 cK‾ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}
1710 '- c:C_ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}10 ’− cC‾ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}
20'u:d_ouble 'u:i_nc c:B_ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}’ud‾ouble ’ui‾nc cB‾ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}
23'* c:W_ 4{\text{'}}{\times}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {4}’× cW‾ 4{\text{'}}{\times}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {4}
26'u:d_ouble '+ c:S_ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{+}\ {{}^{\mathrm{c}}\mathrm{\underline{S}}}\ {3}’ud‾ouble ’+ cS‾ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{+}\ {{}^{\mathrm{c}}\mathrm{\underline{S}}}\ {3}
293 c:T_ 'u:d_ouble{3}\ {{}^{\mathrm{c}}\mathrm{\underline{T}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}3 cT‾ ’ud‾ouble{3}\ {{}^{\mathrm{c}}\mathrm{\underline{T}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}
32(3 c:V_ 4)_ '+{(}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{)}{\_}\ {\text{'}}{+}(3 cV‾ 4)_ ’+{(}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{)}{\_}\ {\text{'}}{+}
33(3 c:V_ 4)_ '*{(}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{)}{\_}\ {\text{'}}{\times}(3 cV‾ 4)_ ’×{(}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{)}{\_}\ {\text{'}}{\times}
37u:f_act := { ~s_elf n -> n <= 1 ? 1; n * s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uf‾act ← { ∼s‾elf n → n ≤ 1 ? 1⋄ n × s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
38'u:f_act c:Y_ 10{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {10}’uf‾act cY‾ 10{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {10}
41u:d_ouble^10 1{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{10}\ {1}ud‾ouble10 1{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{10}\ {1}

demos/factorial.xtl

3u:f_act := { n ->{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}uf‾act ← { n →{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
4 n <= 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}  n ≤ 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}
5 n * u:f_act n - 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}  n × uf‾act n − 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}
6}{\}}}{\}}
7u:f_act 10{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}uf‾act 10{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}

demos/fixed-point.xtl

4u:Y_ := { f_ -> { x_ -> f_ x_ 'x_ } '{ x_ -> f_ x_ 'x_ } }{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\}}uY‾ ← { f‾ → { x‾ → f‾ x‾ ’x‾ } ’{ x‾ → f‾ x‾ ’x‾ } }{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\}}
5u:F_ := { ~s_elf n -> n <= 1 ? 1; n * s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uF‾ ← { ∼s‾elf n → n ≤ 1 ? 1⋄ n × s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
6(u:Y_ 'u:F_)_ 5{(}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {5}(uY‾ ’uF‾)_ 5{(}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {5}

demos/hello-library.xtl

9"h:" u_se< "Hello"{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}"h:" u‾se< "Hello"{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}
10"g:" u_se< "Greetings"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Greetings"}}"g:" u‾se< "Greetings"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Greetings"}}
14h:h_ello @{{}^{\mathrm{h}}\mathrm{\underline{h}ello}}\ {@}hh‾ello @{{}^{\mathrm{h}}\mathrm{\underline{h}ello}}\ {@}
17g:g_reet "hi"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"hi"}}gg‾reet "hi"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"hi"}}
18g:g_reet "welcome to"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"welcome to"}}gg‾reet "welcome to"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"welcome to"}}

demos/higher-order.xtl

3v := 3 1 4 1 5{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}v ← 3 1 4 1 5{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}
4'+ r_/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’+ r‾/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
5'- r_/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’− r‾/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
6'+ s_\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}’+ s‾\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}
7m := 2 3 r_eshape r_ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}m ← 2 3 r‾eshape r‾ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
8'+ r_/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
91 2 3 '* t_able 1 2 3{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}1 2 3 ’× t‾able 1 2 3{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}
10m '+ '* i_nner 1 1 1{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}m ’+ ’× i‾nner 1 1 1{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}
11u:s_ign := { x -> x < 0 ? -1; x = 0 ? 0; 1 }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}us‾ign ← { x → x < 0 ? −1⋄ x = 0 ? 0⋄ 1 }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}
12'u:s_ign e_ach -2 0 7{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {-2}\ {0}\ {7}’us‾ign e‾ach −2 0 7{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {-2}\ {0}\ {7}
131 2 3 '= e_ach 1 5 3{1}\ {2}\ {3}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {1}\ {5}\ {3}1 2 3 ’= e‾ach 1 5 3{1}\ {2}\ {3}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {1}\ {5}\ {3}
14'n_eg 'a_bs c_ompose -3 4{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-3}\ {4}’n‾eg ’a‾bs c‾ompose −3 4{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-3}\ {4}
152 '/ s_wap 1{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}2 ’÷ s‾wap 1{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}
16s_ort v{\mathrm{\underline{s}ort}}\ {\mathrm{v}}s‾ort v{\mathrm{\underline{s}ort}}\ {\mathrm{v}}
17g_rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}g‾rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}
18u_nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}u‾nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}
19v i_ndexOf 4 9{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {4}\ {9}v i‾ndexOf 4 9{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {4}\ {9}
20w_here v > 2{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {2}w‾here v > 2{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {2}

demos/keys.xtl

12x := 5 # typed: x := 5{\mathrm{x}}\ {\leftarrow}\ {5}x ← 5{\mathrm{x}}\ {\leftarrow}\ {5}
16count! := 0 # typed: count! := 0{\mathrm{count}!}\ {\leftarrow}\ {0}count! ← 0{\mathrm{count}!}\ {\leftarrow}\ {0}
17count! := count! + 1 # typed: count! := count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}count! ← count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}
21r_ev 1 2 3 # typed: r_ev 1 2 3{\mathrm{\underline{r}ev}}\ {1}\ {2}\ {3}r‾ev 1 2 3{\mathrm{\underline{r}ev}}\ {1}\ {2}\ {3}
25u:s_quare := { _r * _r } # typed: u:s_quare := { _r * _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}us‾quare ← { _r × _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
26u:s_quare 7 # typed: u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}
32M := 2 3 r_eshape r_ange 6 # typed: M := 2 3 r_eshape r_ange 6{\mathrm{M}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}M ← 2 3 r‾eshape r‾ange 6{\mathrm{M}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
37'+ r_/ M # typed: '+ r_/ M{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{M}}’+ r‾/ M{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{M}}
41'+ r_/_1 M # typed: '+ r_/_1 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{M}}’+ r‾/1 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{M}}
44'+ r_/_2 M # typed: '+ r_/_2 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}’+ r‾/2 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}
48'+ r_/_12 M # typed: '+ r_/_12 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{M}}’+ r‾/12 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{M}}
51'm_ax r_/_2 M # typed: 'm_ax r_/_2 M{\text{'}}{\mathrm{\underline{m}ax}}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}’m‾ax r‾/2 M{\text{'}}{\mathrm{\underline{m}ax}}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}
55'+ s_\ M # typed: '+ s_\ M{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{M}}’+ s‾\ M{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{M}}
58'+ s_\_1 M # typed: '+ s_\_1 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{1}}\ {\mathrm{M}}’+ s‾\1 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{1}}\ {\mathrm{M}}
61'+ s_\_2 M # typed: '+ s_\_2 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{M}}’+ s‾\2 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{M}}
651 o_- M # typed: 1 o_- M{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{M}}1 o‾− M{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{M}}
681 o_-_1 M # typed: 1 o_-_1 M{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{M}}1 o‾−1 M{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{M}}
711 o_-_2 M # typed: 1 o_-_2 M{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{M}}1 o‾−2 M{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{M}}
74-1 o_- 1 2 3 # typed: -1 o_- 1 2 3{-1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}−1 o‾− 1 2 3{-1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}
77-1 0 1 o_- 1 2 3 # typed: -1 0 1 o_- 1 2 3{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}−1 0 1 o‾− 1 2 3{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}
80r_ev M # typed: r_ev M{\mathrm{\underline{r}ev}}\ {\mathrm{M}}r‾ev M{\mathrm{\underline{r}ev}}\ {\mathrm{M}}
83r_ev_1 M # typed: r_ev_1 M{{\mathrm{\underline{r}ev}}_{1}}\ {\mathrm{M}}r‾ev1 M{{\mathrm{\underline{r}ev}}_{1}}\ {\mathrm{M}}
86r_ev_2 M # typed: r_ev_2 M{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{M}}r‾ev2 M{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{M}}
91x^2 # typed: x^2{\mathrm{x}}^{2}x2{\mathrm{x}}^{2}
95(1 9 25)^0.5 # typed: (1 9 25)^0.5{(}{1}\ {9}\ {25}{)}^{0.5}(1 9 25)0.5{(}{1}\ {9}\ {25}{)}^{0.5}
98x ^ 3 # typed: x ^ 3{\mathrm{x}}\ {\mathbin{\hat{}}}\ {3}x ^ 3{\mathrm{x}}\ {\mathbin{\hat{}}}\ {3}
102n_eg^3 5 # typed: n_eg^3 5{\mathrm{\underline{n}eg}}^{3}\ {5}n‾eg3 5{\mathrm{\underline{n}eg}}^{3}\ {5}
107-1 0 1 # typed: -1 0 1{-1}\ {0}\ {1}−1 0 1{-1}\ {0}\ {1}
1103 - 1 # typed: 3 - 1{3}\ {-}\ {1}3 − 1{3}\ {-}\ {1}
1143 -1 # typed: 3 -1{3}\ {-1}3 −1{3}\ {-1}
117x - -3 # typed: x - -3{\mathrm{x}}\ {-}\ {-3}x − −3{\mathrm{x}}\ {-}\ {-3}
1202.5 * 2 # typed: 2.5 * 2{2.5}\ {\times}\ {2}2.5 × 2{2.5}\ {\times}\ {2}
125x != 3 # typed: x != 3{\mathrm{x}}\ {\neq}\ {3}x ≠ 3{\mathrm{x}}\ {\neq}\ {3}
128x <= 5 # typed: x <= 5{\mathrm{x}}\ {\leq}\ {5}x ≤ 5{\mathrm{x}}\ {\leq}\ {5}
132(x > 1) & x < 9 # typed: (x > 1) & x < 9{(}{\mathrm{x}}\ {>}\ {1}{)}\ {\wedge}\ {\mathrm{x}}\ {<}\ {9}(x > 1) ∧ x < 9{(}{\mathrm{x}}\ {>}\ {1}{)}\ {\wedge}\ {\mathrm{x}}\ {<}\ {9}
133(x < 1) | x > 9 # typed: (x < 1) | x > 9{(}{\mathrm{x}}\ {<}\ {1}{)}\ {\vee}\ {\mathrm{x}}\ {>}\ {9}(x < 1) ∨ x > 9{(}{\mathrm{x}}\ {<}\ {1}{)}\ {\vee}\ {\mathrm{x}}\ {>}\ {9}
139u:a_dd := { _l + _r } # typed: u:a_dd := { _l + _r }{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}ua‾dd ← { _l + _r }{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}
1422 u:a_dd 3 # typed: 2 u:a_dd 3{2}\ {{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {3}2 ua‾dd 3{2}\ {{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {3}
146u:s_ign := { n -> n < 0 ? -1; n = 0 ? 0; 1 }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}us‾ign ← { n → n < 0 ? −1⋄ n = 0 ? 0⋄ 1 }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}
148u:s_ign -4 # typed: u:s_ign -4{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {-4}us‾ign −4{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {-4}
152'{ _r * 10 } e_ach 1 2 # typed: '{ _r * 10 } e_ach 1 2{\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {10}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}’{ _r × 10 } e‾ach 1 2{\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {10}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}
156u:m_ean := ['+ r_/ / t_ally] # typed: u:m_ean := ['+ r_/ / t_ally]{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}um‾ean ← [’+ r‾/ ÷ t‾ally]{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}
157u:m_ean 1 2 3 4 # typed: u:m_ean 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}\ {4}um‾ean 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}\ {4}
163"hello" c_at " world" # typed: "hello" c_at " world"{\text{"hello"}}\ {\mathrm{\underline{c}at}}\ {\text{" world"}}"hello" c‾at " world"{\text{"hello"}}\ {\mathrm{\underline{c}at}}\ {\text{" world"}}
166t_ally @ # typed: t_ally @{\mathrm{\underline{t}ally}}\ {@}t‾ally @{\mathrm{\underline{t}ally}}\ {@}
1691 + 1; 2 + 2 # typed: 1 + 1; 2 + 2{1}\ {+}\ {1}{\diamond}\ {2}\ {+}\ {2}1 + 1⋄ 2 + 2{1}\ {+}\ {1}{\diamond}\ {2}\ {+}\ {2}
176"c:" u_se< "Combinators" # typed: "c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
1801 c:K_ 2 # typed: 1 c:K_ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}1 cK‾ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}
183f_ormat 3.5 # typed: f_ormat 3.5{\mathrm{\underline{f}ormat}}\ {3.5}f‾ormat 3.5{\mathrm{\underline{f}ormat}}\ {3.5}
188"hi" []N_PUT "work/keys.txt" # typed: "hi" []N_PUT "work/keys.txt"{\text{"hi"}}\ {\square \mathrm{\underline{N}PUT}}\ {\text{"work/keys.txt"}}"hi" □N‾PUT "work/keys.txt"{\text{"hi"}}\ {\square \mathrm{\underline{N}PUT}}\ {\text{"work/keys.txt"}}

demos/leetcode/numbers-in-string.xtl

7s := "aa123bc42abc9zyz"{\mathrm{s}}\ {\leftarrow}\ {\text{"aa123bc42abc9zyz"}}s ← "aa123bc42abc9zyz"{\mathrm{s}}\ {\leftarrow}\ {\text{"aa123bc42abc9zyz"}}
8m := 0 + s m_ember? "0123456789" # 1 at each digit (0 + makes it an Int){\mathrm{m}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}m ← 0 + s m‾ember? "0123456789"{\mathrm{m}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}
9m{\mathrm{m}}m{\mathrm{m}}
13(1 + m * r_ange t_ally s) s_elect " " c_at s{(}{1}\ {+}\ {\mathrm{m}}\ {\times}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}(1 + m × r‾ange t‾ally s) s‾elect " " c‾at s{(}{1}\ {+}\ {\mathrm{m}}\ {\times}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}
14n_umbers (1 + m * r_ange t_ally s) s_elect " " c_at s{\mathrm{\underline{n}umbers}}\ {(}{1}\ {+}\ {\mathrm{m}}\ {\times}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}n‾umbers (1 + m × r‾ange t‾ally s) s‾elect " " c‾at s{\mathrm{\underline{n}umbers}}\ {(}{1}\ {+}\ {\mathrm{m}}\ {\times}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}
20d := -1 + "0123456789" i_ndexOf m r_eplicate s{\mathrm{d}}\ {\leftarrow}\ {-1}\ {+}\ {\text{"0123456789"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{s}}d ← −1 + "0123456789" i‾ndexOf m r‾eplicate s{\mathrm{d}}\ {\leftarrow}\ {-1}\ {+}\ {\text{"0123456789"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{s}}
21g := m r_eplicate '+ s_\ m > 0 c_at -1 d_rop m{\mathrm{g}}\ {\leftarrow}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{m}}\ {>}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}g ← m r‾eplicate ’+ s‾\ m > 0 c‾at −1 d‾rop m{\mathrm{g}}\ {\leftarrow}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{m}}\ {>}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}
22d{\mathrm{d}}d{\mathrm{d}}
23g{\mathrm{g}}g{\mathrm{g}}
24u:n_ums := { s ->{{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}un‾ums ← { s →{{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
25 m := 0 + s m_ember? "0123456789"\ \ {\mathrm{m}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}  m ← 0 + s m‾ember? "0123456789"\ \ {\mathrm{m}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}
26 d := -1 + "0123456789" i_ndexOf m r_eplicate s\ \ {\mathrm{d}}\ {\leftarrow}\ {-1}\ {+}\ {\text{"0123456789"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{s}}  d ← −1 + "0123456789" i‾ndexOf m r‾eplicate s\ \ {\mathrm{d}}\ {\leftarrow}\ {-1}\ {+}\ {\text{"0123456789"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{s}}
27 g := m r_eplicate '+ s_\ m > 0 c_at -1 d_rop m\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{m}}\ {>}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}  g ← m r‾eplicate ’+ s‾\ m > 0 c‾at −1 d‾rop m\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{m}}\ {>}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}
28 k := '+ r_/ m > 0 c_at -1 d_rop m\ \ {\mathrm{k}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {>}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}  k ← ’+ r‾/ m > 0 c‾at −1 d‾rop m\ \ {\mathrm{k}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}\ {>}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}
29 c := '+ r_/_2 (r_ange k) '= t_able g\ \ {\mathrm{c}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{k}}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}  c ← ’+ r‾/2 (r‾ange k) ’= t‾able g\ \ {\mathrm{c}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{k}}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}
30 e := (g s_elect '+ s_\ c) - r_ange t_ally g\ \ {\mathrm{e}}\ {\leftarrow}\ {(}{\mathrm{g}}\ {\mathrm{\underline{s}elect}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{g}}  e ← (g s‾elect ’+ s‾\ c) − r‾ange t‾ally g\ \ {\mathrm{e}}\ {\leftarrow}\ {(}{\mathrm{g}}\ {\mathrm{\underline{s}elect}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{g}}
31 '+ r_/_2 ((r_ange k) '= t_able g) * (k c_at t_ally g) r_eshape d * 10 ^ e\ \ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{(}{\mathrm{\underline{r}ange}}\ {\mathrm{k}}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}{)}\ {\times}\ {(}{\mathrm{k}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{d}}\ {\times}\ {10}\ {\mathbin{\hat{}}}\ {\mathrm{e}}  ’+ r‾/2 ((r‾ange k) ’= t‾able g) × (k c‾at t‾ally g) r‾eshape d × 10 ^ e\ \ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {(}{(}{\mathrm{\underline{r}ange}}\ {\mathrm{k}}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{g}}{)}\ {\times}\ {(}{\mathrm{k}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{d}}\ {\times}\ {10}\ {\mathbin{\hat{}}}\ {\mathrm{e}}
32}{\}}}{\}}
33n := u:n_ums s{\mathrm{n}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\mathrm{s}}n ← un‾ums s{\mathrm{n}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\mathrm{s}}
34n{\mathrm{n}}n{\mathrm{n}}
35(f_loor n_umbers (1 + m * r_ange t_ally s) s_elect " " c_at s) m_atch n # the two ways agree{(}{\mathrm{\underline{f}loor}}\ {\mathrm{\underline{n}umbers}}\ {(}{1}\ {+}\ {\mathrm{m}}\ {\times}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{n}}(f‾loor n‾umbers (1 + m × r‾ange t‾ally s) s‾elect " " c‾at s) m‾atch n{(}{\mathrm{\underline{f}loor}}\ {\mathrm{\underline{n}umbers}}\ {(}{1}\ {+}\ {\mathrm{m}}\ {\times}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{n}}
38t_ally u_nique n{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{n}}t‾ally u‾nique n{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{n}}
39t_ally u_nique u:n_ums "a123bc34d8ef34" # 123 34 8 34: 3{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\text{"a123bc34d8ef34"}}t‾ally u‾nique un‾ums "a123bc34d8ef34"{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\text{"a123bc34d8ef34"}}
40t_ally u_nique u:n_ums "leet1234code234" # 2{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\text{"leet1234code234"}}t‾ally u‾nique un‾ums "leet1234code234"{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\text{"leet1234code234"}}
41t_ally u_nique u:n_ums "a1b01c001" # 1, 01 and 001 are all 1{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\text{"a1b01c001"}}t‾ally u‾nique un‾ums "a1b01c001"{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\text{"a1b01c001"}}
46u:d_ifferent := { s ->{{}^{\mathrm{u}}\mathrm{\underline{d}ifferent}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}ud‾ifferent ← { s →{{}^{\mathrm{u}}\mathrm{\underline{d}ifferent}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
47 runs := (s m_ember? "0123456789") p_artition s\ \ {\mathrm{runs}}\ {\leftarrow}\ {(}{\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}  runs ← (s m‾ember? "0123456789") p‾artition s\ \ {\mathrm{runs}}\ {\leftarrow}\ {(}{\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}
48 '{ d -> t := d_isclose d; ('| s_\ t != f_irst "0") r_eplicate t } m_ap runs\ \ {\text{'}}{\{}\ {\mathrm{d}}\ {\to}\ {\mathrm{t}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{d}}{\diamond}\ {(}{\text{'}}{\vee}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{t}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{"0"}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{t}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{runs}}  ’{ d → t ← d‾isclose d⋄ (’∨ s‾\ t ≠ f‾irst "0") r‾eplicate t } m‾ap runs\ \ {\text{'}}{\{}\ {\mathrm{d}}\ {\to}\ {\mathrm{t}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{d}}{\diamond}\ {(}{\text{'}}{\vee}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{t}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{"0"}}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{t}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{runs}}
49}{\}}}{\}}
50t_ally u_nique u:d_ifferent "a123bc34d8ef34" # 3{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ifferent}}\ {\text{"a123bc34d8ef34"}}t‾ally u‾nique ud‾ifferent "a123bc34d8ef34"{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ifferent}}\ {\text{"a123bc34d8ef34"}}
51t_ally u_nique u:d_ifferent "a1b01c001" # 1{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ifferent}}\ {\text{"a1b01c001"}}t‾ally u‾nique ud‾ifferent "a1b01c001"{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ifferent}}\ {\text{"a1b01c001"}}
52t_ally u_nique u:d_ifferent "x123456789012345678901234567890y0123456789012345678901234567890z" # 1, past any Int{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ifferent}}\ {\text{"x123456789012345678901234567890y0123456789012345678901234567890z"}}t‾ally u‾nique ud‾ifferent "x123456789012345678901234567890y0123456789012345678901234567890z"{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ifferent}}\ {\text{"x123456789012345678901234567890y0123456789012345678901234567890z"}}
55'm_ax r_/ n # the largest{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}’m‾ax r‾/ n{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}
56'+ r_/ n # the sum{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}’+ r‾/ n{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}
57u_nique u:n_ums "x7y7z12w7q12" # without repeats, first-seen order{\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\text{"x7y7z12w7q12"}}u‾nique un‾ums "x7y7z12w7q12"{\mathrm{\underline{u}nique}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\text{"x7y7z12w7q12"}}
58s_ort n # in order{\mathrm{\underline{s}ort}}\ {\mathrm{n}}s‾ort n{\mathrm{\underline{s}ort}}\ {\mathrm{n}}
59'+ r_/ d # the sum of the digits{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{d}}’+ r‾/ d{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{d}}
60w_here m > 0 c_at -1 d_rop m # where each number starts{\mathrm{\underline{w}here}}\ {\mathrm{m}}\ {>}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}w‾here m > 0 c‾at −1 d‾rop m{\mathrm{\underline{w}here}}\ {\mathrm{m}}\ {>}\ {0}\ {\mathrm{\underline{c}at}}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}
63u:s_econd := { s ->{{}^{\mathrm{u}}\mathrm{\underline{s}econd}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}us‾econd ← { s →{{}^{\mathrm{u}}\mathrm{\underline{s}econd}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
64 m := 0 + s m_ember? "0123456789"\ \ {\mathrm{m}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}  m ← 0 + s m‾ember? "0123456789"\ \ {\mathrm{m}}\ {\leftarrow}\ {0}\ {+}\ {\mathrm{s}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}
65 u := r_ev s_ort u_nique -1 + "0123456789" i_ndexOf m r_eplicate s\ \ {\mathrm{u}}\ {\leftarrow}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {-1}\ {+}\ {\text{"0123456789"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{s}}  u ← r‾ev s‾ort u‾nique −1 + "0123456789" i‾ndexOf m r‾eplicate s\ \ {\mathrm{u}}\ {\leftarrow}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {-1}\ {+}\ {\text{"0123456789"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{m}}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{s}}
66 2 > t_ally u ? -1; 2 s_elect u\ \ {2}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{u}}\ {?}\ {-1}{\diamond}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{u}}  2 > t‾ally u ? −1⋄ 2 s‾elect u\ \ {2}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{u}}\ {?}\ {-1}{\diamond}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{u}}
67}{\}}}{\}}
68u:s_econd "dfa12321afd" # 3{{}^{\mathrm{u}}\mathrm{\underline{s}econd}}\ {\text{"dfa12321afd"}}us‾econd "dfa12321afd"{{}^{\mathrm{u}}\mathrm{\underline{s}econd}}\ {\text{"dfa12321afd"}}
69u:s_econd "abc1111" # -1{{}^{\mathrm{u}}\mathrm{\underline{s}econd}}\ {\text{"abc1111"}}us‾econd "abc1111"{{}^{\mathrm{u}}\mathrm{\underline{s}econd}}\ {\text{"abc1111"}}
72u:a_scending := { s -> n := u:n_ums s; '& r_/ (1 d_rop n) > -1 d_rop n }{{}^{\mathrm{u}}\mathrm{\underline{a}scending}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {\mathrm{n}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\mathrm{s}}{\diamond}\ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{n}}{)}\ {>}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{n}}\ {\}}ua‾scending ← { s → n ← un‾ums s⋄ ’∧ r‾/ (1 d‾rop n) > −1 d‾rop n }{{}^{\mathrm{u}}\mathrm{\underline{a}scending}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {\mathrm{n}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ums}}\ {\mathrm{s}}{\diamond}\ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{n}}{)}\ {>}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{n}}\ {\}}
73u:a_scending "1 box has 3 blue 4 red 6 green and 12 yellow marbles"{{}^{\mathrm{u}}\mathrm{\underline{a}scending}}\ {\text{"1 box has 3 blue 4 red 6 green and 12 yellow marbles"}}ua‾scending "1 box has 3 blue 4 red 6 green and 12 yellow marbles"{{}^{\mathrm{u}}\mathrm{\underline{a}scending}}\ {\text{"1 box has 3 blue 4 red 6 green and 12 yellow marbles"}}
74u:a_scending "hello world 5 x 5"{{}^{\mathrm{u}}\mathrm{\underline{a}scending}}\ {\text{"hello world 5 x 5"}}ua‾scending "hello world 5 x 5"{{}^{\mathrm{u}}\mathrm{\underline{a}scending}}\ {\text{"hello world 5 x 5"}}

demos/life.xtl

6u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}
10u:s_teps := { f_ n x ->{{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\mathrm{x}}\ {\to}us‾teps ← { f‾ n x →{{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\mathrm{x}}\ {\to}
11 shown := p_rint! x\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}  shown ← p‾rint! x\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}
12 gap := p_rint! ""\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}  gap ← p‾rint! ""\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}
13 n = 0 ? x\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {\mathrm{x}}  n = 0 ? x\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {\mathrm{x}}
14 (n - 1) 'f_ u:s_teps f_ x\ \ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {\text{'}}{\mathrm{\underline{f}}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}  (n − 1) ’f‾ us‾teps f‾ x\ \ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {\text{'}}{\mathrm{\underline{f}}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}
15}{\}}}{\}}
19blinker := 5 5 r_eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{\mathrm{blinker}}\ {\leftarrow}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}blinker ← 5 5 r‾eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{\mathrm{blinker}}\ {\leftarrow}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
20u:l_ife blinker{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{blinker}}ul‾ife blinker{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{blinker}}
21u:l_ife^2 blinker{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{2}\ {\mathrm{blinker}}ul‾ife2 blinker{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{2}\ {\mathrm{blinker}}
22(u:l_ife^2 blinker) = blinker{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{2}\ {\mathrm{blinker}}{)}\ {=}\ {\mathrm{blinker}}(ul‾ife2 blinker) = blinker{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{2}\ {\mathrm{blinker}}{)}\ {=}\ {\mathrm{blinker}}
25glider := 6 6 r_eshape 0 1 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0{\mathrm{glider}}\ {\leftarrow}\ {6}\ {6}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}glider ← 6 6 r‾eshape 0 1 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0{\mathrm{glider}}\ {\leftarrow}\ {6}\ {6}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
26last := 4 'u:l_ife u:s_teps glider{\mathrm{last}}\ {\leftarrow}\ {4}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\mathrm{glider}}last ← 4 ’ul‾ife us‾teps glider{\mathrm{last}}\ {\leftarrow}\ {4}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}teps}}\ {\mathrm{glider}}

demos/macros.xtl

10x := -3{\mathrm{x}}\ {\leftarrow}\ {-3}x ← −3{\mathrm{x}}\ {\leftarrow}\ {-3}
11"x > 0" i_f< "1; -1"{\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}"x > 0" i‾f< "1; -1"{\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}
1210 * "x > 0" i_f< "1; -1"{10}\ {\times}\ {\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}10 × "x > 0" i‾f< "1; -1"{10}\ {\times}\ {\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}
13"x < 0" i_f< "0; 1 / 0"{\text{"x < 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"0; 1 / 0"}}"x < 0" i‾f< "0; 1 / 0"{\text{"x < 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"0; 1 / 0"}}
16"x = 0" u_nless< "p_rint! 100 / x"{\text{"x = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / x"}}"x = 0" u‾nless< "p_rint! 100 / x"{\text{"x = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / x"}}
20"m_ax m_in" e_ach< "u:$w/ := { '$w r_/ _r }"{\text{"m\_ax m\_in"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"u:\$w/ := \{ '\$w r\_/ \_r \}"}}"m_ax m_in" e‾ach< "u:$w/ := { ’$w r_/ _r }"{\text{"m\_ax m\_in"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"u:\$w/ := \{ '\$w r\_/ \_r \}"}}
21u:m_ax/ 3 1 4 1 5{{}^{\mathrm{u}}\mathrm{\underline{m}ax}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}um‾ax/ 3 1 4 1 5{{}^{\mathrm{u}}\mathrm{\underline{m}ax}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}
22u:m_in/ 3 1 4 1 5{{}^{\mathrm{u}}\mathrm{\underline{m}in}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}um‾in/ 3 1 4 1 5{{}^{\mathrm{u}}\mathrm{\underline{m}in}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}
27@ f_ormat< "x is {x}, and its square is {x * x}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x is \{x\}, and its square is \{x * x\}"}}@ f‾ormat< "x is {x}, and its square is {x * x}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x is \{x\}, and its square is \{x * x\}"}}
28"x > 0" a_ssert< "x is positive"{\text{"x > 0"}}\ {\mathrm{\underline{a}ssert}{<}}\ {\text{"x is positive"}}"x > 0" a‾ssert< "x is positive"{\text{"x > 0"}}\ {\mathrm{\underline{a}ssert}{<}}\ {\text{"x is positive"}}
29@ c_fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}@ c‾fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}
34"m:" u_se< "Macros"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"m:" u‾se< "Macros"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
35"s_quare" m:d_ef< "_r * _r"{\text{"s\_quare"}}\ {{}^{\mathrm{m}}\mathrm{\underline{d}ef}{<}}\ {\text{"\_r * \_r"}}"s_quare" md‾ef< "_r * _r"{\text{"s\_quare"}}\ {{}^{\mathrm{m}}\mathrm{\underline{d}ef}{<}}\ {\text{"\_r * \_r"}}
36u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}
37"4 = 2 + 2" m:c_heck< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{c}heck}{<}}\ {\text{"addition"}}"4 = 2 + 2" mc‾heck< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{c}heck}{<}}\ {\text{"addition"}}
38"5 = 2 * 2" m:c_heck< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{c}heck}{<}}\ {\text{"doubling"}}"5 = 2 * 2" mc‾heck< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{c}heck}{<}}\ {\text{"doubling"}}

demos/magmas.xtl

6u:r_ps := { x y -> d := (x - y) m_od 3; y + (x - y) * d <= 1 }{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{d}}\ {\leftarrow}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\mathrm{\underline{m}od}}\ {3}{\diamond}\ {\mathrm{y}}\ {+}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\times}\ {\mathrm{d}}\ {\leq}\ {1}\ {\}}ur‾ps ← { x y → d ← (x − y) m‾od 3⋄ y + (x − y) × d ≤ 1 }{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{d}}\ {\leftarrow}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\mathrm{\underline{m}od}}\ {3}{\diamond}\ {\mathrm{y}}\ {+}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\times}\ {\mathrm{d}}\ {\leq}\ {1}\ {\}}
7names := "rock" "paper" "scissors"{\mathrm{names}}\ {\leftarrow}\ {\text{"rock"}}\ {\text{"paper"}}\ {\text{"scissors"}}names ← "rock" "paper" "scissors"{\mathrm{names}}\ {\leftarrow}\ {\text{"rock"}}\ {\text{"paper"}}\ {\text{"scissors"}}
8t := (r_ange 3) 'u:r_ps t_able r_ange 3{\mathrm{t}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ange}}\ {3}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {3}t ← (r‾ange 3) ’ur‾ps t‾able r‾ange 3{\mathrm{t}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ange}}\ {3}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {3}
9t # the Cayley table: 1 rock, 2 paper, 3 scissors{\mathrm{t}}t{\mathrm{t}}
10t s_elect names # the same, by name{\mathrm{t}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{names}}t s‾elect names{\mathrm{t}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{names}}
14u:c_ommutative := { f_ n -> ((r_ange n) 'f_ t_able r_ange n) m_atch (r_ange n) '{ _r f_ _l } t_able r_ange n }{{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\to}\ {(}{(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\mathrm{\underline{f}}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{m}atch}}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\mathrm{\underline{f}}}\ {\_\mathrm{l}}\ {\}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\}}uc‾ommutative ← { f‾ n → ((r‾ange n) ’f‾ t‾able r‾ange n) m‾atch (r‾ange n) ’{ _r f‾ _l } t‾able r‾ange n }{{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\to}\ {(}{(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\mathrm{\underline{f}}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{m}atch}}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\mathrm{\underline{f}}}\ {\_\mathrm{l}}\ {\}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\}}
15u:i_dempotent := { f_ n -> (r_ange n) m_atch '{ _r f_ _r } e_ach r_ange n }{{}^{\mathrm{u}}\mathrm{\underline{i}dempotent}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\to}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\mathrm{\underline{f}}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\}}ui‾dempotent ← { f‾ n → (r‾ange n) m‾atch ’{ _r f‾ _r } e‾ach r‾ange n }{{}^{\mathrm{u}}\mathrm{\underline{i}dempotent}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\to}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\mathrm{\underline{f}}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}\ {\}}
16u:a_ssociative := { f_ n ->{{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\to}ua‾ssociative ← { f‾ n →{{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\to}
17 t := 1 + (3 r_eshape n) e_ncode o_ffsets n ^ 3\ \ {\mathrm{t}}\ {\leftarrow}\ {1}\ {+}\ {(}{3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}\ {\mathbin{\hat{}}}\ {3}  t ← 1 + (3 r‾eshape n) e‾ncode o‾ffsets n ^ 3\ \ {\mathrm{t}}\ {\leftarrow}\ {1}\ {+}\ {(}{3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{o}ffsets}}\ {\mathrm{n}}\ {\mathbin{\hat{}}}\ {3}
18 x := 1 s_elect t\ \ {\mathrm{x}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}  x ← 1 s‾elect t\ \ {\mathrm{x}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}
19 y := 2 s_elect t\ \ {\mathrm{y}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}  y ← 2 s‾elect t\ \ {\mathrm{y}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}
20 z := 3 s_elect t\ \ {\mathrm{z}}\ {\leftarrow}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}  z ← 3 s‾elect t\ \ {\mathrm{z}}\ {\leftarrow}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{t}}
21 '& r_/ ((x f_ y) f_ z) = x f_ y f_ z\ \ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{(}{\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{y}}{)}\ {\mathrm{\underline{f}}}\ {\mathrm{z}}{)}\ {=}\ {\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{y}}\ {\mathrm{\underline{f}}}\ {\mathrm{z}}  ’∧ r‾/ ((x f‾ y) f‾ z) = x f‾ y f‾ z\ \ {\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{(}{\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{y}}{)}\ {\mathrm{\underline{f}}}\ {\mathrm{z}}{)}\ {=}\ {\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{y}}\ {\mathrm{\underline{f}}}\ {\mathrm{z}}
22}{\}}}{\}}
23u:i_dentity := { f_ n -> # the identity element, or 0 for none{{}^{\mathrm{u}}\mathrm{\underline{i}dentity}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\to}ui‾dentity ← { f‾ n →{{}^{\mathrm{u}}\mathrm{\underline{i}dentity}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{n}}\ {\to}
24 r := r_ange n\ \ {\mathrm{r}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  r ← r‾ange n\ \ {\mathrm{r}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
25 e := w_here '{ (r m_atch _r f_ r) & r m_atch r f_ _r } e_ach r\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\text{'}}{\{}\ {(}{\mathrm{r}}\ {\mathrm{\underline{m}atch}}\ {\_\mathrm{r}}\ {\mathrm{\underline{f}}}\ {\mathrm{r}}{)}\ {\wedge}\ {\mathrm{r}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{r}}\ {\mathrm{\underline{f}}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{r}}  e ← w‾here ’{ (r m‾atch _r f‾ r) ∧ r m‾atch r f‾ _r } e‾ach r\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\text{'}}{\{}\ {(}{\mathrm{r}}\ {\mathrm{\underline{m}atch}}\ {\_\mathrm{r}}\ {\mathrm{\underline{f}}}\ {\mathrm{r}}{)}\ {\wedge}\ {\mathrm{r}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{r}}\ {\mathrm{\underline{f}}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{r}}
26 0 = t_ally e ? 0; f_irst e\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{e}}\ {?}\ {0}{\diamond}\ {\mathrm{\underline{f}irst}}\ {\mathrm{e}}  0 = t‾ally e ? 0⋄ f‾irst e\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{e}}\ {?}\ {0}{\diamond}\ {\mathrm{\underline{f}irst}}\ {\mathrm{e}}
27}{\}}}{\}}
28'u:r_ps u:c_ommutative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {3}’ur‾ps uc‾ommutative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {3}
29'u:r_ps u:i_dempotent 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}dempotent}}\ {3}’ur‾ps ui‾dempotent 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}dempotent}}\ {3}
30'u:r_ps u:a_ssociative 3 # not associative{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {3}’ur‾ps ua‾ssociative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {3}
31'u:r_ps u:i_dentity 3 # no identity{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}dentity}}\ {3}’ur‾ps ui‾dentity 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}dentity}}\ {3}
35'u:r_ps r_/ 1 2 3 # rock vs (paper vs scissors): rock{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’ur‾ps r‾/ 1 2 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
36(1 u:r_ps 2) u:r_ps 3 # (rock vs paper) vs scissors: scissors{(}{1}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {2}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {3}(1 ur‾ps 2) ur‾ps 3{(}{1}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {2}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ps}}\ {3}
40u:a_dd := { x y -> 1 + (x + y - 2) m_od 3 }{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {1}\ {+}\ {(}{\mathrm{x}}\ {+}\ {\mathrm{y}}\ {-}\ {2}{)}\ {\mathrm{\underline{m}od}}\ {3}\ {\}}ua‾dd ← { x y → 1 + (x + y − 2) m‾od 3 }{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {1}\ {+}\ {(}{\mathrm{x}}\ {+}\ {\mathrm{y}}\ {-}\ {2}{)}\ {\mathrm{\underline{m}od}}\ {3}\ {\}}
41u:s_ub := { x y -> 1 + (x - y) m_od 3 }{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {1}\ {+}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\mathrm{\underline{m}od}}\ {3}\ {\}}us‾ub ← { x y → 1 + (x − y) m‾od 3 }{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {1}\ {+}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\mathrm{\underline{m}od}}\ {3}\ {\}}
42'u:a_dd u:c_ommutative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {3}’ua‾dd uc‾ommutative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {3}
43'u:a_dd u:a_ssociative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {3}’ua‾dd ua‾ssociative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {3}
44'u:a_dd u:i_dentity 3 # 1 stands for 0{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}dentity}}\ {3}’ua‾dd ui‾dentity 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}dd}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}dentity}}\ {3}
45'u:s_ub u:c_ommutative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {3}’us‾ub uc‾ommutative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {3}
46'u:s_ub u:a_ssociative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {3}’us‾ub ua‾ssociative 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {3}
51u:r_psls := { x y -> d := (x - y) m_od 5; y + (x - y) * d <= 2 }{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{d}}\ {\leftarrow}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\mathrm{\underline{m}od}}\ {5}{\diamond}\ {\mathrm{y}}\ {+}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\times}\ {\mathrm{d}}\ {\leq}\ {2}\ {\}}ur‾psls ← { x y → d ← (x − y) m‾od 5⋄ y + (x − y) × d ≤ 2 }{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{d}}\ {\leftarrow}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\mathrm{\underline{m}od}}\ {5}{\diamond}\ {\mathrm{y}}\ {+}\ {(}{\mathrm{x}}\ {-}\ {\mathrm{y}}{)}\ {\times}\ {\mathrm{d}}\ {\leq}\ {2}\ {\}}
52moves := "rock" "Spock" "paper" "lizard" "scissors"{\mathrm{moves}}\ {\leftarrow}\ {\text{"rock"}}\ {\text{"Spock"}}\ {\text{"paper"}}\ {\text{"lizard"}}\ {\text{"scissors"}}moves ← "rock" "Spock" "paper" "lizard" "scissors"{\mathrm{moves}}\ {\leftarrow}\ {\text{"rock"}}\ {\text{"Spock"}}\ {\text{"paper"}}\ {\text{"lizard"}}\ {\text{"scissors"}}
53w := (r_ange 5) 'u:r_psls t_able r_ange 5{\mathrm{w}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ange}}\ {5}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {5}w ← (r‾ange 5) ’ur‾psls t‾able r‾ange 5{\mathrm{w}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ange}}\ {5}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {5}
54w s_elect moves{\mathrm{w}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{moves}}w s‾elect moves{\mathrm{w}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{moves}}
55beats := 0 + (r_ange 5) '{ (_l != _r) & _l = _l u:r_psls _r } t_able r_ange 5{\mathrm{beats}}\ {\leftarrow}\ {0}\ {+}\ {(}{\mathrm{\underline{r}ange}}\ {5}{)}\ {\text{'}}{\{}\ {(}{\_\mathrm{l}}\ {\neq}\ {\_\mathrm{r}}{)}\ {\wedge}\ {\_\mathrm{l}}\ {=}\ {\_\mathrm{l}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {5}beats ← 0 + (r‾ange 5) ’{ (_l ≠ _r) ∧ _l = _l ur‾psls _r } t‾able r‾ange 5{\mathrm{beats}}\ {\leftarrow}\ {0}\ {+}\ {(}{\mathrm{\underline{r}ange}}\ {5}{)}\ {\text{'}}{\{}\ {(}{\_\mathrm{l}}\ {\neq}\ {\_\mathrm{r}}{)}\ {\wedge}\ {\_\mathrm{l}}\ {=}\ {\_\mathrm{l}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {5}
56beats # row x: the moves x beats{\mathrm{beats}}beats{\mathrm{beats}}
57'+ r_/_2 beats # each beats two{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{beats}}’+ r‾/2 beats{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{beats}}
58'+ r_/ beats # and loses to two{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{beats}}’+ r‾/ beats{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{beats}}
59'u:r_psls u:c_ommutative 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {5}’ur‾psls uc‾ommutative 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ommutative}}\ {5}
60'u:r_psls u:i_dempotent 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}dempotent}}\ {5}’ur‾psls ui‾dempotent 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {{}^{\mathrm{u}}\mathrm{\underline{i}dempotent}}\ {5}
61'u:r_psls u:a_ssociative 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {5}’ur‾psls ua‾ssociative 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}psls}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}ssociative}}\ {5}
62shown := []S_HOW []G_RID w # the winner table, colored by move{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{w}}shown ← □S‾HOW □G‾RID w{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{w}}

demos/monads.xtl

5"m:" u_se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}"m:" u‾se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}
9u:d_iv := { a b -> b = 0 ? 'm:n_othing; m:j_ust a / b }{{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{b}}\ {=}\ {0}\ {?}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}{\diamond}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\mathrm{a}}\ {\div}\ {\mathrm{b}}\ {\}}ud‾iv ← { a b → b = 0 ? ’mn‾othing⋄ mj‾ust a ÷ b }{{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{b}}\ {=}\ {0}\ {?}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}{\diamond}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\mathrm{a}}\ {\div}\ {\mathrm{b}}\ {\}}
13-1 m:o_r 100 u:d_iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}−1 mo‾r 100 ud‾iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}
14-1 m:o_r 100 u:d_iv 0{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}−1 mo‾r 100 ud‾iv 0{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}
18u:h_alf := { x -> x u:d_iv 2 }{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {2}\ {\}}uh‾alf ← { x → x ud‾iv 2 }{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {2}\ {\}}
19u:f_ifth := { x -> x u:d_iv 5 }{{}^{\mathrm{u}}\mathrm{\underline{f}ifth}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {5}\ {\}}uf‾ifth ← { x → x ud‾iv 5 }{{}^{\mathrm{u}}\mathrm{\underline{f}ifth}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {5}\ {\}}
20-1 m:o_r 'u:h_alf m:b_ind 'u:f_ifth m:b_ind 100 u:d_iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}ifth}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}−1 mo‾r ’uh‾alf mb‾ind ’uf‾ifth mb‾ind 100 ud‾iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}ifth}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}
24u:b_yZero := { x -> x u:d_iv 0 }{{}^{\mathrm{u}}\mathrm{\underline{b}yZero}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}\ {\}}ub‾yZero ← { x → x ud‾iv 0 }{{}^{\mathrm{u}}\mathrm{\underline{b}yZero}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}\ {\}}
25-1 m:o_r 'u:h_alf m:b_ind 'u:b_yZero m:b_ind 100 u:d_iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{b}yZero}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}−1 mo‾r ’uh‾alf mb‾ind ’ub‾yZero mb‾ind 100 ud‾iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{b}yZero}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}
28-1 m:o_r '{ _r * 10 } m:m_ap 9 u:d_iv 3{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {10}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}ap}}\ {9}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {3}−1 mo‾r ’{ _r × 10 } mm‾ap 9 ud‾iv 3{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {10}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}ap}}\ {9}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {3}
310 '{ _r + 1 } m:m_aybe 9 u:d_iv 3{0}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}aybe}}\ {9}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {3}0 ’{ _r + 1 } mm‾aybe 9 ud‾iv 3{0}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}aybe}}\ {9}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {3}
320 '{ _r + 1 } m:m_aybe 9 u:d_iv 0{0}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}aybe}}\ {9}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}0 ’{ _r + 1 } mm‾aybe 9 ud‾iv 0{0}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}aybe}}\ {9}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}

demos/rosetta/Comparison.xtl

34l:dwell := 5.0{{}^{\mathrm{l}}\mathrm{dwell}}\ {\leftarrow}\ {5.0}ldwell ← 5.0{{}^{\mathrm{l}}\mathrm{dwell}}\ {\leftarrow}\ {5.0}
35l:idleBefore := 20.0{{}^{\mathrm{l}}\mathrm{idleBefore}}\ {\leftarrow}\ {20.0}lidleBefore ← 20.0{{}^{\mathrm{l}}\mathrm{idleBefore}}\ {\leftarrow}\ {20.0}
47l:s_tart := { i l -> 5 5 r_eshape (f_loat i) c_at 0.0 0.0 1.0 0.0 c_at (f_loat l) c_at 0.0 0.0 1.0 0.0 c_at (f_loat l) c_at 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 c_at l:idleBefore c_at 0.0 0.0 0.0 0.0 }{{}^{\mathrm{l}}\mathrm{\underline{s}tart}}\ {\leftarrow}\ {\{}\ {\mathrm{i}}\ {\mathrm{l}}\ {\to}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{i}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {1.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{l}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {1.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{l}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {1.0}\ {0.0}\ {0.0}\ {0.0}\ {0.0}\ {0.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {0.0}\ {0.0}\ {\}}ls‾tart ← { i l → 5 5 r‾eshape (f‾loat i) c‾at 0.0 0.0 1.0 0.0 c‾at (f‾loat l) c‾at 0.0 0.0 1.0 0.0 c‾at (f‾loat l) c‾at 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 c‾at lidleBefore c‾at 0.0 0.0 0.0 0.0 }{{}^{\mathrm{l}}\mathrm{\underline{s}tart}}\ {\leftarrow}\ {\{}\ {\mathrm{i}}\ {\mathrm{l}}\ {\to}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{i}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {1.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{l}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {1.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{l}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {1.0}\ {0.0}\ {0.0}\ {0.0}\ {0.0}\ {0.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {0.0}\ {0.0}\ {\}}
50l:IDIOM := 1.0{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\leftarrow}\ {1.0}lIDIOM ← 1.0{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\leftarrow}\ {1.0}
51l:TOP := 2.0{{}^{\mathrm{l}}\mathrm{TOP}}\ {\leftarrow}\ {2.0}lTOP ← 2.0{{}^{\mathrm{l}}\mathrm{TOP}}\ {\leftarrow}\ {2.0}
52l:BOTTOM := 3.0{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\leftarrow}\ {3.0}lBOTTOM ← 3.0{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\leftarrow}\ {3.0}
53l:POINTER := 4.0{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\leftarrow}\ {4.0}lPOINTER ← 4.0{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\leftarrow}\ {4.0}
54l:ATTRACT := 5.0{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\leftarrow}\ {5.0}lATTRACT ← 5.0{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\leftarrow}\ {5.0}
55l:IDLE := 1.0{{}^{\mathrm{l}}\mathrm{IDLE}}\ {\leftarrow}\ {1.0}lIDLE ← 1.0{{}^{\mathrm{l}}\mathrm{IDLE}}\ {\leftarrow}\ {1.0}
56l:SINCE := 2.0{{}^{\mathrm{l}}\mathrm{SINCE}}\ {\leftarrow}\ {2.0}lSINCE ← 2.0{{}^{\mathrm{l}}\mathrm{SINCE}}\ {\leftarrow}\ {2.0}
57l:BOTTOMS := 3.0{{}^{\mathrm{l}}\mathrm{BOTTOMS}}\ {\leftarrow}\ {3.0}lBOTTOMS ← 3.0{{}^{\mathrm{l}}\mathrm{BOTTOMS}}\ {\leftarrow}\ {3.0}
58l:IDIOMS := 4.0{{}^{\mathrm{l}}\mathrm{IDIOMS}}\ {\leftarrow}\ {4.0}lIDIOMS ← 4.0{{}^{\mathrm{l}}\mathrm{IDIOMS}}\ {\leftarrow}\ {4.0}
59l:COUNT := 1.0{{}^{\mathrm{l}}\mathrm{COUNT}}\ {\leftarrow}\ {1.0}lCOUNT ← 1.0{{}^{\mathrm{l}}\mathrm{COUNT}}\ {\leftarrow}\ {1.0}
60l:STEPS := 2.0{{}^{\mathrm{l}}\mathrm{STEPS}}\ {\leftarrow}\ {2.0}lSTEPS ← 2.0{{}^{\mathrm{l}}\mathrm{STEPS}}\ {\leftarrow}\ {2.0}
61l:ANGLE := 3.0{{}^{\mathrm{l}}\mathrm{ANGLE}}\ {\leftarrow}\ {3.0}lANGLE ← 3.0{{}^{\mathrm{l}}\mathrm{ANGLE}}\ {\leftarrow}\ {3.0}
62l:PLAYING := 4.0{{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\leftarrow}\ {4.0}lPLAYING ← 4.0{{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\leftarrow}\ {4.0}
63l:DRAGGING := 1.0{{}^{\mathrm{l}}\mathrm{DRAGGING}}\ {\leftarrow}\ {1.0}lDRAGGING ← 1.0{{}^{\mathrm{l}}\mathrm{DRAGGING}}\ {\leftarrow}\ {1.0}
64l:X := 2.0{{}^{\mathrm{l}}\mathrm{X}}\ {\leftarrow}\ {2.0}lX ← 2.0{{}^{\mathrm{l}}\mathrm{X}}\ {\leftarrow}\ {2.0}
65l:Y := 3.0{{}^{\mathrm{l}}\mathrm{Y}}\ {\leftarrow}\ {3.0}lY ← 3.0{{}^{\mathrm{l}}\mathrm{Y}}\ {\leftarrow}\ {3.0}
66l:MOVED := 4.0{{}^{\mathrm{l}}\mathrm{MOVED}}\ {\leftarrow}\ {4.0}lMOVED ← 4.0{{}^{\mathrm{l}}\mathrm{MOVED}}\ {\leftarrow}\ {4.0}
67l:LAST := 5.0{{}^{\mathrm{l}}\mathrm{LAST}}\ {\leftarrow}\ {5.0}lLAST ← 5.0{{}^{\mathrm{l}}\mathrm{LAST}}\ {\leftarrow}\ {5.0}
72l:middle := 210.0{{}^{\mathrm{l}}\mathrm{middle}}\ {\leftarrow}\ {210.0}lmiddle ← 210.0{{}^{\mathrm{l}}\mathrm{middle}}\ {\leftarrow}\ {210.0}
73l:perPixel := 90.0 / 210.0{{}^{\mathrm{l}}\mathrm{perPixel}}\ {\leftarrow}\ {90.0}\ {\div}\ {210.0}lperPixel ← 90.0 ÷ 210.0{{}^{\mathrm{l}}\mathrm{perPixel}}\ {\leftarrow}\ {90.0}\ {\div}\ {210.0}
76l:a_t := { rc state -> (f_loor 2 s_elect rc) s_elect (f_loor 1 s_elect rc) s_elect state }{{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\leftarrow}\ {\{}\ {\mathrm{rc}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rc}}{)}\ {\mathrm{\underline{s}elect}}\ {(}{\mathrm{\underline{f}loor}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rc}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{state}}\ {\}}la‾t ← { rc state → (f‾loor 2 s‾elect rc) s‾elect (f‾loor 1 s‾elect rc) s‾elect state }{{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\leftarrow}\ {\{}\ {\mathrm{rc}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rc}}{)}\ {\mathrm{\underline{s}elect}}\ {(}{\mathrm{\underline{f}loor}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rc}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{state}}\ {\}}
80l:p_ut := { rcv state ->{{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\leftarrow}\ {\{}\ {\mathrm{rcv}}\ {\mathrm{state}}\ {\to}lp‾ut ← { rcv state →{{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\leftarrow}\ {\{}\ {\mathrm{rcv}}\ {\mathrm{state}}\ {\to}
81 mask := f_loat (rows = 1 s_elect rcv) * cols = 2 s_elect rcv\ \ {\mathrm{mask}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {(}{\mathrm{rows}}\ {=}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rcv}}{)}\ {\times}\ {\mathrm{cols}}\ {=}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rcv}}  mask ← f‾loat (rows = 1 s‾elect rcv) × cols = 2 s‾elect rcv\ \ {\mathrm{mask}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {(}{\mathrm{rows}}\ {=}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rcv}}{)}\ {\times}\ {\mathrm{cols}}\ {=}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rcv}}
82 (state * 1.0 - mask) + mask * 3 s_elect rcv\ \ {(}{\mathrm{state}}\ {\times}\ {1.0}\ {-}\ {\mathrm{mask}}{)}\ {+}\ {\mathrm{mask}}\ {\times}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rcv}}  (state × 1.0 − mask) + mask × 3 s‾elect rcv\ \ {(}{\mathrm{state}}\ {\times}\ {1.0}\ {-}\ {\mathrm{mask}}{)}\ {+}\ {\mathrm{mask}}\ {\times}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rcv}}
83}{\}}}{\}}
84rows := 5 5 r_eshape 5 r_eplicate 1.0 2.0 3.0 4.0 5.0{\mathrm{rows}}\ {\leftarrow}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {5}\ {\mathrm{\underline{r}eplicate}}\ {1.0}\ {2.0}\ {3.0}\ {4.0}\ {5.0}rows ← 5 5 r‾eshape 5 r‾eplicate 1.0 2.0 3.0 4.0 5.0{\mathrm{rows}}\ {\leftarrow}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {5}\ {\mathrm{\underline{r}eplicate}}\ {1.0}\ {2.0}\ {3.0}\ {4.0}\ {5.0}
85cols := 5 5 r_eshape 1.0 2.0 3.0 4.0 5.0{\mathrm{cols}}\ {\leftarrow}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {1.0}\ {2.0}\ {3.0}\ {4.0}\ {5.0}cols ← 5 5 r‾eshape 1.0 2.0 3.0 4.0 5.0{\mathrm{cols}}\ {\leftarrow}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {1.0}\ {2.0}\ {3.0}\ {4.0}\ {5.0}
88l:w_rap := { n k -> 1 + (k - 1) m_od n }{{}^{\mathrm{l}}\mathrm{\underline{w}rap}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{k}}\ {\to}\ {1}\ {+}\ {(}{\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}\ {\}}lw‾rap ← { n k → 1 + (k − 1) m‾od n }{{}^{\mathrm{l}}\mathrm{\underline{w}rap}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{k}}\ {\to}\ {1}\ {+}\ {(}{\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}\ {\}}
94l:c_urrent := { axis state -> (f_loor 0.5 + (axis c_at l:COUNT) l:a_t state) l:w_rap f_loor 1.5 + (axis c_at l:STEPS) l:a_t state }{{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{w}rap}}\ {\mathrm{\underline{f}loor}}\ {1.5}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}\ {\}}lc‾urrent ← { axis state → (f‾loor 0.5 + (axis c‾at lCOUNT) la‾t state) lw‾rap f‾loor 1.5 + (axis c‾at lSTEPS) la‾t state }{{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{w}rap}}\ {\mathrm{\underline{f}loor}}\ {1.5}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}\ {\}}
105l:s_tep := { ad state ->{{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {\mathrm{ad}}\ {\mathrm{state}}\ {\to}ls‾tep ← { ad state →{{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {\mathrm{ad}}\ {\mathrm{state}}\ {\to}
106 axis := 1 s_elect ad\ \ {\mathrm{axis}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ad}}  axis ← 1 s‾elect ad\ \ {\mathrm{axis}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ad}}
107 d := 2 s_elect ad\ \ {\mathrm{d}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ad}}  d ← 2 s‾elect ad\ \ {\mathrm{d}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ad}}
108 moved := (axis c_at l:STEPS c_at d + (axis c_at l:STEPS) l:a_t state) l:p_ut state\ \ {\mathrm{moved}}\ {\leftarrow}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}\ {\mathrm{\underline{c}at}}\ {\mathrm{d}}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}  moved ← (axis c‾at lSTEPS c‾at d + (axis c‾at lSTEPS) la‾t state) lp‾ut state\ \ {\mathrm{moved}}\ {\leftarrow}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}\ {\mathrm{\underline{c}at}}\ {\mathrm{d}}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}
109 axis = l:IDIOM ? moved\ \ {\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {?}\ {\mathrm{moved}}  axis = lIDIOM ? moved\ \ {\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {?}\ {\mathrm{moved}}
110 other := 5.0 - axis\ \ {\mathrm{other}}\ {\leftarrow}\ {5.0}\ {-}\ {\mathrm{axis}}  other ← 5.0 − axis\ \ {\mathrm{other}}\ {\leftarrow}\ {5.0}\ {-}\ {\mathrm{axis}}
111 clash := (axis l:c_urrent moved) = other l:c_urrent moved\ \ {\mathrm{clash}}\ {\leftarrow}\ {(}{\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{moved}}{)}\ {=}\ {\mathrm{other}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{moved}}  clash ← (axis lc‾urrent moved) = other lc‾urrent moved\ \ {\mathrm{clash}}\ {\leftarrow}\ {(}{\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{moved}}{)}\ {=}\ {\mathrm{other}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{moved}}
112 "clash" i_f< "(axis c_at d) l:s_tep moved; moved"\ \ {\text{"clash"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"(axis c\_at d) l:s\_tep moved; moved"}}  "clash" i‾f< "(axis c_at d) l:s_tep moved; moved"\ \ {\text{"clash"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"(axis c\_at d) l:s\_tep moved; moved"}}
113}{\}}}{\}}
124l:c_hoose := { ak state ->{{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {\mathrm{ak}}\ {\mathrm{state}}\ {\to}lc‾hoose ← { ak state →{{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {\mathrm{ak}}\ {\mathrm{state}}\ {\to}
125 axis := 1 s_elect ak\ \ {\mathrm{axis}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ak}}  axis ← 1 s‾elect ak\ \ {\mathrm{axis}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ak}}
126 n := f_loor 0.5 + (axis c_at l:COUNT) l:a_t state\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  n ← f‾loor 0.5 + (axis c‾at lCOUNT) la‾t state\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
127 d := ((f_loor 2 s_elect ak) - axis l:c_urrent state) m_od n\ \ {\mathrm{d}}\ {\leftarrow}\ {(}{(}{\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ak}}{)}\ {-}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}  d ← ((f‾loor 2 s‾elect ak) − axis lc‾urrent state) m‾od n\ \ {\mathrm{d}}\ {\leftarrow}\ {(}{(}{\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ak}}{)}\ {-}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}
128 short := "(2 * d) > n" i_f< "d - n; d"\ \ {\mathrm{short}}\ {\leftarrow}\ {\text{"(2 * d) > n"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"d - n; d"}}  short ← "(2 * d) > n" i‾f< "d - n; d"\ \ {\mathrm{short}}\ {\leftarrow}\ {\text{"(2 * d) > n"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"d - n; d"}}
129 chosen := (axis c_at l:PLAYING c_at 0.0) l:p_ut (axis c_at f_loat short) l:s_tep state\ \ {\mathrm{chosen}}\ {\leftarrow}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{short}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  chosen ← (axis c‾at lPLAYING c‾at 0.0) lp‾ut (axis c‾at f‾loat short) ls‾tep state\ \ {\mathrm{chosen}}\ {\leftarrow}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{short}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
130 axis = l:IDIOM ? chosen\ \ {\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {?}\ {\mathrm{chosen}}  axis = lIDIOM ? chosen\ \ {\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {?}\ {\mathrm{chosen}}
131 (f_loor 2 s_elect ak) = (5.0 - axis) l:c_urrent state ? state\ \ {(}{\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ak}}{)}\ {=}\ {(}{5.0}\ {-}\ {\mathrm{axis}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{state}}\ {?}\ {\mathrm{state}}  (f‾loor 2 s‾elect ak) = (5.0 − axis) lc‾urrent state ? state\ \ {(}{\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ak}}{)}\ {=}\ {(}{5.0}\ {-}\ {\mathrm{axis}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{state}}\ {?}\ {\mathrm{state}}
132 chosen\ \ {\mathrm{chosen}}  chosen\ \ {\mathrm{chosen}}
133}{\}}}{\}}
141l:e_ase := { adt state ->{{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\leftarrow}\ {\{}\ {\mathrm{adt}}\ {\mathrm{state}}\ {\to}le‾ase ← { adt state →{{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\leftarrow}\ {\{}\ {\mathrm{adt}}\ {\mathrm{state}}\ {\to}
142 axis := 1 s_elect adt\ \ {\mathrm{axis}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{adt}}  axis ← 1 s‾elect adt\ \ {\mathrm{axis}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{adt}}
143 angle := (axis c_at l:ANGLE) l:a_t state\ \ {\mathrm{angle}}\ {\leftarrow}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  angle ← (axis c‾at lANGLE) la‾t state\ \ {\mathrm{angle}}\ {\leftarrow}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
144 target := 90.0 * (axis c_at l:STEPS) l:a_t state\ \ {\mathrm{target}}\ {\leftarrow}\ {90.0}\ {\times}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  target ← 90.0 × (axis c‾at lSTEPS) la‾t state\ \ {\mathrm{target}}\ {\leftarrow}\ {90.0}\ {\times}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
145 gap := target - angle\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{target}}\ {-}\ {\mathrm{angle}}  gap ← target − angle\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{target}}\ {-}\ {\mathrm{angle}}
146 moved := angle + gap * 1.0 m_in 2.0 * 2 s_elect adt\ \ {\mathrm{moved}}\ {\leftarrow}\ {\mathrm{angle}}\ {+}\ {\mathrm{gap}}\ {\times}\ {1.0}\ {\mathrm{\underline{m}in}}\ {2.0}\ {\times}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{adt}}  moved ← angle + gap × 1.0 m‾in 2.0 × 2 s‾elect adt\ \ {\mathrm{moved}}\ {\leftarrow}\ {\mathrm{angle}}\ {+}\ {\mathrm{gap}}\ {\times}\ {1.0}\ {\mathrm{\underline{m}in}}\ {2.0}\ {\times}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{adt}}
147 near := "0.5 > a_bs target - moved" i_f< "target; moved"\ \ {\mathrm{near}}\ {\leftarrow}\ {\text{"0.5 > a\_bs target - moved"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"target; moved"}}  near ← "0.5 > a_bs target - moved" i‾f< "target; moved"\ \ {\mathrm{near}}\ {\leftarrow}\ {\text{"0.5 > a\_bs target - moved"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"target; moved"}}
148 (axis c_at l:ANGLE c_at near) l:p_ut state\ \ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}\ {\mathrm{\underline{c}at}}\ {\mathrm{near}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}  (axis c‾at lANGLE c‾at near) lp‾ut state\ \ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}\ {\mathrm{\underline{c}at}}\ {\mathrm{near}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}
149}{\}}}{\}}
160l:s_ettle := { state -> (l:BOTTOM c_at 9.0) l:e_ase (l:TOP c_at 9.0) l:e_ase (l:IDIOM c_at 9.0) l:e_ase state }{{}^{\mathrm{l}}\mathrm{\underline{s}ettle}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\mathrm{state}}\ {\}}ls‾ettle ← { state → (lBOTTOM c‾at 9.0) le‾ase (lTOP c‾at 9.0) le‾ase (lIDIOM c‾at 9.0) le‾ase state }{{}^{\mathrm{l}}\mathrm{\underline{s}ettle}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\mathrm{state}}\ {\}}
171l:t_ick := { dt state ->{{}^{\mathrm{l}}\mathrm{\underline{t}ick}}\ {\leftarrow}\ {\{}\ {\mathrm{dt}}\ {\mathrm{state}}\ {\to}lt‾ick ← { dt state →{{}^{\mathrm{l}}\mathrm{\underline{t}ick}}\ {\leftarrow}\ {\{}\ {\mathrm{dt}}\ {\mathrm{state}}\ {\to}
172 eased := (l:BOTTOM c_at dt) l:e_ase (l:TOP c_at dt) l:e_ase (l:IDIOM c_at dt) l:e_ase state\ \ {\mathrm{eased}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\mathrm{state}}  eased ← (lBOTTOM c‾at dt) le‾ase (lTOP c‾at dt) le‾ase (lIDIOM c‾at dt) le‾ase state\ \ {\mathrm{eased}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\mathrm{state}}
173 idle := dt + (l:ATTRACT c_at l:IDLE) l:a_t state\ \ {\mathrm{idle}}\ {\leftarrow}\ {\mathrm{dt}}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  idle ← dt + (lATTRACT c‾at lIDLE) la‾t state\ \ {\mathrm{idle}}\ {\leftarrow}\ {\mathrm{dt}}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
174 since := dt + (l:ATTRACT c_at l:SINCE) l:a_t state\ \ {\mathrm{since}}\ {\leftarrow}\ {\mathrm{dt}}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{SINCE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  since ← dt + (lATTRACT c‾at lSINCE) la‾t state\ \ {\mathrm{since}}\ {\leftarrow}\ {\mathrm{dt}}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{SINCE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
175 timed := (l:ATTRACT c_at l:SINCE c_at since) l:p_ut (l:ATTRACT c_at l:IDLE c_at idle) l:p_ut eased\ \ {\mathrm{timed}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{SINCE}}\ {\mathrm{\underline{c}at}}\ {\mathrm{since}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}\ {\mathrm{\underline{c}at}}\ {\mathrm{idle}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{eased}}  timed ← (lATTRACT c‾at lSINCE c‾at since) lp‾ut (lATTRACT c‾at lIDLE c‾at idle) lp‾ut eased\ \ {\mathrm{timed}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{SINCE}}\ {\mathrm{\underline{c}at}}\ {\mathrm{since}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}\ {\mathrm{\underline{c}at}}\ {\mathrm{idle}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{eased}}
176 (idle < l:idleBefore) | since < l:dwell ? timed\ \ {(}{\mathrm{idle}}\ {<}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}{)}\ {\vee}\ {\mathrm{since}}\ {<}\ {{}^{\mathrm{l}}\mathrm{dwell}}\ {?}\ {\mathrm{timed}}  (idle < lidleBefore) ∨ since < ldwell ? timed\ \ {(}{\mathrm{idle}}\ {<}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}{)}\ {\vee}\ {\mathrm{since}}\ {<}\ {{}^{\mathrm{l}}\mathrm{dwell}}\ {?}\ {\mathrm{timed}}
177 l:a_ttract (l:ATTRACT c_at l:SINCE c_at 0.0) l:p_ut timed\ \ {{}^{\mathrm{l}}\mathrm{\underline{a}ttract}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{SINCE}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{timed}}  la‾ttract (lATTRACT c‾at lSINCE c‾at 0.0) lp‾ut timed\ \ {{}^{\mathrm{l}}\mathrm{\underline{a}ttract}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{SINCE}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{timed}}
178}{\}}}{\}}
196l:a_ttract := { state ->{{}^{\mathrm{l}}\mathrm{\underline{a}ttract}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}la‾ttract ← { state →{{}^{\mathrm{l}}\mathrm{\underline{a}ttract}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}
197 n := (f_loor 0.5 + (l:TOP c_at l:COUNT) l:a_t state) - 1\ \ {\mathrm{n}}\ {\leftarrow}\ {(}{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {-}\ {1}  n ← (f‾loor 0.5 + (lTOP c‾at lCOUNT) la‾t state) − 1\ \ {\mathrm{n}}\ {\leftarrow}\ {(}{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {-}\ {1}
198 m := f_loor 0.5 + (l:IDIOM c_at l:COUNT) l:a_t state\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  m ← f‾loor 0.5 + (lIDIOM c‾at lCOUNT) la‾t state\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
199 bottoms := 1.0 + (l:ATTRACT c_at l:BOTTOMS) l:a_t state\ \ {\mathrm{bottoms}}\ {\leftarrow}\ {1.0}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{BOTTOMS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  bottoms ← 1.0 + (lATTRACT c‾at lBOTTOMS) la‾t state\ \ {\mathrm{bottoms}}\ {\leftarrow}\ {1.0}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{BOTTOMS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
200 idioms := 1.0 + (l:ATTRACT c_at l:IDIOMS) l:a_t state\ \ {\mathrm{idioms}}\ {\leftarrow}\ {1.0}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDIOMS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  idioms ← 1.0 + (lATTRACT c‾at lIDIOMS) la‾t state\ \ {\mathrm{idioms}}\ {\leftarrow}\ {1.0}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDIOMS}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
201 moved := l:BOTTOM l:p_lay state\ \ {\mathrm{moved}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {\mathrm{state}}  moved ← lBOTTOM lp‾lay state\ \ {\mathrm{moved}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {\mathrm{state}}
202 bottoms < f_loat n ? (l:ATTRACT c_at l:BOTTOMS c_at bottoms) l:p_ut moved\ \ {\mathrm{bottoms}}\ {<}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{BOTTOMS}}\ {\mathrm{\underline{c}at}}\ {\mathrm{bottoms}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{moved}}  bottoms < f‾loat n ? (lATTRACT c‾at lBOTTOMS c‾at bottoms) lp‾ut moved\ \ {\mathrm{bottoms}}\ {<}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{BOTTOMS}}\ {\mathrm{\underline{c}at}}\ {\mathrm{bottoms}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{moved}}
203 rolled := l:IDIOM l:p_lay (l:ATTRACT c_at l:BOTTOMS c_at 0.0) l:p_ut moved\ \ {\mathrm{rolled}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{BOTTOMS}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{moved}}  rolled ← lIDIOM lp‾lay (lATTRACT c‾at lBOTTOMS c‾at 0.0) lp‾ut moved\ \ {\mathrm{rolled}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{BOTTOMS}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{moved}}
204 idioms < f_loat m ? (l:ATTRACT c_at l:IDIOMS c_at idioms) l:p_ut rolled\ \ {\mathrm{idioms}}\ {<}\ {\mathrm{\underline{f}loat}}\ {\mathrm{m}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDIOMS}}\ {\mathrm{\underline{c}at}}\ {\mathrm{idioms}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{rolled}}  idioms < f‾loat m ? (lATTRACT c‾at lIDIOMS c‾at idioms) lp‾ut rolled\ \ {\mathrm{idioms}}\ {<}\ {\mathrm{\underline{f}loat}}\ {\mathrm{m}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDIOMS}}\ {\mathrm{\underline{c}at}}\ {\mathrm{idioms}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{rolled}}
205 l:TOP l:p_lay (l:ATTRACT c_at l:IDIOMS c_at 0.0) l:p_ut rolled\ \ {{}^{\mathrm{l}}\mathrm{TOP}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDIOMS}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{rolled}}  lTOP lp‾lay (lATTRACT c‾at lIDIOMS c‾at 0.0) lp‾ut rolled\ \ {{}^{\mathrm{l}}\mathrm{TOP}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDIOMS}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{rolled}}
206}{\}}}{\}}
209l:p_lay := { axis state -> "1.0 = (axis c_at l:PLAYING) l:a_t state" i_f< "(axis c_at 1.0) l:s_tep state; state" }{{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {\text{"1.0 = (axis c\_at l:PLAYING) l:a\_t state"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"(axis c\_at 1.0) l:s\_tep state; state"}}\ {\}}lp‾lay ← { axis state → "1.0 = (axis c_at l:PLAYING) l:a_t state" i‾f< "(axis c_at 1.0) l:s_tep state; state" }{{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {\text{"1.0 = (axis c\_at l:PLAYING) l:a\_t state"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"(axis c\_at 1.0) l:s\_tep state; state"}}\ {\}}
212l:t_ouched := { state -> (l:ATTRACT c_at l:SINCE c_at 0.0) l:p_ut (l:ATTRACT c_at l:IDLE c_at 0.0) l:p_ut state }{{}^{\mathrm{l}}\mathrm{\underline{t}ouched}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{SINCE}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}\ {\}}lt‾ouched ← { state → (lATTRACT c‾at lSINCE c‾at 0.0) lp‾ut (lATTRACT c‾at lIDLE c‾at 0.0) lp‾ut state }{{}^{\mathrm{l}}\mathrm{\underline{t}ouched}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{SINCE}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}\ {\}}
215l:r_esume := { state -> (l:BOTTOM c_at l:PLAYING c_at 1.0) l:p_ut (l:TOP c_at l:PLAYING c_at 1.0) l:p_ut (l:IDIOM c_at l:PLAYING c_at 1.0) l:p_ut state }{{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}\ {\}}lr‾esume ← { state → (lBOTTOM c‾at lPLAYING c‾at 1.0) lp‾ut (lTOP c‾at lPLAYING c‾at 1.0) lp‾ut (lIDIOM c‾at lPLAYING c‾at 1.0) lp‾ut state }{{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}\ {\}}
226l:t_oggleTour := { state ->{{}^{\mathrm{l}}\mathrm{\underline{t}oggleTour}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}lt‾oggleTour ← { state →{{}^{\mathrm{l}}\mathrm{\underline{t}oggleTour}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}
227 playing := ((l:IDIOM c_at l:PLAYING) l:a_t state) + ((l:TOP c_at l:PLAYING) l:a_t state) + (l:BOTTOM c_at l:PLAYING) l:a_t state\ \ {\mathrm{playing}}\ {\leftarrow}\ {(}{(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {+}\ {(}{(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  playing ← ((lIDIOM c‾at lPLAYING) la‾t state) + ((lTOP c‾at lPLAYING) la‾t state) + (lBOTTOM c‾at lPLAYING) la‾t state\ \ {\mathrm{playing}}\ {\leftarrow}\ {(}{(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {+}\ {(}{(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
228 0.0 < playing ? (l:BOTTOM c_at l:PLAYING c_at 0.0) l:p_ut (l:TOP c_at l:PLAYING c_at 0.0) l:p_ut (l:IDIOM c_at l:PLAYING c_at 0.0) l:p_ut state\ \ {0.0}\ {<}\ {\mathrm{playing}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}  0.0 < playing ? (lBOTTOM c‾at lPLAYING c‾at 0.0) lp‾ut (lTOP c‾at lPLAYING c‾at 0.0) lp‾ut (lIDIOM c‾at lPLAYING c‾at 0.0) lp‾ut state\ \ {0.0}\ {<}\ {\mathrm{playing}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}
229 l:r_esume state\ \ {{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\mathrm{state}}  lr‾esume state\ \ {{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\mathrm{state}}
230}{\}}}{\}}
244l:m_ode := { state ->{{}^{\mathrm{l}}\mathrm{\underline{m}ode}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}lm‾ode ← { state →{{}^{\mathrm{l}}\mathrm{\underline{m}ode}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}
245 p_aused := { axis -> 0.0 = (axis c_at l:PLAYING) l:a_t state }\ \ {\mathrm{\underline{p}aused}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\to}\ {0.0}\ {=}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}\ {\}}  p‾aused ← { axis → 0.0 = (axis c‾at lPLAYING) la‾t state }\ \ {\mathrm{\underline{p}aused}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\to}\ {0.0}\ {=}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}\ {\}}
246 paused := (p_aused l:IDIOM) c_at (p_aused l:TOP) c_at p_aused l:BOTTOM\ \ {\mathrm{paused}}\ {\leftarrow}\ {(}{\mathrm{\underline{p}aused}}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{p}aused}}\ {{}^{\mathrm{l}}\mathrm{TOP}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{p}aused}}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}  paused ← (p‾aused lIDIOM) c‾at (p‾aused lTOP) c‾at p‾aused lBOTTOM\ \ {\mathrm{paused}}\ {\leftarrow}\ {(}{\mathrm{\underline{p}aused}}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{p}aused}}\ {{}^{\mathrm{l}}\mathrm{TOP}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{p}aused}}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}
247 3 = '+ r_/ paused ? "paused"\ \ {3}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{paused}}\ {?}\ {\text{"paused"}}  3 = ’+ r‾/ paused ? "paused"\ \ {3}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{paused}}\ {?}\ {\text{"paused"}}
248 names := paused r_eplicate (e_nclose "roll") c_at (e_nclose "top") c_at e_nclose "bottom"\ \ {\mathrm{names}}\ {\leftarrow}\ {\mathrm{paused}}\ {\mathrm{\underline{r}eplicate}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"roll"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"top"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"bottom"}}  names ← paused r‾eplicate (e‾nclose "roll") c‾at (e‾nclose "top") c‾at e‾nclose "bottom"\ \ {\mathrm{names}}\ {\leftarrow}\ {\mathrm{paused}}\ {\mathrm{\underline{r}eplicate}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"roll"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"top"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"bottom"}}
249 0 < '+ r_/ paused ? "paused: " c_at d_isclose '{ x y -> e_nclose (d_isclose x) c_at ", " c_at d_isclose y } r_/ names\ \ {0}\ {<}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{paused}}\ {?}\ {\text{"paused: "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{", "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{names}}  0 < ’+ r‾/ paused ? "paused: " c‾at d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at ", " c‾at d‾isclose y } r‾/ names\ \ {0}\ {<}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{paused}}\ {?}\ {\text{"paused: "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{", "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{names}}
250 l:idleBefore > (l:ATTRACT c_at l:IDLE) l:a_t state ? "holding"\ \ {{}^{\mathrm{l}}\mathrm{idleBefore}}\ {>}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}\ {?}\ {\text{"holding"}}  lidleBefore > (lATTRACT c‾at lIDLE) la‾t state ? "holding"\ \ {{}^{\mathrm{l}}\mathrm{idleBefore}}\ {>}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}\ {?}\ {\text{"holding"}}
251 "touring"\ \ {\text{"touring"}}  "touring"\ \ {\text{"touring"}}
252}{\}}}{\}}
255l:t_oggle := { axis state -> (axis c_at l:PLAYING c_at 1.0 - (axis c_at l:PLAYING) l:a_t state) l:p_ut state }{{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {1.0}\ {-}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}\ {\}}lt‾oggle ← { axis state → (axis c‾at lPLAYING c‾at 1.0 − (axis c‾at lPLAYING) la‾t state) lp‾ut state }{{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}\ {\mathrm{\underline{c}at}}\ {1.0}\ {-}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{PLAYING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}\ {\}}
267l:u_pdate := { state e ->{{}^{\mathrm{l}}\mathrm{\underline{u}pdate}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\mathrm{e}}\ {\to}lu‾pdate ← { state e →{{}^{\mathrm{l}}\mathrm{\underline{u}pdate}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\mathrm{e}}\ {\to}
268 kind := []E_KIND e\ \ {\mathrm{kind}}\ {\leftarrow}\ {\square \mathrm{\underline{E}KIND}}\ {\mathrm{e}}  kind ← □E‾KIND e\ \ {\mathrm{kind}}\ {\leftarrow}\ {\square \mathrm{\underline{E}KIND}}\ {\mathrm{e}}
269 kind m_atch "tick" ? (f_irst []E_AT e) l:t_ick state\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"tick"}}\ {?}\ {(}{\mathrm{\underline{f}irst}}\ {\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{t}ick}}\ {\mathrm{state}}  kind m‾atch "tick" ? (f‾irst □E‾AT e) lt‾ick state\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"tick"}}\ {?}\ {(}{\mathrm{\underline{f}irst}}\ {\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{t}ick}}\ {\mathrm{state}}
270 touched := l:t_ouched state\ \ {\mathrm{touched}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{t}ouched}}\ {\mathrm{state}}  touched ← lt‾ouched state\ \ {\mathrm{touched}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{t}ouched}}\ {\mathrm{state}}
271 kind m_atch "key" ? ([]E_KEY e) l:k_ey touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"key"}}\ {?}\ {(}{\square \mathrm{\underline{E}KEY}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{k}ey}}\ {\mathrm{touched}}  kind m‾atch "key" ? (□E‾KEY e) lk‾ey touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"key"}}\ {?}\ {(}{\square \mathrm{\underline{E}KEY}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{k}ey}}\ {\mathrm{touched}}
272 kind m_atch "down" ? ([]E_AT e) l:d_own touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"down"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{d}own}}\ {\mathrm{touched}}  kind m‾atch "down" ? (□E‾AT e) ld‾own touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"down"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{d}own}}\ {\mathrm{touched}}
273 kind m_atch "move" ? ([]E_AT e) l:m_ove touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"move"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{m}ove}}\ {\mathrm{touched}}  kind m‾atch "move" ? (□E‾AT e) lm‾ove touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"move"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{m}ove}}\ {\mathrm{touched}}
274 kind m_atch "up" ? ([]E_AT e) l:u_p touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"up"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{u}p}}\ {\mathrm{touched}}  kind m‾atch "up" ? (□E‾AT e) lu‾p touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"up"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{u}p}}\ {\mathrm{touched}}
275 kind m_atch "click" ? ([]E_AT e) l:c_lick touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"click"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\mathrm{touched}}  kind m‾atch "click" ? (□E‾AT e) lc‾lick touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"click"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\mathrm{touched}}
276 kind m_atch "choose" ? ([]E_AT e) l:c_hoose touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"choose"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{touched}}  kind m‾atch "choose" ? (□E‾AT e) lc‾hoose touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"choose"}}\ {?}\ {(}{\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{touched}}
277 state\ \ {\mathrm{state}}  state\ \ {\mathrm{state}}
278}{\}}}{\}}
282l:h_alf := { xy -> "(2 s_elect xy) < l:middle" i_f< "l:TOP; l:BOTTOM" }{{}^{\mathrm{l}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\to}\ {\text{"(2 s\_elect xy) < l:middle"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"l:TOP; l:BOTTOM"}}\ {\}}lh‾alf ← { xy → "(2 s_elect xy) < l:middle" i‾f< "l:TOP; l:BOTTOM" }{{}^{\mathrm{l}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\to}\ {\text{"(2 s\_elect xy) < l:middle"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"l:TOP; l:BOTTOM"}}\ {\}}
289l:d_own := { xy state -> (l:POINTER c_at l:LAST c_at 0.0) l:p_ut (l:POINTER c_at l:MOVED c_at 0.0) l:p_ut (l:POINTER c_at l:Y c_at 2 s_elect xy) l:p_ut (l:POINTER c_at l:X c_at 1 s_elect xy) l:p_ut (l:POINTER c_at l:DRAGGING c_at 0.5) l:p_ut state }{{}^{\mathrm{l}}\mathrm{\underline{d}own}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{LAST}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{MOVED}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{Y}}\ {\mathrm{\underline{c}at}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{X}}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}\ {\mathrm{\underline{c}at}}\ {0.5}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}\ {\}}ld‾own ← { xy state → (lPOINTER c‾at lLAST c‾at 0.0) lp‾ut (lPOINTER c‾at lMOVED c‾at 0.0) lp‾ut (lPOINTER c‾at lY c‾at 2 s‾elect xy) lp‾ut (lPOINTER c‾at lX c‾at 1 s‾elect xy) lp‾ut (lPOINTER c‾at lDRAGGING c‾at 0.5) lp‾ut state }{{}^{\mathrm{l}}\mathrm{\underline{d}own}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{LAST}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{MOVED}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{Y}}\ {\mathrm{\underline{c}at}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{X}}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}\ {\mathrm{\underline{c}at}}\ {0.5}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}\ {\}}
303l:m_ove := { xy state ->{{}^{\mathrm{l}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}lm‾ove ← { xy state →{{}^{\mathrm{l}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}
304 held := (l:POINTER c_at l:DRAGGING) l:a_t state\ \ {\mathrm{held}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  held ← (lPOINTER c‾at lDRAGGING) la‾t state\ \ {\mathrm{held}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
305 held = 0.0 ? state\ \ {\mathrm{held}}\ {=}\ {0.0}\ {?}\ {\mathrm{state}}  held = 0.0 ? state\ \ {\mathrm{held}}\ {=}\ {0.0}\ {?}\ {\mathrm{state}}
306 dx := (1 s_elect xy) - (l:POINTER c_at l:X) l:a_t state\ \ {\mathrm{dx}}\ {\leftarrow}\ {(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {-}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{X}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  dx ← (1 s‾elect xy) − (lPOINTER c‾at lX) la‾t state\ \ {\mathrm{dx}}\ {\leftarrow}\ {(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {-}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{X}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
307 dy := (2 s_elect xy) - (l:POINTER c_at l:Y) l:a_t state\ \ {\mathrm{dy}}\ {\leftarrow}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {-}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{Y}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  dy ← (2 s‾elect xy) − (lPOINTER c‾at lY) la‾t state\ \ {\mathrm{dy}}\ {\leftarrow}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {-}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{Y}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
308 moved := (a_bs dx) + (a_bs dy) + (l:POINTER c_at l:MOVED) l:a_t state\ \ {\mathrm{moved}}\ {\leftarrow}\ {(}{\mathrm{\underline{a}bs}}\ {\mathrm{dx}}{)}\ {+}\ {(}{\mathrm{\underline{a}bs}}\ {\mathrm{dy}}{)}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{MOVED}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  moved ← (a‾bs dx) + (a‾bs dy) + (lPOINTER c‾at lMOVED) la‾t state\ \ {\mathrm{moved}}\ {\leftarrow}\ {(}{\mathrm{\underline{a}bs}}\ {\mathrm{dx}}{)}\ {+}\ {(}{\mathrm{\underline{a}bs}}\ {\mathrm{dy}}{)}\ {+}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{MOVED}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
309 placed := (l:POINTER c_at l:MOVED c_at moved) l:p_ut (l:POINTER c_at l:Y c_at 2 s_elect xy) l:p_ut (l:POINTER c_at l:X c_at 1 s_elect xy) l:p_ut state\ \ {\mathrm{placed}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{MOVED}}\ {\mathrm{\underline{c}at}}\ {\mathrm{moved}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{Y}}\ {\mathrm{\underline{c}at}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{X}}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}  placed ← (lPOINTER c‾at lMOVED c‾at moved) lp‾ut (lPOINTER c‾at lY c‾at 2 s‾elect xy) lp‾ut (lPOINTER c‾at lX c‾at 1 s‾elect xy) lp‾ut state\ \ {\mathrm{placed}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{MOVED}}\ {\mathrm{\underline{c}at}}\ {\mathrm{moved}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{Y}}\ {\mathrm{\underline{c}at}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{X}}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}
310 (held = 0.5) & moved <= 4.0 ? placed\ \ {(}{\mathrm{held}}\ {=}\ {0.5}{)}\ {\wedge}\ {\mathrm{moved}}\ {\leq}\ {4.0}\ {?}\ {\mathrm{placed}}  (held = 0.5) ∧ moved ≤ 4.0 ? placed\ \ {(}{\mathrm{held}}\ {=}\ {0.5}{)}\ {\wedge}\ {\mathrm{moved}}\ {\leq}\ {4.0}\ {?}\ {\mathrm{placed}}
311 axis := "held = 0.5" i_f< "\"(a_bs dx) >= a_bs dy\" i_f< \"l:h_alf xy; l:IDIOM\"; held"\ \ {\mathrm{axis}}\ {\leftarrow}\ {\text{"held = 0.5"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"(a\_bs dx) >= a\_bs dy\textbackslash{}" i\_f< \textbackslash{}"l:h\_alf xy; l:IDIOM\textbackslash{}"; held"}}  axis ← "held = 0.5" i‾f< "\"(a_bs dx) >= a_bs dy\" i_f< \"l:h_alf xy; l:IDIOM\"; held"\ \ {\mathrm{axis}}\ {\leftarrow}\ {\text{"held = 0.5"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"(a\_bs dx) >= a\_bs dy\textbackslash{}" i\_f< \textbackslash{}"l:h\_alf xy; l:IDIOM\textbackslash{}"; held"}}
312 along := "axis = l:IDIOM" i_f< "dy; dx"\ \ {\mathrm{along}}\ {\leftarrow}\ {\text{"axis = l:IDIOM"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"dy; dx"}}  along ← "axis = l:IDIOM" i‾f< "dy; dx"\ \ {\mathrm{along}}\ {\leftarrow}\ {\text{"axis = l:IDIOM"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"dy; dx"}}
313 turn := n_eg along * l:perPixel\ \ {\mathrm{turn}}\ {\leftarrow}\ {\mathrm{\underline{n}eg}}\ {\mathrm{along}}\ {\times}\ {{}^{\mathrm{l}}\mathrm{perPixel}}  turn ← n‾eg along × lperPixel\ \ {\mathrm{turn}}\ {\leftarrow}\ {\mathrm{\underline{n}eg}}\ {\mathrm{along}}\ {\times}\ {{}^{\mathrm{l}}\mathrm{perPixel}}
314 angle := turn + (axis c_at l:ANGLE) l:a_t placed\ \ {\mathrm{angle}}\ {\leftarrow}\ {\mathrm{turn}}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{placed}}  angle ← turn + (axis c‾at lANGLE) la‾t placed\ \ {\mathrm{angle}}\ {\leftarrow}\ {\mathrm{turn}}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{placed}}
315 (l:POINTER c_at l:LAST c_at turn) l:p_ut (l:POINTER c_at l:DRAGGING c_at axis) l:p_ut (axis c_at l:ANGLE c_at angle) l:p_ut placed\ \ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{LAST}}\ {\mathrm{\underline{c}at}}\ {\mathrm{turn}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}\ {\mathrm{\underline{c}at}}\ {\mathrm{axis}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}\ {\mathrm{\underline{c}at}}\ {\mathrm{angle}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{placed}}  (lPOINTER c‾at lLAST c‾at turn) lp‾ut (lPOINTER c‾at lDRAGGING c‾at axis) lp‾ut (axis c‾at lANGLE c‾at angle) lp‾ut placed\ \ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{LAST}}\ {\mathrm{\underline{c}at}}\ {\mathrm{turn}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}\ {\mathrm{\underline{c}at}}\ {\mathrm{axis}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}\ {\mathrm{\underline{c}at}}\ {\mathrm{angle}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{placed}}
316}{\}}}{\}}
327l:u_p := { xy state ->{{}^{\mathrm{l}}\mathrm{\underline{u}p}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}lu‾p ← { xy state →{{}^{\mathrm{l}}\mathrm{\underline{u}p}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}
328 held := (l:POINTER c_at l:DRAGGING) l:a_t state\ \ {\mathrm{held}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  held ← (lPOINTER c‾at lDRAGGING) la‾t state\ \ {\mathrm{held}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
329 held = 0.0 ? state\ \ {\mathrm{held}}\ {=}\ {0.0}\ {?}\ {\mathrm{state}}  held = 0.0 ? state\ \ {\mathrm{held}}\ {=}\ {0.0}\ {?}\ {\mathrm{state}}
330 released := (l:POINTER c_at l:DRAGGING c_at 0.0) l:p_ut state\ \ {\mathrm{released}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}  released ← (lPOINTER c‾at lDRAGGING c‾at 0.0) lp‾ut state\ \ {\mathrm{released}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{DRAGGING}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{state}}
331 held = 0.5 ? xy l:c_lick released\ \ {\mathrm{held}}\ {=}\ {0.5}\ {?}\ {\mathrm{xy}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\mathrm{released}}  held = 0.5 ? xy lc‾lick released\ \ {\mathrm{held}}\ {=}\ {0.5}\ {?}\ {\mathrm{xy}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\mathrm{released}}
332 last := (l:POINTER c_at l:LAST) l:a_t state\ \ {\mathrm{last}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{LAST}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  last ← (lPOINTER c‾at lLAST) la‾t state\ \ {\mathrm{last}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{POINTER}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{LAST}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
333 flick := "6.0 < a_bs last" i_f< "45.0 * last / a_bs last; 0.0"\ \ {\mathrm{flick}}\ {\leftarrow}\ {\text{"6.0 < a\_bs last"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"45.0 * last / a\_bs last; 0.0"}}  flick ← "6.0 < a_bs last" i‾f< "45.0 * last / a_bs last; 0.0"\ \ {\mathrm{flick}}\ {\leftarrow}\ {\text{"6.0 < a\_bs last"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"45.0 * last / a\_bs last; 0.0"}}
334 angle := (held c_at l:ANGLE) l:a_t state\ \ {\mathrm{angle}}\ {\leftarrow}\ {(}{\mathrm{held}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  angle ← (held c‾at lANGLE) la‾t state\ \ {\mathrm{angle}}\ {\leftarrow}\ {(}{\mathrm{held}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
335 (held c_at l:STEPS c_at f_loat f_loor 0.5 + (angle + flick) / 90.0) l:p_ut released\ \ {(}{\mathrm{held}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{angle}}\ {+}\ {\mathrm{flick}}{)}\ {\div}\ {90.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{released}}  (held c‾at lSTEPS c‾at f‾loat f‾loor 0.5 + (angle + flick) ÷ 90.0) lp‾ut released\ \ {(}{\mathrm{held}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{STEPS}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{angle}}\ {+}\ {\mathrm{flick}}{)}\ {\div}\ {90.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {\mathrm{released}}
336}{\}}}{\}}
342l:c_lick := { xy state -> (l:h_alf xy) l:t_oggle state }{{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{h}alf}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\mathrm{state}}\ {\}}lc‾lick ← { xy state → (lh‾alf xy) lt‾oggle state }{{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{h}alf}}\ {\mathrm{xy}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\mathrm{state}}\ {\}}
346l:k_ey := { k state ->{{}^{\mathrm{l}}\mathrm{\underline{k}ey}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{state}}\ {\to}lk‾ey ← { k state →{{}^{\mathrm{l}}\mathrm{\underline{k}ey}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{state}}\ {\to}
347 k = []K_NAMED 1 ? (l:IDIOM c_at -1.0) l:s_tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {1}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {-1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  k = □K‾NAMED 1 ? (lIDIOM c‾at −1.0) ls‾tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {1}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {-1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
348 k = []K_NAMED 2 ? (l:IDIOM c_at 1.0) l:s_tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {2}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  k = □K‾NAMED 2 ? (lIDIOM c‾at 1.0) ls‾tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {2}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
349 k = []K_NAMED 3 ? (l:TOP c_at -1.0) l:s_tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {3}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {-1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  k = □K‾NAMED 3 ? (lTOP c‾at −1.0) ls‾tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {3}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {-1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
350 k = []K_NAMED 4 ? (l:TOP c_at 1.0) l:s_tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {4}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  k = □K‾NAMED 4 ? (lTOP c‾at 1.0) ls‾tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {4}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
351 c := []K_CHAR k\ \ {\mathrm{c}}\ {\leftarrow}\ {\square \mathrm{\underline{K}CHAR}}\ {\mathrm{k}}  c ← □K‾CHAR k\ \ {\mathrm{c}}\ {\leftarrow}\ {\square \mathrm{\underline{K}CHAR}}\ {\mathrm{k}}
352 c m_atch "a" ? (l:BOTTOM c_at -1.0) l:s_tep state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"a"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {-1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  c m‾atch "a" ? (lBOTTOM c‾at −1.0) ls‾tep state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"a"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {-1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
353 c m_atch "d" ? (l:BOTTOM c_at 1.0) l:s_tep state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"d"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  c m‾atch "d" ? (lBOTTOM c‾at 1.0) ls‾tep state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"d"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
354 c m_atch " " ? l:t_oggleTour state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{" "}}\ {?}\ {{}^{\mathrm{l}}\mathrm{\underline{t}oggleTour}}\ {\mathrm{state}}  c m‾atch " " ? lt‾oggleTour state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{" "}}\ {?}\ {{}^{\mathrm{l}}\mathrm{\underline{t}oggleTour}}\ {\mathrm{state}}
355 c m_atch "r" ? (l:ATTRACT c_at l:IDLE c_at l:idleBefore) l:p_ut l:r_esume state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"r"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\mathrm{state}}  c m‾atch "r" ? (lATTRACT c‾at lIDLE c‾at lidleBefore) lp‾ut lr‾esume state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"r"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{ATTRACT}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{IDLE}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{p}ut}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\mathrm{state}}
356 c m_atch "s" ? l:BOTTOM l:t_oggle state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"s"}}\ {?}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\mathrm{state}}  c m‾atch "s" ? lBOTTOM lt‾oggle state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"s"}}\ {?}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\mathrm{state}}
357 c m_atch "w" ? l:IDIOM l:t_oggle state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"w"}}\ {?}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\mathrm{state}}  c m‾atch "w" ? lIDIOM lt‾oggle state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"w"}}\ {?}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\mathrm{state}}
358 state\ \ {\mathrm{state}}  state\ \ {\mathrm{state}}
359}{\}}}{\}}

demos/rosetta/Stone.xtl

14"g:" u_se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}"g:" u‾se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}
15"v:" u_se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}"v:" u‾se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}
20l:width := 2.4{{}^{\mathrm{l}}\mathrm{width}}\ {\leftarrow}\ {2.4}lwidth ← 2.4{{}^{\mathrm{l}}\mathrm{width}}\ {\leftarrow}\ {2.4}
21l:height := 2.0{{}^{\mathrm{l}}\mathrm{height}}\ {\leftarrow}\ {2.0}lheight ← 2.0{{}^{\mathrm{l}}\mathrm{height}}\ {\leftarrow}\ {2.0}
22l:depth := 2.0{{}^{\mathrm{l}}\mathrm{depth}}\ {\leftarrow}\ {2.0}ldepth ← 2.0{{}^{\mathrm{l}}\mathrm{depth}}\ {\leftarrow}\ {2.0}
23l:eye := 7.0{{}^{\mathrm{l}}\mathrm{eye}}\ {\leftarrow}\ {7.0}leye ← 7.0{{}^{\mathrm{l}}\mathrm{eye}}\ {\leftarrow}\ {7.0}
24l:size := 420.0{{}^{\mathrm{l}}\mathrm{size}}\ {\leftarrow}\ {420.0}lsize ← 420.0{{}^{\mathrm{l}}\mathrm{size}}\ {\leftarrow}\ {420.0}
25zoom := 112.0{\mathrm{zoom}}\ {\leftarrow}\ {112.0}zoom ← 112.0{\mathrm{zoom}}\ {\leftarrow}\ {112.0}
30l:b_ox := { whd -> (3 8 r_eshape 8 r_eplicate 0.5 * whd) * g:c_ube 2 }{{}^{\mathrm{l}}\mathrm{\underline{b}ox}}\ {\leftarrow}\ {\{}\ {\mathrm{whd}}\ {\to}\ {(}{3}\ {8}\ {\mathrm{\underline{r}eshape}}\ {8}\ {\mathrm{\underline{r}eplicate}}\ {0.5}\ {\times}\ {\mathrm{whd}}{)}\ {\times}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ube}}\ {2}\ {\}}lb‾ox ← { whd → (3 8 r‾eshape 8 r‾eplicate 0.5 × whd) × gc‾ube 2 }{{}^{\mathrm{l}}\mathrm{\underline{b}ox}}\ {\leftarrow}\ {\{}\ {\mathrm{whd}}\ {\to}\ {(}{3}\ {8}\ {\mathrm{\underline{r}eshape}}\ {8}\ {\mathrm{\underline{r}eplicate}}\ {0.5}\ {\times}\ {\mathrm{whd}}{)}\ {\times}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ube}}\ {2}\ {\}}
34l:v_iew := { points -> ((g:r_otX 22.0) g:t_urn g:r_otY -28.0) g:t_urn points }{{}^{\mathrm{l}}\mathrm{\underline{v}iew}}\ {\leftarrow}\ {\{}\ {\mathrm{points}}\ {\to}\ {(}{(}{{}^{\mathrm{g}}\mathrm{\underline{r}otX}}\ {22.0}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {{}^{\mathrm{g}}\mathrm{\underline{r}otY}}\ {-28.0}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{points}}\ {\}}lv‾iew ← { points → ((gr‾otX 22.0) gt‾urn gr‾otY −28.0) gt‾urn points }{{}^{\mathrm{l}}\mathrm{\underline{v}iew}}\ {\leftarrow}\ {\{}\ {\mathrm{points}}\ {\to}\ {(}{(}{{}^{\mathrm{g}}\mathrm{\underline{r}otX}}\ {22.0}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {{}^{\mathrm{g}}\mathrm{\underline{r}otY}}\ {-28.0}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{points}}\ {\}}
38l:s_creen := { points ->{{}^{\mathrm{l}}\mathrm{\underline{s}creen}}\ {\leftarrow}\ {\{}\ {\mathrm{points}}\ {\to}ls‾creen ← { points →{{}^{\mathrm{l}}\mathrm{\underline{s}creen}}\ {\leftarrow}\ {\{}\ {\mathrm{points}}\ {\to}
39 p := l:eye g:p_roject points\ \ {\mathrm{p}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{eye}}\ {{}^{\mathrm{g}}\mathrm{\underline{p}roject}}\ {\mathrm{points}}  p ← leye gp‾roject points\ \ {\mathrm{p}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{eye}}\ {{}^{\mathrm{g}}\mathrm{\underline{p}roject}}\ {\mathrm{points}}
40 xs := (l:size / 2) + zoom * 1 s_elect p\ \ {\mathrm{xs}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{size}}\ {\div}\ {2}{)}\ {+}\ {\mathrm{zoom}}\ {\times}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}  xs ← (lsize ÷ 2) + zoom × 1 s‾elect p\ \ {\mathrm{xs}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{size}}\ {\div}\ {2}{)}\ {+}\ {\mathrm{zoom}}\ {\times}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
41 ys := (l:size / 2) - zoom * 2 s_elect p\ \ {\mathrm{ys}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{size}}\ {\div}\ {2}{)}\ {-}\ {\mathrm{zoom}}\ {\times}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}  ys ← (lsize ÷ 2) − zoom × 2 s‾elect p\ \ {\mathrm{ys}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{size}}\ {\div}\ {2}{)}\ {-}\ {\mathrm{zoom}}\ {\times}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
42 (2 c_at t_ally xs) r_eshape xs c_at ys\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{xs}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{xs}}\ {\mathrm{\underline{c}at}}\ {\mathrm{ys}}  (2 c‾at t‾ally xs) r‾eshape xs c‾at ys\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{xs}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{xs}}\ {\mathrm{\underline{c}at}}\ {\mathrm{ys}}
43}{\}}}{\}}
52l:b_ase := { a -> f_loor a / 90.0 }{{}^{\mathrm{l}}\mathrm{\underline{b}ase}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\to}\ {\mathrm{\underline{f}loor}}\ {\mathrm{a}}\ {\div}\ {90.0}\ {\}}lb‾ase ← { a → f‾loor a ÷ 90.0 }{{}^{\mathrm{l}}\mathrm{\underline{b}ase}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\to}\ {\mathrm{\underline{f}loor}}\ {\mathrm{a}}\ {\div}\ {90.0}\ {\}}
53l:p_art := { a -> a - 90.0 * f_loat l:b_ase a }{{}^{\mathrm{l}}\mathrm{\underline{p}art}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\to}\ {\mathrm{a}}\ {-}\ {90.0}\ {\times}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{b}ase}}\ {\mathrm{a}}\ {\}}lp‾art ← { a → a − 90.0 × f‾loat lb‾ase a }{{}^{\mathrm{l}}\mathrm{\underline{p}art}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\to}\ {\mathrm{a}}\ {-}\ {90.0}\ {\times}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{b}ase}}\ {\mathrm{a}}\ {\}}
75l:r_ing := { half ad ->{{}^{\mathrm{l}}\mathrm{\underline{r}ing}}\ {\leftarrow}\ {\{}\ {\mathrm{half}}\ {\mathrm{ad}}\ {\to}lr‾ing ← { half ad →{{}^{\mathrm{l}}\mathrm{\underline{r}ing}}\ {\leftarrow}\ {\{}\ {\mathrm{half}}\ {\mathrm{ad}}\ {\to}
76 box := l:b_ox l:width c_at (l:height / 2) c_at l:depth\ \ {\mathrm{box}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{b}ox}}\ {{}^{\mathrm{l}}\mathrm{width}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{height}}\ {\div}\ {2}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{depth}}  box ← lb‾ox lwidth c‾at (lheight ÷ 2) c‾at ldepth\ \ {\mathrm{box}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{b}ox}}\ {{}^{\mathrm{l}}\mathrm{width}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{height}}\ {\div}\ {2}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{l}}\mathrm{depth}}
77 lifted := box + 3 8 r_eshape 8 r_eplicate 0.0 c_at (half * l:height / 4) c_at 0.0\ \ {\mathrm{lifted}}\ {\leftarrow}\ {\mathrm{box}}\ {+}\ {3}\ {8}\ {\mathrm{\underline{r}eshape}}\ {8}\ {\mathrm{\underline{r}eplicate}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{half}}\ {\times}\ {{}^{\mathrm{l}}\mathrm{height}}\ {\div}\ {4}{)}\ {\mathrm{\underline{c}at}}\ {0.0}  lifted ← box + 3 8 r‾eshape 8 r‾eplicate 0.0 c‾at (half × lheight ÷ 4) c‾at 0.0\ \ {\mathrm{lifted}}\ {\leftarrow}\ {\mathrm{box}}\ {+}\ {3}\ {8}\ {\mathrm{\underline{r}eshape}}\ {8}\ {\mathrm{\underline{r}eplicate}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{half}}\ {\times}\ {{}^{\mathrm{l}}\mathrm{height}}\ {\div}\ {4}{)}\ {\mathrm{\underline{c}at}}\ {0.0}
78 sides := 6 4 r_eshape 1 2 3 4 2 6 7 3 6 5 8 7 5 1 4 8 5 6 2 1 4 3 7 8\ \ {\mathrm{sides}}\ {\leftarrow}\ {6}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {2}\ {6}\ {7}\ {3}\ {6}\ {5}\ {8}\ {7}\ {5}\ {1}\ {4}\ {8}\ {5}\ {6}\ {2}\ {1}\ {4}\ {3}\ {7}\ {8}  sides ← 6 4 r‾eshape 1 2 3 4 2 6 7 3 6 5 8 7 5 1 4 8 5 6 2 1 4 3 7 8\ \ {\mathrm{sides}}\ {\leftarrow}\ {6}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {2}\ {6}\ {7}\ {3}\ {6}\ {5}\ {8}\ {7}\ {5}\ {1}\ {4}\ {8}\ {5}\ {6}\ {2}\ {1}\ {4}\ {3}\ {7}\ {8}
79 turned := (g:r_otY n_eg l:p_art 1 s_elect ad) g:t_urn lifted\ \ {\mathrm{turned}}\ {\leftarrow}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otY}}\ {\mathrm{\underline{n}eg}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}art}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ad}}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{lifted}}  turned ← (gr‾otY n‾eg lp‾art 1 s‾elect ad) gt‾urn lifted\ \ {\mathrm{turned}}\ {\leftarrow}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otY}}\ {\mathrm{\underline{n}eg}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}art}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ad}}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{lifted}}
80 sides g:s_olid l:v_iew (g:r_otX n_eg l:p_art 2 s_elect ad) g:t_urn turned\ \ {\mathrm{sides}}\ {{}^{\mathrm{g}}\mathrm{\underline{s}olid}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}iew}}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otX}}\ {\mathrm{\underline{n}eg}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}art}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ad}}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{turned}}  sides gs‾olid lv‾iew (gr‾otX n‾eg lp‾art 2 s‾elect ad) gt‾urn turned\ \ {\mathrm{sides}}\ {{}^{\mathrm{g}}\mathrm{\underline{s}olid}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}iew}}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otX}}\ {\mathrm{\underline{n}eg}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}art}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ad}}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{turned}}
81}{\}}}{\}}
82l:ringOffsets := 0 1 2 -1{{}^{\mathrm{l}}\mathrm{ringOffsets}}\ {\leftarrow}\ {0}\ {1}\ {2}\ {-1}lringOffsets ← 0 1 2 −1{{}^{\mathrm{l}}\mathrm{ringOffsets}}\ {\leftarrow}\ {0}\ {1}\ {2}\ {-1}
83l:capOffsets := -1 1{{}^{\mathrm{l}}\mathrm{capOffsets}}\ {\leftarrow}\ {-1}\ {1}lcapOffsets ← −1 1{{}^{\mathrm{l}}\mathrm{capOffsets}}\ {\leftarrow}\ {-1}\ {1}
93l:p_anel := { style f ->{{}^{\mathrm{l}}\mathrm{\underline{p}anel}}\ {\leftarrow}\ {\{}\ {\mathrm{style}}\ {\mathrm{f}}\ {\to}lp‾anel ← { style f →{{}^{\mathrm{l}}\mathrm{\underline{p}anel}}\ {\leftarrow}\ {\{}\ {\mathrm{style}}\ {\mathrm{f}}\ {\to}
94 s := l:s_creen f\ \ {\mathrm{s}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{s}creen}}\ {\mathrm{f}}  s ← ls‾creen f\ \ {\mathrm{s}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{s}creen}}\ {\mathrm{f}}
95 fill := d_isclose 1 s_elect style\ \ {\mathrm{fill}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{style}}  fill ← d‾isclose 1 s‾elect style\ \ {\mathrm{fill}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{style}}
96 lines := 1 d_rop style\ \ {\mathrm{lines}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{style}}  lines ← 1 d‾rop style\ \ {\mathrm{lines}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{style}}
97 shape := ((v:f_ill fill) c_at "#30363d" v:s_troke 1.2) v:p_olygon f_loor 0.5 + s\ \ {\mathrm{shape}}\ {\leftarrow}\ {(}{(}{{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\mathrm{fill}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\#30363d"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}troke}}\ {1.2}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}olygon}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {\mathrm{s}}  shape ← ((vf‾ill fill) c‾at "#30363d" vs‾troke 1.2) vp‾olygon f‾loor 0.5 + s\ \ {\mathrm{shape}}\ {\leftarrow}\ {(}{(}{{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\mathrm{fill}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\#30363d"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}troke}}\ {1.2}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}olygon}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {\mathrm{s}}
98 n_ot l:f_acing s ? shape\ \ {\mathrm{\underline{n}ot}}\ {{}^{\mathrm{l}}\mathrm{\underline{f}acing}}\ {\mathrm{s}}\ {?}\ {\mathrm{shape}}  n‾ot lf‾acing s ? shape\ \ {\mathrm{\underline{n}ot}}\ {{}^{\mathrm{l}}\mathrm{\underline{f}acing}}\ {\mathrm{s}}\ {?}\ {\mathrm{shape}}
99 on := l:a_ffine 1 2 4 s_elect_2 s\ \ {\mathrm{on}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ffine}}\ {1}\ {2}\ {4}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{s}}  on ← la‾ffine 1 2 4 s‾elect2 s\ \ {\mathrm{on}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ffine}}\ {1}\ {2}\ {4}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{s}}
100 texts := j_oin '{ k -> k l:l_ine d_isclose k s_elect lines } m_ap r_ange t_ally lines\ \ {\mathrm{texts}}\ {\leftarrow}\ {\mathrm{\underline{j}oin}}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {{}^{\mathrm{l}}\mathrm{\underline{l}ine}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{lines}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{lines}}  texts ← j‾oin ’{ k → k ll‾ine d‾isclose k s‾elect lines } m‾ap r‾ange t‾ally lines\ \ {\mathrm{texts}}\ {\leftarrow}\ {\mathrm{\underline{j}oin}}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {{}^{\mathrm{l}}\mathrm{\underline{l}ine}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{lines}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{lines}}
101 shape c_at on v:g_roup texts\ \ {\mathrm{shape}}\ {\mathrm{\underline{c}at}}\ {\mathrm{on}}\ {{}^{\mathrm{v}}\mathrm{\underline{g}roup}}\ {\mathrm{texts}}  shape c‾at on vg‾roup texts\ \ {\mathrm{shape}}\ {\mathrm{\underline{c}at}}\ {\mathrm{on}}\ {{}^{\mathrm{v}}\mathrm{\underline{g}roup}}\ {\mathrm{texts}}
102}{\}}}{\}}
110l:r_ounded := { xs -> (f_loat f_loor 0.5 + 1000.0 * xs) / 1000.0 }{{}^{\mathrm{l}}\mathrm{\underline{r}ounded}}\ {\leftarrow}\ {\{}\ {\mathrm{xs}}\ {\to}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {1000.0}\ {\times}\ {\mathrm{xs}}{)}\ {\div}\ {1000.0}\ {\}}lr‾ounded ← { xs → (f‾loat f‾loor 0.5 + 1000.0 × xs) ÷ 1000.0 }{{}^{\mathrm{l}}\mathrm{\underline{r}ounded}}\ {\leftarrow}\ {\{}\ {\mathrm{xs}}\ {\to}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {1000.0}\ {\times}\ {\mathrm{xs}}{)}\ {\div}\ {1000.0}\ {\}}
119l:a_ffine := { c ->{{}^{\mathrm{l}}\mathrm{\underline{a}ffine}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}la‾ffine ← { c →{{}^{\mathrm{l}}\mathrm{\underline{a}ffine}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}
120 tl := 1 s_elect_2 c\ \ {\mathrm{tl}}\ {\leftarrow}\ {1}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}  tl ← 1 s‾elect2 c\ \ {\mathrm{tl}}\ {\leftarrow}\ {1}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}
121 tr := (2 s_elect_2 c) - tl\ \ {\mathrm{tr}}\ {\leftarrow}\ {(}{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{tl}}  tr ← (2 s‾elect2 c) − tl\ \ {\mathrm{tr}}\ {\leftarrow}\ {(}{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{tl}}
122 bl := (3 s_elect_2 c) - tl\ \ {\mathrm{bl}}\ {\leftarrow}\ {(}{3}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{tl}}  bl ← (3 s‾elect2 c) − tl\ \ {\mathrm{bl}}\ {\leftarrow}\ {(}{3}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{tl}}
123 "transform" v:a_ttr "matrix(" c_at (f_ormat l:r_ounded tr) c_at " " c_at (f_ormat l:r_ounded bl) c_at " " c_at (f_ormat l:r_ounded tl) c_at ")"\ \ {\text{"transform"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"matrix("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}ounded}}\ {\mathrm{tr}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}ounded}}\ {\mathrm{bl}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}ounded}}\ {\mathrm{tl}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}  "transform" va‾ttr "matrix(" c‾at (f‾ormat lr‾ounded tr) c‾at " " c‾at (f‾ormat lr‾ounded bl) c‾at " " c‾at (f‾ormat lr‾ounded tl) c‾at ")"\ \ {\text{"transform"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"matrix("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}ounded}}\ {\mathrm{tr}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}ounded}}\ {\mathrm{bl}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}ounded}}\ {\mathrm{tl}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}
124}{\}}}{\}}
135l:f_acing := { s ->{{}^{\mathrm{l}}\mathrm{\underline{f}acing}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}lf‾acing ← { s →{{}^{\mathrm{l}}\mathrm{\underline{f}acing}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
136 xs := 1 s_elect s\ \ {\mathrm{xs}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}  xs ← 1 s‾elect s\ \ {\mathrm{xs}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}
137 ys := 2 s_elect s\ \ {\mathrm{ys}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}  ys ← 2 s‾elect s\ \ {\mathrm{ys}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}
138 0 < '+ r_/ (xs * 1 o_- ys) - ys * 1 o_- xs\ \ {0}\ {<}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{xs}}\ {\times}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{ys}}{)}\ {-}\ {\mathrm{ys}}\ {\times}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{xs}}  0 < ’+ r‾/ (xs × 1 o‾− ys) − ys × 1 o‾− xs\ \ {0}\ {<}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{xs}}\ {\times}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{ys}}{)}\ {-}\ {\mathrm{ys}}\ {\times}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{xs}}
139}{\}}}{\}}
145l:l_ine := { k t ->{{}^{\mathrm{l}}\mathrm{\underline{l}ine}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{t}}\ {\to}ll‾ine ← { k t →{{}^{\mathrm{l}}\mathrm{\underline{l}ine}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{t}}\ {\to}
146 size := "k = 1" i_f< "\"0.06\"; \"0.1\""\ \ {\mathrm{size}}\ {\leftarrow}\ {\text{"k = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"0.06\textbackslash{}"; \textbackslash{}"0.1\textbackslash{}""}}  size ← "k = 1" i‾f< "\"0.06\"; \"0.1\""\ \ {\mathrm{size}}\ {\leftarrow}\ {\text{"k = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"0.06\textbackslash{}"; \textbackslash{}"0.1\textbackslash{}""}}
147 y := "k = 1" i_f< "0.13; 0.14 + 0.16 * f_loat k"\ \ {\mathrm{y}}\ {\leftarrow}\ {\text{"k = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"0.13; 0.14 + 0.16 * f\_loat k"}}  y ← "k = 1" i‾f< "0.13; 0.14 + 0.16 * f_loat k"\ \ {\mathrm{y}}\ {\leftarrow}\ {\text{"k = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"0.13; 0.14 + 0.16 * f\_loat k"}}
148 color := "k = 1" i_f< "\"#4b5563\"; \"#000000\""\ \ {\mathrm{color}}\ {\leftarrow}\ {\text{"k = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"\#4b5563\textbackslash{}"; \textbackslash{}"\#000000\textbackslash{}""}}  color ← "k = 1" i‾f< "\"#4b5563\"; \"#000000\""\ \ {\mathrm{color}}\ {\leftarrow}\ {\text{"k = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"\#4b5563\textbackslash{}"; \textbackslash{}"\#000000\textbackslash{}""}}
149 weight := "k = 1" i_f< "\"500\"; \"700\""\ \ {\mathrm{weight}}\ {\leftarrow}\ {\text{"k = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"500\textbackslash{}"; \textbackslash{}"700\textbackslash{}""}}  weight ← "k = 1" i‾f< "\"500\"; \"700\""\ \ {\mathrm{weight}}\ {\leftarrow}\ {\text{"k = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"500\textbackslash{}"; \textbackslash{}"700\textbackslash{}""}}
150 ((v:a_t 0.06 c_at y) c_at ("font-size" v:a_ttr size) c_at ("font-weight" v:a_ttr weight) c_at (v:f_ill color) c_at "font-family" v:a_ttr "ui-monospace, monospace") v:m_arkup t\ \ {(}{(}{{}^{\mathrm{v}}\mathrm{\underline{a}t}}\ {0.06}\ {\mathrm{\underline{c}at}}\ {\mathrm{y}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"font-size"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"font-weight"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\mathrm{weight}}{)}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\mathrm{color}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"font-family"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"ui-monospace, monospace"}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{m}arkup}}\ {\mathrm{t}}  ((va‾t 0.06 c‾at y) c‾at ("font-size" va‾ttr size) c‾at ("font-weight" va‾ttr weight) c‾at (vf‾ill color) c‾at "font-family" va‾ttr "ui-monospace, monospace") vm‾arkup t\ \ {(}{(}{{}^{\mathrm{v}}\mathrm{\underline{a}t}}\ {0.06}\ {\mathrm{\underline{c}at}}\ {\mathrm{y}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"font-size"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"font-weight"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\mathrm{weight}}{)}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\mathrm{color}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"font-family"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"ui-monospace, monospace"}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{m}arkup}}\ {\mathrm{t}}
151}{\}}}{\}}
155l:p_ainting := { solid -> g:o_rder solid }{{}^{\mathrm{l}}\mathrm{\underline{p}ainting}}\ {\leftarrow}\ {\{}\ {\mathrm{solid}}\ {\to}\ {{}^{\mathrm{g}}\mathrm{\underline{o}rder}}\ {\mathrm{solid}}\ {\}}lp‾ainting ← { solid → go‾rder solid }{{}^{\mathrm{l}}\mathrm{\underline{p}ainting}}\ {\leftarrow}\ {\{}\ {\mathrm{solid}}\ {\to}\ {{}^{\mathrm{g}}\mathrm{\underline{o}rder}}\ {\mathrm{solid}}\ {\}}
158j_oin := { b ->{\mathrm{\underline{j}oin}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}j‾oin ← { b →{\mathrm{\underline{j}oin}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}
159 0 = t_ally b ? ""\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{b}}\ {?}\ {\text{""}}  0 = t‾ally b ? ""\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{b}}\ {?}\ {\text{""}}
160 d_isclose '{ x y -> e_nclose (d_isclose x) c_at d_isclose y } r_/ b\ \ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}  d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at d‾isclose y } r‾/ b\ \ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}
161}{\}}}{\}}

demos/rosetta/cube.xtl

10"g:" u_se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}"g:" u‾se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}
11"v:" u_se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}"v:" u‾se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}
13size := 300.0 # the picture is size by size{\mathrm{size}}\ {\leftarrow}\ {300.0}size ← 300.0{\mathrm{size}}\ {\leftarrow}\ {300.0}
14eye := 6.0 # the viewer's distance along z{\mathrm{eye}}\ {\leftarrow}\ {6.0}eye ← 6.0{\mathrm{eye}}\ {\leftarrow}\ {6.0}
15zoom := 70.0 # pixels per unit{\mathrm{zoom}}\ {\leftarrow}\ {70.0}zoom ← 70.0{\mathrm{zoom}}\ {\leftarrow}\ {70.0}
16light := 0.3 0.5 0.8 # from the viewer's side, upper right{\mathrm{light}}\ {\leftarrow}\ {0.3}\ {0.5}\ {0.8}light ← 0.3 0.5 0.8{\mathrm{light}}\ {\leftarrow}\ {0.3}\ {0.5}\ {0.8}
18cube := g:c_ube 2{\mathrm{cube}}\ {\leftarrow}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ube}}\ {2}cube ← gc‾ube 2{\mathrm{cube}}\ {\leftarrow}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ube}}\ {2}
19faces := g:c_ubeFaces @{\mathrm{faces}}\ {\leftarrow}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ubeFaces}}\ {@}faces ← gc‾ubeFaces @{\mathrm{faces}}\ {\leftarrow}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ubeFaces}}\ {@}
22u:s_creen := { f ->{{}^{\mathrm{u}}\mathrm{\underline{s}creen}}\ {\leftarrow}\ {\{}\ {\mathrm{f}}\ {\to}us‾creen ← { f →{{}^{\mathrm{u}}\mathrm{\underline{s}creen}}\ {\leftarrow}\ {\{}\ {\mathrm{f}}\ {\to}
23 p := eye g:p_roject f\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{eye}}\ {{}^{\mathrm{g}}\mathrm{\underline{p}roject}}\ {\mathrm{f}}  p ← eye gp‾roject f\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{eye}}\ {{}^{\mathrm{g}}\mathrm{\underline{p}roject}}\ {\mathrm{f}}
24 xs := (size / 2) + zoom * 1 s_elect p\ \ {\mathrm{xs}}\ {\leftarrow}\ {(}{\mathrm{size}}\ {\div}\ {2}{)}\ {+}\ {\mathrm{zoom}}\ {\times}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}  xs ← (size ÷ 2) + zoom × 1 s‾elect p\ \ {\mathrm{xs}}\ {\leftarrow}\ {(}{\mathrm{size}}\ {\div}\ {2}{)}\ {+}\ {\mathrm{zoom}}\ {\times}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
25 ys := (size / 2) - zoom * 2 s_elect p\ \ {\mathrm{ys}}\ {\leftarrow}\ {(}{\mathrm{size}}\ {\div}\ {2}{)}\ {-}\ {\mathrm{zoom}}\ {\times}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}  ys ← (size ÷ 2) − zoom × 2 s‾elect p\ \ {\mathrm{ys}}\ {\leftarrow}\ {(}{\mathrm{size}}\ {\div}\ {2}{)}\ {-}\ {\mathrm{zoom}}\ {\times}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
26 (2 c_at t_ally xs) r_eshape xs c_at ys\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{xs}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{xs}}\ {\mathrm{\underline{c}at}}\ {\mathrm{ys}}  (2 c‾at t‾ally xs) r‾eshape xs c‾at ys\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{xs}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{xs}}\ {\mathrm{\underline{c}at}}\ {\mathrm{ys}}
27}{\}}}{\}}
30u:n_ormal := { f ->{{}^{\mathrm{u}}\mathrm{\underline{n}ormal}}\ {\leftarrow}\ {\{}\ {\mathrm{f}}\ {\to}un‾ormal ← { f →{{}^{\mathrm{u}}\mathrm{\underline{n}ormal}}\ {\leftarrow}\ {\{}\ {\mathrm{f}}\ {\to}
31 u := (2 s_elect_2 f) - 1 s_elect_2 f\ \ {\mathrm{u}}\ {\leftarrow}\ {(}{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{f}}{)}\ {-}\ {1}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{f}}  u ← (2 s‾elect2 f) − 1 s‾elect2 f\ \ {\mathrm{u}}\ {\leftarrow}\ {(}{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{f}}{)}\ {-}\ {1}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{f}}
32 w := (4 s_elect_2 f) - 1 s_elect_2 f\ \ {\mathrm{w}}\ {\leftarrow}\ {(}{4}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{f}}{)}\ {-}\ {1}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{f}}  w ← (4 s‾elect2 f) − 1 s‾elect2 f\ \ {\mathrm{w}}\ {\leftarrow}\ {(}{4}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{f}}{)}\ {-}\ {1}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{f}}
33 ((1 o_- u) * 2 o_- w) - (2 o_- u) * 1 o_- w\ \ {(}{(}{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{u}}{)}\ {\times}\ {2}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{w}}{)}\ {-}\ {(}{2}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{u}}{)}\ {\times}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{w}}  ((1 o‾− u) × 2 o‾− w) − (2 o‾− u) × 1 o‾− w\ \ {(}{(}{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{u}}{)}\ {\times}\ {2}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{w}}{)}\ {-}\ {(}{2}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{u}}{)}\ {\times}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{w}}
34}{\}}}{\}}
39u:l_it := { f ->{{}^{\mathrm{u}}\mathrm{\underline{l}it}}\ {\leftarrow}\ {\{}\ {\mathrm{f}}\ {\to}ul‾it ← { f →{{}^{\mathrm{u}}\mathrm{\underline{l}it}}\ {\leftarrow}\ {\{}\ {\mathrm{f}}\ {\to}
40 n := u:n_ormal f\ \ {\mathrm{n}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ormal}}\ {\mathrm{f}}  n ← un‾ormal f\ \ {\mathrm{n}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ormal}}\ {\mathrm{f}}
41 center := ('+ r_/ o_\ f) / 4.0\ \ {\mathrm{center}}\ {\leftarrow}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{f}}{)}\ {\div}\ {4.0}  center ← (’+ r‾/ o‾\ f) ÷ 4.0\ \ {\mathrm{center}}\ {\leftarrow}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{f}}{)}\ {\div}\ {4.0}
42 outward := n * (2.0 * f_loat 0 < '+ r_/ n * center) - 1.0\ \ {\mathrm{outward}}\ {\leftarrow}\ {\mathrm{n}}\ {\times}\ {(}{2.0}\ {\times}\ {\mathrm{\underline{f}loat}}\ {0}\ {<}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}\ {\times}\ {\mathrm{center}}{)}\ {-}\ {1.0}  outward ← n × (2.0 × f‾loat 0 < ’+ r‾/ n × center) − 1.0\ \ {\mathrm{outward}}\ {\leftarrow}\ {\mathrm{n}}\ {\times}\ {(}{2.0}\ {\times}\ {\mathrm{\underline{f}loat}}\ {0}\ {<}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}\ {\times}\ {\mathrm{center}}{)}\ {-}\ {1.0}
43 0 m_ax ('+ r_/ outward * light) / ('+ r_/ n * n) ^ 0.5\ \ {0}\ {\mathrm{\underline{m}ax}}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{outward}}\ {\times}\ {\mathrm{light}}{)}\ {\div}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}\ {\times}\ {\mathrm{n}}{)}\ {\mathbin{\hat{}}}\ {0.5}  0 m‾ax (’+ r‾/ outward × light) ÷ (’+ r‾/ n × n) ^ 0.5\ \ {0}\ {\mathrm{\underline{m}ax}}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{outward}}\ {\times}\ {\mathrm{light}}{)}\ {\div}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}\ {\times}\ {\mathrm{n}}{)}\ {\mathbin{\hat{}}}\ {0.5}
44}{\}}}{\}}
47u:p_olygon := { shaded f ->{{}^{\mathrm{u}}\mathrm{\underline{p}olygon}}\ {\leftarrow}\ {\{}\ {\mathrm{shaded}}\ {\mathrm{f}}\ {\to}up‾olygon ← { shaded f →{{}^{\mathrm{u}}\mathrm{\underline{p}olygon}}\ {\leftarrow}\ {\{}\ {\mathrm{shaded}}\ {\mathrm{f}}\ {\to}
48 fill := v:f_ill "shaded" i_f< "v:r_gb 3 r_eshape 40 + 200 * u:l_it f; \"none\""\ \ {\mathrm{fill}}\ {\leftarrow}\ {{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\text{"shaded"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"v:r\_gb 3 r\_eshape 40 + 200 * u:l\_it f; \textbackslash{}"none\textbackslash{}""}}  fill ← vf‾ill "shaded" i‾f< "v:r_gb 3 r_eshape 40 + 200 * u:l_it f; \"none\""\ \ {\mathrm{fill}}\ {\leftarrow}\ {{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\text{"shaded"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"v:r\_gb 3 r\_eshape 40 + 200 * u:l\_it f; \textbackslash{}"none\textbackslash{}""}}
49 (fill c_at "#222" v:s_troke 1.5) v:p_olygon f_loor 0.5 + u:s_creen f\ \ {(}{\mathrm{fill}}\ {\mathrm{\underline{c}at}}\ {\text{"\#222"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}troke}}\ {1.5}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}olygon}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{s}creen}}\ {\mathrm{f}}  (fill c‾at "#222" vs‾troke 1.5) vp‾olygon f‾loor 0.5 + us‾creen f\ \ {(}{\mathrm{fill}}\ {\mathrm{\underline{c}at}}\ {\text{"\#222"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}troke}}\ {1.5}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}olygon}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{s}creen}}\ {\mathrm{f}}
50}{\}}}{\}}
54u:s_cene := { shaded a ->{{}^{\mathrm{u}}\mathrm{\underline{s}cene}}\ {\leftarrow}\ {\{}\ {\mathrm{shaded}}\ {\mathrm{a}}\ {\to}us‾cene ← { shaded a →{{}^{\mathrm{u}}\mathrm{\underline{s}cene}}\ {\leftarrow}\ {\{}\ {\mathrm{shaded}}\ {\mathrm{a}}\ {\to}
55 turned := ((g:r_otY 1.3 * a) g:t_urn g:r_otX a) g:t_urn cube\ \ {\mathrm{turned}}\ {\leftarrow}\ {(}{(}{{}^{\mathrm{g}}\mathrm{\underline{r}otY}}\ {1.3}\ {\times}\ {\mathrm{a}}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {{}^{\mathrm{g}}\mathrm{\underline{r}otX}}\ {\mathrm{a}}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{cube}}  turned ← ((gr‾otY 1.3 × a) gt‾urn gr‾otX a) gt‾urn cube\ \ {\mathrm{turned}}\ {\leftarrow}\ {(}{(}{{}^{\mathrm{g}}\mathrm{\underline{r}otY}}\ {1.3}\ {\times}\ {\mathrm{a}}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {{}^{\mathrm{g}}\mathrm{\underline{r}otX}}\ {\mathrm{a}}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{cube}}
56 solid := faces g:s_olid turned\ \ {\mathrm{solid}}\ {\leftarrow}\ {\mathrm{faces}}\ {{}^{\mathrm{g}}\mathrm{\underline{s}olid}}\ {\mathrm{turned}}  solid ← faces gs‾olid turned\ \ {\mathrm{solid}}\ {\leftarrow}\ {\mathrm{faces}}\ {{}^{\mathrm{g}}\mathrm{\underline{s}olid}}\ {\mathrm{turned}}
57 polygons := '{ i -> shaded u:p_olygon i s_elect solid } m_ap g:o_rder solid\ \ {\mathrm{polygons}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{i}}\ {\to}\ {\mathrm{shaded}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}olygon}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{solid}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {{}^{\mathrm{g}}\mathrm{\underline{o}rder}}\ {\mathrm{solid}}  polygons ← ’{ i → shaded up‾olygon i s‾elect solid } m‾ap go‾rder solid\ \ {\mathrm{polygons}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{i}}\ {\to}\ {\mathrm{shaded}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}olygon}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{solid}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {{}^{\mathrm{g}}\mathrm{\underline{o}rder}}\ {\mathrm{solid}}
58 (size c_at size) v:p_icture d_isclose '{ x y -> e_nclose (d_isclose x) c_at d_isclose y } r_/ polygons\ \ {(}{\mathrm{size}}\ {\mathrm{\underline{c}at}}\ {\mathrm{size}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}icture}}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{polygons}}  (size c‾at size) vp‾icture d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at d‾isclose y } r‾/ polygons\ \ {(}{\mathrm{size}}\ {\mathrm{\underline{c}at}}\ {\mathrm{size}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}icture}}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{polygons}}
59}{\}}}{\}}
61u:f_rame := { shaded a -> []S_HOW shaded u:s_cene a; []D_L 0.04; @ }{{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\leftarrow}\ {\{}\ {\mathrm{shaded}}\ {\mathrm{a}}\ {\to}\ {\square \mathrm{\underline{S}HOW}}\ {\mathrm{shaded}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}cene}}\ {\mathrm{a}}{\diamond}\ {\square \mathrm{\underline{D}L}}\ {0.04}{\diamond}\ {@}\ {\}}uf‾rame ← { shaded a → □S‾HOW shaded us‾cene a⋄ □D‾L 0.04⋄ @ }{{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\leftarrow}\ {\{}\ {\mathrm{shaded}}\ {\mathrm{a}}\ {\to}\ {\square \mathrm{\underline{S}HOW}}\ {\mathrm{shaded}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}cene}}\ {\mathrm{a}}{\diamond}\ {\square \mathrm{\underline{D}L}}\ {0.04}{\diamond}\ {@}\ {\}}
63angles := 30.0 * f_loat o_ffsets 12{\mathrm{angles}}\ {\leftarrow}\ {30.0}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{o}ffsets}}\ {12}angles ← 30.0 × f‾loat o‾ffsets 12{\mathrm{angles}}\ {\leftarrow}\ {30.0}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{\underline{o}ffsets}}\ {12}
64shown := '{ a -> 0 u:f_rame a } e_ach angles{\mathrm{shown}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\to}\ {0}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\mathrm{a}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}shown ← ’{ a → 0 uf‾rame a } e‾ach angles{\mathrm{shown}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\to}\ {0}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\mathrm{a}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}
65shown := '{ a -> 1 u:f_rame a } e_ach angles{\mathrm{shown}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\to}\ {1}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\mathrm{a}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}shown ← ’{ a → 1 uf‾rame a } e‾ach angles{\mathrm{shown}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\to}\ {1}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\mathrm{a}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}
66"24 frames shown"{\text{"24 frames shown"}}"24 frames shown"{\text{"24 frames shown"}}

demos/rosetta/rosetta.xtl

12"cm:" u_se< "Comparison"{\text{"cm:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Comparison"}}"cm:" u‾se< "Comparison"{\text{"cm:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Comparison"}}
13"st:" u_se< "Stone"{\text{"st:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stone"}}"st:" u‾se< "Stone"{\text{"st:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stone"}}
14"v:" u_se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}"v:" u‾se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}
16data := "demos/rosetta/data.toml"{\mathrm{data}}\ {\leftarrow}\ {\text{"demos/rosetta/data.toml"}}data ← "demos/rosetta/data.toml"{\mathrm{data}}\ {\leftarrow}\ {\text{"demos/rosetta/data.toml"}}
17idioms := data []L_IST "idioms"{\mathrm{idioms}}\ {\leftarrow}\ {\mathrm{data}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"idioms"}}idioms ← data □L‾IST "idioms"{\mathrm{idioms}}\ {\leftarrow}\ {\mathrm{data}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"idioms"}}
18idiomNames := data []L_IST "idiom_names"{\mathrm{idiomNames}}\ {\leftarrow}\ {\mathrm{data}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"idiom\_names"}}idiomNames ← data □L‾IST "idiom_names"{\mathrm{idiomNames}}\ {\leftarrow}\ {\mathrm{data}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"idiom\_names"}}
19languages := data []L_IST "languages"{\mathrm{languages}}\ {\leftarrow}\ {\mathrm{data}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"languages"}}languages ← data □L‾IST "languages"{\mathrm{languages}}\ {\leftarrow}\ {\mathrm{data}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"languages"}}
20languageNames := data []L_IST "language_names"{\mathrm{languageNames}}\ {\leftarrow}\ {\mathrm{data}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"language\_names"}}languageNames ← data □L‾IST "language_names"{\mathrm{languageNames}}\ {\leftarrow}\ {\mathrm{data}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"language\_names"}}
21u:t_able := { name -> ((e_nclose data) c_at e_nclose name) []T_ABLE "idioms" "languages" }{{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\leftarrow}\ {\{}\ {\mathrm{name}}\ {\to}\ {(}{(}{\mathrm{\underline{e}nclose}}\ {\mathrm{data}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{name}}{)}\ {\square \mathrm{\underline{T}ABLE}}\ {\text{"idioms"}}\ {\text{"languages"}}\ {\}}ut‾able ← { name → ((e‾nclose data) c‾at e‾nclose name) □T‾ABLE "idioms" "languages" }{{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\leftarrow}\ {\{}\ {\mathrm{name}}\ {\to}\ {(}{(}{\mathrm{\underline{e}nclose}}\ {\mathrm{data}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{name}}{)}\ {\square \mathrm{\underline{T}ABLE}}\ {\text{"idioms"}}\ {\text{"languages"}}\ {\}}
22source := u:t_able "source"{\mathrm{source}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\text{"source"}}source ← ut‾able "source"{\mathrm{source}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\text{"source"}}
23output := u:t_able "output"{\mathrm{output}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\text{"output"}}output ← ut‾able "output"{\mathrm{output}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\text{"output"}}
24notes := u:t_able "notes"{\mathrm{notes}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\text{"notes"}}notes ← ut‾able "notes"{\mathrm{notes}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\text{"notes"}}
25spans := u:t_able "spans"{\mathrm{spans}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\text{"spans"}}spans ← ut‾able "spans"{\mathrm{spans}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{t}able}}\ {\text{"spans"}}
30u:c_olor := { class ->{{}^{\mathrm{u}}\mathrm{\underline{c}olor}}\ {\leftarrow}\ {\{}\ {\mathrm{class}}\ {\to}uc‾olor ← { class →{{}^{\mathrm{u}}\mathrm{\underline{c}olor}}\ {\leftarrow}\ {\{}\ {\mathrm{class}}\ {\to}
31 class m_atch "builtin" ? "#1d4ed8"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"builtin"}}\ {?}\ {\text{"\#1d4ed8"}}  class m‾atch "builtin" ? "#1d4ed8"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"builtin"}}\ {?}\ {\text{"\#1d4ed8"}}
32 class m_atch "userfunc" ? "#7c3aed"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"userfunc"}}\ {?}\ {\text{"\#7c3aed"}}  class m‾atch "userfunc" ? "#7c3aed"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"userfunc"}}\ {?}\ {\text{"\#7c3aed"}}
33 class m_atch "libfunc" ? "#7c3aed"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"libfunc"}}\ {?}\ {\text{"\#7c3aed"}}  class m‾atch "libfunc" ? "#7c3aed"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"libfunc"}}\ {?}\ {\text{"\#7c3aed"}}
34 class m_atch "macro" ? "#7c3aed"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"macro"}}\ {?}\ {\text{"\#7c3aed"}}  class m‾atch "macro" ? "#7c3aed"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"macro"}}\ {?}\ {\text{"\#7c3aed"}}
35 class m_atch "number" ? "#b45309"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"number"}}\ {?}\ {\text{"\#b45309"}}  class m‾atch "number" ? "#b45309"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"number"}}\ {?}\ {\text{"\#b45309"}}
36 class m_atch "string" ? "#15803d"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"string"}}\ {?}\ {\text{"\#15803d"}}  class m‾atch "string" ? "#15803d"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"string"}}\ {?}\ {\text{"\#15803d"}}
37 class m_atch "symbol" ? "#111827"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"symbol"}}\ {?}\ {\text{"\#111827"}}  class m‾atch "symbol" ? "#111827"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"symbol"}}\ {?}\ {\text{"\#111827"}}
38 class m_atch "comment" ? "#6b7280"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"comment"}}\ {?}\ {\text{"\#6b7280"}}  class m‾atch "comment" ? "#6b7280"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"comment"}}\ {?}\ {\text{"\#6b7280"}}
39 class m_atch "lambdaarg" ? "#0f766e"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"lambdaarg"}}\ {?}\ {\text{"\#0f766e"}}  class m‾atch "lambdaarg" ? "#0f766e"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"lambdaarg"}}\ {?}\ {\text{"\#0f766e"}}
40 class m_atch "keyword" ? "#1d4ed8"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"keyword"}}\ {?}\ {\text{"\#1d4ed8"}}  class m‾atch "keyword" ? "#1d4ed8"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"keyword"}}\ {?}\ {\text{"\#1d4ed8"}}
41 class m_atch "function" ? "#1d4ed8"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"function"}}\ {?}\ {\text{"\#1d4ed8"}}  class m‾atch "function" ? "#1d4ed8"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"function"}}\ {?}\ {\text{"\#1d4ed8"}}
42 class m_atch "operator" ? "#111827"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"operator"}}\ {?}\ {\text{"\#111827"}}  class m‾atch "operator" ? "#111827"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"operator"}}\ {?}\ {\text{"\#111827"}}
43 class m_atch "name" ? "#000000"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"name"}}\ {?}\ {\text{"\#000000"}}  class m‾atch "name" ? "#000000"\ \ {\mathrm{class}}\ {\mathrm{\underline{m}atch}}\ {\text{"name"}}\ {?}\ {\text{"\#000000"}}
44 "#000000"\ \ {\text{"\#000000"}}  "#000000"\ \ {\text{"\#000000"}}
45}{\}}}{\}}
49u:r_uns := { m -> u:j_oin '{ k -> (u:c_olor d_isclose 2 s_elect k s_elect m) v:s_pan d_isclose 1 s_elect k s_elect m } m_ap r_ange 1 s_elect s_hape m }{{}^{\mathrm{u}}\mathrm{\underline{r}uns}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{j}oin}}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{c}olor}}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{s}pan}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}\ {\}}ur‾uns ← { m → uj‾oin ’{ k → (uc‾olor d‾isclose 2 s‾elect k s‾elect m) vs‾pan d‾isclose 1 s‾elect k s‾elect m } m‾ap r‾ange 1 s‾elect s‾hape m }{{}^{\mathrm{u}}\mathrm{\underline{r}uns}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{j}oin}}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{c}olor}}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{s}pan}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}\ {\}}
57u:g_uess := { src ->{{}^{\mathrm{u}}\mathrm{\underline{g}uess}}\ {\leftarrow}\ {\{}\ {\mathrm{src}}\ {\to}ug‾uess ← { src →{{}^{\mathrm{u}}\mathrm{\underline{g}uess}}\ {\leftarrow}\ {\{}\ {\mathrm{src}}\ {\to}
58 cls := (src m_ember? "0123456789") + (2 * src m_ember? "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_") + 3 * src = f_irst " "\ \ {\mathrm{cls}}\ {\leftarrow}\ {(}{\mathrm{src}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}{)}\ {+}\ {(}{2}\ {\times}\ {\mathrm{src}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\_"}}{)}\ {+}\ {3}\ {\times}\ {\mathrm{src}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}  cls ← (src m‾ember? "0123456789") + (2 × src m‾ember? "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_") + 3 × src = f‾irst " "\ \ {\mathrm{cls}}\ {\leftarrow}\ {(}{\mathrm{src}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"0123456789"}}{)}\ {+}\ {(}{2}\ {\times}\ {\mathrm{src}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\_"}}{)}\ {+}\ {3}\ {\times}\ {\mathrm{src}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}
59 starts := 1 c_at (1 d_rop cls) != -1 d_rop cls\ \ {\mathrm{starts}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{cls}}{)}\ {\neq}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{cls}}  starts ← 1 c‾at (1 d‾rop cls) ≠ −1 d‾rop cls\ \ {\mathrm{starts}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{cls}}{)}\ {\neq}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{cls}}
60 runs := ('+ s_\ starts) p_artition src\ \ {\mathrm{runs}}\ {\leftarrow}\ {(}{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{starts}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{src}}  runs ← (’+ s‾\ starts) p‾artition src\ \ {\mathrm{runs}}\ {\leftarrow}\ {(}{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{starts}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{src}}
61 kinds := (e_nclose "builtin") c_at (e_nclose "number") c_at (e_nclose "name") c_at e_nclose "plain"\ \ {\mathrm{kinds}}\ {\leftarrow}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"builtin"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"number"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"name"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"plain"}}  kinds ← (e‾nclose "builtin") c‾at (e‾nclose "number") c‾at (e‾nclose "name") c‾at e‾nclose "plain"\ \ {\mathrm{kinds}}\ {\leftarrow}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"builtin"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"number"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"name"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"plain"}}
62 classes := (1 + (w_here starts) s_elect cls) s_elect kinds\ \ {\mathrm{classes}}\ {\leftarrow}\ {(}{1}\ {+}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{starts}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{cls}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{kinds}}  classes ← (1 + (w‾here starts) s‾elect cls) s‾elect kinds\ \ {\mathrm{classes}}\ {\leftarrow}\ {(}{1}\ {+}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{starts}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{cls}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{kinds}}
63 o_\ (2 c_at t_ally runs) r_eshape runs c_at classes\ \ {\mathrm{\underline{o}}{\backslash}}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{runs}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{runs}}\ {\mathrm{\underline{c}at}}\ {\mathrm{classes}}  o‾\ (2 c‾at t‾ally runs) r‾eshape runs c‾at classes\ \ {\mathrm{\underline{o}}{\backslash}}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{runs}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{runs}}\ {\mathrm{\underline{c}at}}\ {\mathrm{classes}}
64}{\}}}{\}}
68u:s_pans := { src spans ->{{}^{\mathrm{u}}\mathrm{\underline{s}pans}}\ {\leftarrow}\ {\{}\ {\mathrm{src}}\ {\mathrm{spans}}\ {\to}us‾pans ← { src spans →{{}^{\mathrm{u}}\mathrm{\underline{s}pans}}\ {\leftarrow}\ {\{}\ {\mathrm{src}}\ {\mathrm{spans}}\ {\to}
69 0 = t_ally spans ? u:g_uess src\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{spans}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{g}uess}}\ {\mathrm{src}}  0 = t‾ally spans ? ug‾uess src\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{spans}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{g}uess}}\ {\mathrm{src}}
70 pieces := (n_ot spans = f_irst "|") p_artition spans\ \ {\mathrm{pieces}}\ {\leftarrow}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{spans}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"|"}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{spans}}  pieces ← (n‾ot spans = f‾irst "|") p‾artition spans\ \ {\mathrm{pieces}}\ {\leftarrow}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{spans}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"|"}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{spans}}
71 o_ne := { p -> t := d_isclose p; cut := t i_ndexOf f_irst " "; (e_nclose cut d_rop t) c_at e_nclose (cut - 1) t_ake t }\ \ {\mathrm{\underline{o}ne}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}\ {\mathrm{t}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{p}}{\diamond}\ {\mathrm{cut}}\ {\leftarrow}\ {\mathrm{t}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{\diamond}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{cut}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{cut}}\ {-}\ {1}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{t}}\ {\}}  o‾ne ← { p → t ← d‾isclose p⋄ cut ← t i‾ndexOf f‾irst " "⋄ (e‾nclose cut d‾rop t) c‾at e‾nclose (cut − 1) t‾ake t }\ \ {\mathrm{\underline{o}ne}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}\ {\mathrm{t}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{p}}{\diamond}\ {\mathrm{cut}}\ {\leftarrow}\ {\mathrm{t}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{\diamond}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{cut}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{cut}}\ {-}\ {1}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{t}}\ {\}}
72 ((t_ally pieces) c_at 2) r_eshape d_isclose '{ x y -> e_nclose (d_isclose x) c_at d_isclose y } r_/ 'o_ne m_ap pieces\ \ {(}{(}{\mathrm{\underline{t}ally}}\ {\mathrm{pieces}}{)}\ {\mathrm{\underline{c}at}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{\mathrm{\underline{o}ne}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{pieces}}  ((t‾ally pieces) c‾at 2) r‾eshape d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at d‾isclose y } r‾/ ’o‾ne m‾ap pieces\ \ {(}{(}{\mathrm{\underline{t}ally}}\ {\mathrm{pieces}}{)}\ {\mathrm{\underline{c}at}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{\mathrm{\underline{o}ne}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{pieces}}
73}{\}}}{\}}
78u:c_olored := { il src ->{{}^{\mathrm{u}}\mathrm{\underline{c}olored}}\ {\leftarrow}\ {\{}\ {\mathrm{il}}\ {\mathrm{src}}\ {\to}uc‾olored ← { il src →{{}^{\mathrm{u}}\mathrm{\underline{c}olored}}\ {\leftarrow}\ {\{}\ {\mathrm{il}}\ {\mathrm{src}}\ {\to}
79 i := 1 s_elect il\ \ {\mathrm{i}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{il}}  i ← 1 s‾elect il\ \ {\mathrm{i}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{il}}
80 l := 2 s_elect il\ \ {\mathrm{l}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{il}}  l ← 2 s‾elect il\ \ {\mathrm{l}}\ {\leftarrow}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{il}}
81 (d_isclose l s_elect languages) m_atch "xetal" ? u:r_uns []V_IEW src\ \ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"xetal"}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{r}uns}}\ {\square \mathrm{\underline{V}IEW}}\ {\mathrm{src}}  (d‾isclose l s‾elect languages) m‾atch "xetal" ? ur‾uns □V‾IEW src\ \ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"xetal"}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{r}uns}}\ {\square \mathrm{\underline{V}IEW}}\ {\mathrm{src}}
82 u:r_uns src u:s_pans d_isclose l s_elect i s_elect spans\ \ {{}^{\mathrm{u}}\mathrm{\underline{r}uns}}\ {\mathrm{src}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}pans}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{spans}}  ur‾uns src us‾pans d‾isclose l s‾elect i s‾elect spans\ \ {{}^{\mathrm{u}}\mathrm{\underline{r}uns}}\ {\mathrm{src}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}pans}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{spans}}
83}{\}}}{\}}
88fits := 15{\mathrm{fits}}\ {\leftarrow}\ {15}fits ← 15{\mathrm{fits}}\ {\leftarrow}\ {15}
89smallest := 0.05{\mathrm{smallest}}\ {\leftarrow}\ {0.05}smallest ← 0.05{\mathrm{smallest}}\ {\leftarrow}\ {0.05}
93u:f_itted := { n markup ->{{}^{\mathrm{u}}\mathrm{\underline{f}itted}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{markup}}\ {\to}uf‾itted ← { n markup →{{}^{\mathrm{u}}\mathrm{\underline{f}itted}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{markup}}\ {\to}
94 n <= fits ? markup\ \ {\mathrm{n}}\ {\leq}\ {\mathrm{fits}}\ {?}\ {\mathrm{markup}}  n ≤ fits ? markup\ \ {\mathrm{n}}\ {\leq}\ {\mathrm{fits}}\ {?}\ {\mathrm{markup}}
95 size := 0.1 * (f_loat fits) / f_loat n\ \ {\mathrm{size}}\ {\leftarrow}\ {0.1}\ {\times}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{fits}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}  size ← 0.1 × (f‾loat fits) ÷ f‾loat n\ \ {\mathrm{size}}\ {\leftarrow}\ {0.1}\ {\times}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{fits}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}
96 (size m_ax smallest) v:s_ized markup\ \ {(}{\mathrm{size}}\ {\mathrm{\underline{m}ax}}\ {\mathrm{smallest}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{s}ized}}\ {\mathrm{markup}}  (size m‾ax smallest) vs‾ized markup\ \ {(}{\mathrm{size}}\ {\mathrm{\underline{m}ax}}\ {\mathrm{smallest}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{s}ized}}\ {\mathrm{markup}}
97}{\}}}{\}}
102u:s_plit := { src ->{{}^{\mathrm{u}}\mathrm{\underline{s}plit}}\ {\leftarrow}\ {\{}\ {\mathrm{src}}\ {\to}us‾plit ← { src →{{}^{\mathrm{u}}\mathrm{\underline{s}plit}}\ {\leftarrow}\ {\{}\ {\mathrm{src}}\ {\to}
103 n := t_ally src\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{src}}  n ← t‾ally src\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{src}}
104 n <= fits ? e_nclose src\ \ {\mathrm{n}}\ {\leq}\ {\mathrm{fits}}\ {?}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{src}}  n ≤ fits ? e‾nclose src\ \ {\mathrm{n}}\ {\leq}\ {\mathrm{fits}}\ {?}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{src}}
105 spaces := w_here src = f_irst " "\ \ {\mathrm{spaces}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{src}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}  spaces ← w‾here src = f‾irst " "\ \ {\mathrm{spaces}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{src}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}
106 0 = t_ally spaces ? e_nclose src\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{spaces}}\ {?}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{src}}  0 = t‾ally spaces ? e‾nclose src\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{spaces}}\ {?}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{src}}
107 away := a_bs (2 * spaces) - n\ \ {\mathrm{away}}\ {\leftarrow}\ {\mathrm{\underline{a}bs}}\ {(}{2}\ {\times}\ {\mathrm{spaces}}{)}\ {-}\ {\mathrm{n}}  away ← a‾bs (2 × spaces) − n\ \ {\mathrm{away}}\ {\leftarrow}\ {\mathrm{\underline{a}bs}}\ {(}{2}\ {\times}\ {\mathrm{spaces}}{)}\ {-}\ {\mathrm{n}}
108 cut := (away i_ndexOf 'm_in r_/ away) s_elect spaces\ \ {\mathrm{cut}}\ {\leftarrow}\ {(}{\mathrm{away}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{away}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{spaces}}  cut ← (away i‾ndexOf ’m‾in r‾/ away) s‾elect spaces\ \ {\mathrm{cut}}\ {\leftarrow}\ {(}{\mathrm{away}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{away}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{spaces}}
109 (e_nclose (cut - 1) t_ake src) c_at e_nclose cut d_rop src\ \ {(}{\mathrm{\underline{e}nclose}}\ {(}{\mathrm{cut}}\ {-}\ {1}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{src}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{cut}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{src}}  (e‾nclose (cut − 1) t‾ake src) c‾at e‾nclose cut d‾rop src\ \ {(}{\mathrm{\underline{e}nclose}}\ {(}{\mathrm{cut}}\ {-}\ {1}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{src}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{cut}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{src}}
110}{\}}}{\}}
114u:l_ines := { width ws ->{{}^{\mathrm{u}}\mathrm{\underline{l}ines}}\ {\leftarrow}\ {\{}\ {\mathrm{width}}\ {\mathrm{ws}}\ {\to}ul‾ines ← { width ws →{{}^{\mathrm{u}}\mathrm{\underline{l}ines}}\ {\leftarrow}\ {\{}\ {\mathrm{width}}\ {\mathrm{ws}}\ {\to}
115 0 = t_ally ws ? ws\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{ws}}\ {?}\ {\mathrm{ws}}  0 = t‾ally ws ? ws\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{ws}}\ {?}\ {\mathrm{ws}}
116 lens := '{ b -> t_ally d_isclose b } e_ach ws\ \ {\mathrm{lens}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{b}}\ {\to}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{ws}}  lens ← ’{ b → t‾ally d‾isclose b } e‾ach ws\ \ {\mathrm{lens}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{b}}\ {\to}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{ws}}
117 room := width >= (('+ s_\ lens) + r_ange t_ally ws) - 1\ \ {\mathrm{room}}\ {\leftarrow}\ {\mathrm{width}}\ {\geq}\ {(}{(}{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{lens}}{)}\ {+}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{ws}}{)}\ {-}\ {1}  room ← width ≥ ((’+ s‾\ lens) + r‾ange t‾ally ws) − 1\ \ {\mathrm{room}}\ {\leftarrow}\ {\mathrm{width}}\ {\geq}\ {(}{(}{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{lens}}{)}\ {+}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{ws}}{)}\ {-}\ {1}
118 k := 1 m_ax '+ r_/ room\ \ {\mathrm{k}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{m}ax}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{room}}  k ← 1 m‾ax ’+ r‾/ room\ \ {\mathrm{k}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{m}ax}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{room}}
119 line := d_isclose '{ x y -> e_nclose (d_isclose x) c_at " " c_at d_isclose y } r_/ k t_ake ws\ \ {\mathrm{line}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{k}}\ {\mathrm{\underline{t}ake}}\ {\mathrm{ws}}  line ← d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at " " c‾at d‾isclose y } r‾/ k t‾ake ws\ \ {\mathrm{line}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{k}}\ {\mathrm{\underline{t}ake}}\ {\mathrm{ws}}
120 (e_nclose line) c_at width u:l_ines k d_rop ws\ \ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{line}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{width}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ines}}\ {\mathrm{k}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{ws}}  (e‾nclose line) c‾at width ul‾ines k d‾rop ws\ \ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{line}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{width}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ines}}\ {\mathrm{k}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{ws}}
121}{\}}}{\}}
124u:w_rap := { width t -> width u:l_ines (n_ot t = f_irst " ") p_artition t }{{}^{\mathrm{u}}\mathrm{\underline{w}rap}}\ {\leftarrow}\ {\{}\ {\mathrm{width}}\ {\mathrm{t}}\ {\to}\ {\mathrm{width}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ines}}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{t}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{t}}\ {\}}uw‾rap ← { width t → width ul‾ines (n‾ot t = f‾irst " ") p‾artition t }{{}^{\mathrm{u}}\mathrm{\underline{w}rap}}\ {\leftarrow}\ {\{}\ {\mathrm{width}}\ {\mathrm{t}}\ {\to}\ {\mathrm{width}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ines}}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{t}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{t}}\ {\}}
128u:o_neLine := { out -> d_isclose '{ x y -> e_nclose (d_isclose x) c_at " / " c_at d_isclose y } r_/ (n_ot out = f_irst "\n") p_artition out }{{}^{\mathrm{u}}\mathrm{\underline{o}neLine}}\ {\leftarrow}\ {\{}\ {\mathrm{out}}\ {\to}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" / "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{out}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"\textbackslash{}n"}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{out}}\ {\}}uo‾neLine ← { out → d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at " / " c‾at d‾isclose y } r‾/ (n‾ot out = f‾irst "\n") p‾artition out }{{}^{\mathrm{u}}\mathrm{\underline{o}neLine}}\ {\leftarrow}\ {\{}\ {\mathrm{out}}\ {\to}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" / "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{n}ot}}\ {\mathrm{out}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"\textbackslash{}n"}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{out}}\ {\}}
134u:f_ace := { i l ->{{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {\leftarrow}\ {\{}\ {\mathrm{i}}\ {\mathrm{l}}\ {\to}uf‾ace ← { i l →{{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {\leftarrow}\ {\{}\ {\mathrm{i}}\ {\mathrm{l}}\ {\to}
135 name := v:e_scape d_isclose l s_elect languageNames\ \ {\mathrm{name}}\ {\leftarrow}\ {{}^{\mathrm{v}}\mathrm{\underline{e}scape}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languageNames}}  name ← ve‾scape d‾isclose l s‾elect languageNames\ \ {\mathrm{name}}\ {\leftarrow}\ {{}^{\mathrm{v}}\mathrm{\underline{e}scape}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languageNames}}
136 src := d_isclose l s_elect i s_elect source\ \ {\mathrm{src}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{source}}  src ← d‾isclose l s‾elect i s‾elect source\ \ {\mathrm{src}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{source}}
137 out := d_isclose l s_elect i s_elect output\ \ {\mathrm{out}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{output}}  out ← d‾isclose l s‾elect i s‾elect output\ \ {\mathrm{out}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{output}}
138 note := d_isclose l s_elect i s_elect notes\ \ {\mathrm{note}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{notes}}  note ← d‾isclose l s‾elect i s‾elect notes\ \ {\mathrm{note}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{l}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{notes}}
139 missing := "0 = t_ally note" i_f< "\"(no concise idiom)\"; note"\ \ {\mathrm{missing}}\ {\leftarrow}\ {\text{"0 = t\_ally note"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"(no concise idiom)\textbackslash{}"; note"}}  missing ← "0 = t_ally note" i‾f< "\"(no concise idiom)\"; note"\ \ {\mathrm{missing}}\ {\leftarrow}\ {\text{"0 = t\_ally note"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"(no concise idiom)\textbackslash{}"; note"}}
140 result := "0 = t_ally out" i_f< "\"\"; \"-> \" c_at u:o_neLine out"\ \ {\mathrm{result}}\ {\leftarrow}\ {\text{"0 = t\_ally out"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"\textbackslash{}"; \textbackslash{}"-> \textbackslash{}" c\_at u:o\_neLine out"}}  result ← "0 = t_ally out" i‾f< "\"\"; \"-> \" c_at u:o_neLine out"\ \ {\mathrm{result}}\ {\leftarrow}\ {\text{"0 = t\_ally out"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"\textbackslash{}"; \textbackslash{}"-> \textbackslash{}" c\_at u:o\_neLine out"}}
141 n_oteLine := { b -> 0.07 v:s_ized "#4b5563" v:s_pan d_isclose b }\ \ {\mathrm{\underline{n}oteLine}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}\ {0.07}\ {{}^{\mathrm{v}}\mathrm{\underline{s}ized}}\ {\text{"\#4b5563"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}pan}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}\ {\}}  n‾oteLine ← { b → 0.07 vs‾ized "#4b5563" vs‾pan d‾isclose b }\ \ {\mathrm{\underline{n}oteLine}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}\ {0.07}\ {{}^{\mathrm{v}}\mathrm{\underline{s}ized}}\ {\text{"\#4b5563"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}pan}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}\ {\}}
142 0 = t_ally src ? (e_nclose name) c_at 'n_oteLine m_ap 18 u:w_rap missing\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{src}}\ {?}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{name}}{)}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{n}oteLine}}\ {\mathrm{\underline{m}ap}}\ {18}\ {{}^{\mathrm{u}}\mathrm{\underline{w}rap}}\ {\mathrm{missing}}  0 = t‾ally src ? (e‾nclose name) c‾at ’n‾oteLine m‾ap 18 uw‾rap missing\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{src}}\ {?}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{name}}{)}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{n}oteLine}}\ {\mathrm{\underline{m}ap}}\ {18}\ {{}^{\mathrm{u}}\mathrm{\underline{w}rap}}\ {\mathrm{missing}}
143 c_odeLine := { b -> (t_ally d_isclose b) u:f_itted (i c_at l) u:c_olored d_isclose b }\ \ {\mathrm{\underline{c}odeLine}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}itted}}\ {(}{\mathrm{i}}\ {\mathrm{\underline{c}at}}\ {\mathrm{l}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{c}olored}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}\ {\}}  c‾odeLine ← { b → (t‾ally d‾isclose b) uf‾itted (i c‾at l) uc‾olored d‾isclose b }\ \ {\mathrm{\underline{c}odeLine}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}itted}}\ {(}{\mathrm{i}}\ {\mathrm{\underline{c}at}}\ {\mathrm{l}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{c}olored}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}\ {\}}
144 code := 'c_odeLine m_ap u:s_plit src\ \ {\mathrm{code}}\ {\leftarrow}\ {\text{'}}{\mathrm{\underline{c}odeLine}}\ {\mathrm{\underline{m}ap}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}plit}}\ {\mathrm{src}}  code ← ’c‾odeLine m‾ap us‾plit src\ \ {\mathrm{code}}\ {\leftarrow}\ {\text{'}}{\mathrm{\underline{c}odeLine}}\ {\mathrm{\underline{m}ap}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}plit}}\ {\mathrm{src}}
145 (e_nclose name) c_at code c_at e_nclose (t_ally result) u:f_itted "#4b5563" v:s_pan result\ \ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{name}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{code}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{result}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}itted}}\ {\text{"\#4b5563"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}pan}}\ {\mathrm{result}}  (e‾nclose name) c‾at code c‾at e‾nclose (t‾ally result) uf‾itted "#4b5563" vs‾pan result\ \ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{name}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{code}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{result}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}itted}}\ {\text{"\#4b5563"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}pan}}\ {\mathrm{result}}
146}{\}}}{\}}
150u:i_tem := { ao state ->{{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\leftarrow}\ {\{}\ {\mathrm{ao}}\ {\mathrm{state}}\ {\to}ui‾tem ← { ao state →{{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\leftarrow}\ {\{}\ {\mathrm{ao}}\ {\mathrm{state}}\ {\to}
151 axis := 1 s_elect ao\ \ {\mathrm{axis}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ao}}  axis ← 1 s‾elect ao\ \ {\mathrm{axis}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ao}}
152 n := f_loor 0.5 + (axis c_at cm:COUNT) cm:a_t state\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  n ← f‾loor 0.5 + (axis c‾at cmCOUNT) cma‾t state\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{COUNT}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
153 n cm:w_rap 1 + (f_loor 2 s_elect ao) + st:b_ase (axis c_at cm:ANGLE) cm:a_t state\ \ {\mathrm{n}}\ {{}^{\mathrm{cm}}\mathrm{\underline{w}rap}}\ {1}\ {+}\ {(}{\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ao}}{)}\ {+}\ {{}^{\mathrm{st}}\mathrm{\underline{b}ase}}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  n cmw‾rap 1 + (f‾loor 2 s‾elect ao) + stb‾ase (axis c‾at cmANGLE) cma‾t state\ \ {\mathrm{n}}\ {{}^{\mathrm{cm}}\mathrm{\underline{w}rap}}\ {1}\ {+}\ {(}{\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ao}}{)}\ {+}\ {{}^{\mathrm{st}}\mathrm{\underline{b}ase}}\ {(}{\mathrm{axis}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
154}{\}}}{\}}
162u:s_tone := { state ->{{}^{\mathrm{u}}\mathrm{\underline{s}tone}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}us‾tone ← { state →{{}^{\mathrm{u}}\mathrm{\underline{s}tone}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}
163 i := (cm:IDIOM c_at 0.0) u:i_tem state\ \ {\mathrm{i}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}  i ← (cmIDIOM c‾at 0.0) ui‾tem state\ \ {\mathrm{i}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}
164 roll := (cm:IDIOM c_at cm:ANGLE) cm:a_t state\ \ {\mathrm{roll}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}  roll ← (cmIDIOM c‾at cmANGLE) cma‾t state\ \ {\mathrm{roll}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}
165 top := 1 st:r_ing ((cm:TOP c_at cm:ANGLE) cm:a_t state) c_at roll\ \ {\mathrm{top}}\ {\leftarrow}\ {1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{roll}}  top ← 1 str‾ing ((cmTOP c‾at cmANGLE) cma‾t state) c‾at roll\ \ {\mathrm{top}}\ {\leftarrow}\ {1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{roll}}
166 bottom := -1 st:r_ing ((cm:BOTTOM c_at cm:ANGLE) cm:a_t state) c_at roll\ \ {\mathrm{bottom}}\ {\leftarrow}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{roll}}  bottom ← −1 str‾ing ((cmBOTTOM c‾at cmANGLE) cma‾t state) c‾at roll\ \ {\mathrm{bottom}}\ {\leftarrow}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{roll}}
167 all := top c_at bottom\ \ {\mathrm{all}}\ {\leftarrow}\ {\mathrm{top}}\ {\mathrm{\underline{c}at}}\ {\mathrm{bottom}}  all ← top c‾at bottom\ \ {\mathrm{all}}\ {\leftarrow}\ {\mathrm{top}}\ {\mathrm{\underline{c}at}}\ {\mathrm{bottom}}
168 c_apName := { k -> v:e_scape d_isclose ((cm:IDIOM c_at f_loat k s_elect st:capOffsets) u:i_tem state) s_elect idiomNames }\ \ {\mathrm{\underline{c}apName}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {{}^{\mathrm{v}}\mathrm{\underline{e}scape}}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {{}^{\mathrm{st}}\mathrm{capOffsets}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{idiomNames}}\ {\}}  c‾apName ← { k → ve‾scape d‾isclose ((cmIDIOM c‾at f‾loat k s‾elect stcapOffsets) ui‾tem state) s‾elect idiomNames }\ \ {\mathrm{\underline{c}apName}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {{}^{\mathrm{v}}\mathrm{\underline{e}scape}}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {{}^{\mathrm{st}}\mathrm{capOffsets}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{idiomNames}}\ {\}}
169 c_apText := { k ->\ \ {\mathrm{\underline{c}apText}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}  c‾apText ← { k →\ \ {\mathrm{\underline{c}apText}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}
170 k = 5 ? c_apName 1\ \ \ \ {\mathrm{k}}\ {=}\ {5}\ {?}\ {\mathrm{\underline{c}apName}}\ {1}    k = 5 ? c‾apName 1\ \ \ \ {\mathrm{k}}\ {=}\ {5}\ {?}\ {\mathrm{\underline{c}apName}}\ {1}
171 k = 12 ? c_apName 2\ \ \ \ {\mathrm{k}}\ {=}\ {12}\ {?}\ {\mathrm{\underline{c}apName}}\ {2}    k = 12 ? c‾apName 2\ \ \ \ {\mathrm{k}}\ {=}\ {12}\ {?}\ {\mathrm{\underline{c}apName}}\ {2}
172 ""\ \ \ \ {\text{""}}    ""\ \ \ \ {\text{""}}
173 }\ \ {\}}  }\ \ {\}}
174 c_ap := { k -> (e_nclose "#e9e4db") c_at (e_nclose "") c_at e_nclose c_apText k }\ \ {\mathrm{\underline{c}ap}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"\#e9e4db"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{""}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{\underline{c}apText}}\ {\mathrm{k}}\ {\}}  c‾ap ← { k → (e‾nclose "#e9e4db") c‾at (e‾nclose "") c‾at e‾nclose c‾apText k }\ \ {\mathrm{\underline{c}ap}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"\#e9e4db"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{""}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{\underline{c}apText}}\ {\mathrm{k}}\ {\}}
175 t_opPanel := { k -> (e_nclose "#fdfcfa") c_at i u:f_ace (cm:TOP c_at f_loat k s_elect st:ringOffsets) u:i_tem state }\ \ {\mathrm{\underline{t}opPanel}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"\#fdfcfa"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{i}}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {{}^{\mathrm{st}}\mathrm{ringOffsets}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}\ {\}}  t‾opPanel ← { k → (e‾nclose "#fdfcfa") c‾at i uf‾ace (cmTOP c‾at f‾loat k s‾elect stringOffsets) ui‾tem state }\ \ {\mathrm{\underline{t}opPanel}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"\#fdfcfa"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{i}}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {{}^{\mathrm{st}}\mathrm{ringOffsets}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}\ {\}}
176 b_ottomPanel := { k -> (e_nclose "#f4f1ec") c_at i u:f_ace (cm:BOTTOM c_at f_loat k s_elect st:ringOffsets) u:i_tem state }\ \ {\mathrm{\underline{b}ottomPanel}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"\#f4f1ec"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{i}}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {{}^{\mathrm{st}}\mathrm{ringOffsets}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}\ {\}}  b‾ottomPanel ← { k → (e‾nclose "#f4f1ec") c‾at i uf‾ace (cmBOTTOM c‾at f‾loat k s‾elect stringOffsets) ui‾tem state }\ \ {\mathrm{\underline{b}ottomPanel}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"\#f4f1ec"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{i}}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {{}^{\mathrm{st}}\mathrm{ringOffsets}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}\ {\}}
177 l_ines := { k ->\ \ {\mathrm{\underline{l}ines}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}  l‾ines ← { k →\ \ {\mathrm{\underline{l}ines}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}
178 k <= 4 ? t_opPanel k\ \ \ \ {\mathrm{k}}\ {\leq}\ {4}\ {?}\ {\mathrm{\underline{t}opPanel}}\ {\mathrm{k}}    k ≤ 4 ? t‾opPanel k\ \ \ \ {\mathrm{k}}\ {\leq}\ {4}\ {?}\ {\mathrm{\underline{t}opPanel}}\ {\mathrm{k}}
179 k <= 6 ? c_ap k\ \ \ \ {\mathrm{k}}\ {\leq}\ {6}\ {?}\ {\mathrm{\underline{c}ap}}\ {\mathrm{k}}    k ≤ 6 ? c‾ap k\ \ \ \ {\mathrm{k}}\ {\leq}\ {6}\ {?}\ {\mathrm{\underline{c}ap}}\ {\mathrm{k}}
180 k <= 10 ? b_ottomPanel k - 6\ \ \ \ {\mathrm{k}}\ {\leq}\ {10}\ {?}\ {\mathrm{\underline{b}ottomPanel}}\ {\mathrm{k}}\ {-}\ {6}    k ≤ 10 ? b‾ottomPanel k − 6\ \ \ \ {\mathrm{k}}\ {\leq}\ {10}\ {?}\ {\mathrm{\underline{b}ottomPanel}}\ {\mathrm{k}}\ {-}\ {6}
181 c_ap k\ \ \ \ {\mathrm{\underline{c}ap}}\ {\mathrm{k}}    c‾ap k\ \ \ \ {\mathrm{\underline{c}ap}}\ {\mathrm{k}}
182 }\ \ {\}}  }\ \ {\}}
183 p_anel := { k -> (l_ines k) st:p_anel k s_elect all }\ \ {\mathrm{\underline{p}anel}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{l}ines}}\ {\mathrm{k}}{)}\ {{}^{\mathrm{st}}\mathrm{\underline{p}anel}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{all}}\ {\}}  p‾anel ← { k → (l‾ines k) stp‾anel k s‾elect all }\ \ {\mathrm{\underline{p}anel}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{\underline{l}ines}}\ {\mathrm{k}}{)}\ {{}^{\mathrm{st}}\mathrm{\underline{p}anel}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{all}}\ {\}}
184 painted := u:j_oin 'p_anel m_ap st:p_ainting all\ \ {\mathrm{painted}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{j}oin}}\ {\text{'}}{\mathrm{\underline{p}anel}}\ {\mathrm{\underline{m}ap}}\ {{}^{\mathrm{st}}\mathrm{\underline{p}ainting}}\ {\mathrm{all}}  painted ← uj‾oin ’p‾anel m‾ap stp‾ainting all\ \ {\mathrm{painted}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{j}oin}}\ {\text{'}}{\mathrm{\underline{p}anel}}\ {\mathrm{\underline{m}ap}}\ {{}^{\mathrm{st}}\mathrm{\underline{p}ainting}}\ {\mathrm{all}}
185 caption := ((v:a_t (st:size / 2) c_at 28) c_at ("font-size" v:a_ttr "18") c_at ("text-anchor" v:a_ttr "middle") c_at (v:f_ill "#374151") c_at "font-family" v:a_ttr "ui-sans-serif, system-ui, sans-serif") v:t_ext d_isclose i s_elect idiomNames\ \ {\mathrm{caption}}\ {\leftarrow}\ {(}{(}{{}^{\mathrm{v}}\mathrm{\underline{a}t}}\ {(}{{}^{\mathrm{st}}\mathrm{size}}\ {\div}\ {2}{)}\ {\mathrm{\underline{c}at}}\ {28}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"font-size"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"18"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"text-anchor"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"middle"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\text{"\#374151"}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"font-family"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"ui-sans-serif, system-ui, sans-serif"}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{t}ext}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{idiomNames}}  caption ← ((va‾t (stsize ÷ 2) c‾at 28) c‾at ("font-size" va‾ttr "18") c‾at ("text-anchor" va‾ttr "middle") c‾at (vf‾ill "#374151") c‾at "font-family" va‾ttr "ui-sans-serif, system-ui, sans-serif") vt‾ext d‾isclose i s‾elect idiomNames\ \ {\mathrm{caption}}\ {\leftarrow}\ {(}{(}{{}^{\mathrm{v}}\mathrm{\underline{a}t}}\ {(}{{}^{\mathrm{st}}\mathrm{size}}\ {\div}\ {2}{)}\ {\mathrm{\underline{c}at}}\ {28}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"font-size"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"18"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"text-anchor"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"middle"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\text{"\#374151"}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"font-family"}}\ {{}^{\mathrm{v}}\mathrm{\underline{a}ttr}}\ {\text{"ui-sans-serif, system-ui, sans-serif"}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{t}ext}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{i}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{idiomNames}}
186 (st:size c_at st:size) v:p_icture caption c_at painted\ \ {(}{{}^{\mathrm{st}}\mathrm{size}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{st}}\mathrm{size}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}icture}}\ {\mathrm{caption}}\ {\mathrm{\underline{c}at}}\ {\mathrm{painted}}  (stsize c‾at stsize) vp‾icture caption c‾at painted\ \ {(}{{}^{\mathrm{st}}\mathrm{size}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{st}}\mathrm{size}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}icture}}\ {\mathrm{caption}}\ {\mathrm{\underline{c}at}}\ {\mathrm{painted}}
187}{\}}}{\}}
189u:j_oin := { b -> d_isclose '{ x y -> e_nclose (d_isclose x) c_at d_isclose y } r_/ b }{{}^{\mathrm{u}}\mathrm{\underline{j}oin}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}\ {\}}uj‾oin ← { b → d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at d‾isclose y } r‾/ b }{{}^{\mathrm{u}}\mathrm{\underline{j}oin}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}\ {\}}
196u:w_here := { s ->{{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}uw‾here ← { s →{{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
197 i := d_isclose ((cm:IDIOM c_at 0.0) u:i_tem s) s_elect idioms\ \ {\mathrm{i}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{idioms}}  i ← d‾isclose ((cmIDIOM c‾at 0.0) ui‾tem s) s‾elect idioms\ \ {\mathrm{i}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{idioms}}
198 t := d_isclose ((cm:TOP c_at 0.0) u:i_tem s) s_elect languages\ \ {\mathrm{t}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}  t ← d‾isclose ((cmTOP c‾at 0.0) ui‾tem s) s‾elect languages\ \ {\mathrm{t}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}
199 b := d_isclose ((cm:BOTTOM c_at 0.0) u:i_tem s) s_elect languages\ \ {\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}  b ← d‾isclose ((cmBOTTOM c‾at 0.0) ui‾tem s) s‾elect languages\ \ {\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {0.0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}
200 "at " c_at i c_at " " c_at t c_at " " c_at b\ \ {\text{"at "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{i}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{t}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{b}}  "at " c‾at i c‾at " " c‾at t c‾at " " c‾at b\ \ {\text{"at "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{i}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{t}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{b}}
201}{\}}}{\}}
207u:l_oop := { state ->{{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}ul‾oop ← { state →{{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}
208 e := []E_VENT @\ \ {\mathrm{e}}\ {\leftarrow}\ {\square \mathrm{\underline{E}VENT}}\ {@}  e ← □E‾VENT @\ \ {\mathrm{e}}\ {\leftarrow}\ {\square \mathrm{\underline{E}VENT}}\ {@}
209 kind := []E_KIND e\ \ {\mathrm{kind}}\ {\leftarrow}\ {\square \mathrm{\underline{E}KIND}}\ {\mathrm{e}}  kind ← □E‾KIND e\ \ {\mathrm{kind}}\ {\leftarrow}\ {\square \mathrm{\underline{E}KIND}}\ {\mathrm{e}}
210 kind m_atch "end" ? state\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"end"}}\ {?}\ {\mathrm{state}}  kind m‾atch "end" ? state\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"end"}}\ {?}\ {\mathrm{state}}
211 next := state cm:u_pdate e\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{state}}\ {{}^{\mathrm{cm}}\mathrm{\underline{u}pdate}}\ {\mathrm{e}}  next ← state cmu‾pdate e\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{state}}\ {{}^{\mathrm{cm}}\mathrm{\underline{u}pdate}}\ {\mathrm{e}}
212 "(u:w_here state) m_atch u:w_here next" u_nless< "p_rint! u:w_here next"\ \ {\text{"(u:w\_here state) m\_atch u:w\_here next"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! u:w\_here next"}}  "(u:w_here state) m_atch u:w_here next" u‾nless< "p_rint! u:w_here next"\ \ {\text{"(u:w\_here state) m\_atch u:w\_here next"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! u:w\_here next"}}
213 "(cm:m_ode state) m_atch cm:m_ode next" u_nless< "p_rint! \"mode \" c_at cm:m_ode next"\ \ {\text{"(cm:m\_ode state) m\_atch cm:m\_ode next"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! \textbackslash{}"mode \textbackslash{}" c\_at cm:m\_ode next"}}  "(cm:m_ode state) m_atch cm:m_ode next" u‾nless< "p_rint! \"mode \" c_at cm:m_ode next"\ \ {\text{"(cm:m\_ode state) m\_atch cm:m\_ode next"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! \textbackslash{}"mode \textbackslash{}" c\_at cm:m\_ode next"}}
214 "n_ot kind m_atch \"tick\"" u_nless< "[]S_HOW u:s_tone next"\ \ {\text{"n\_ot kind m\_atch \textbackslash{}"tick\textbackslash{}""}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"[]S\_HOW u:s\_tone next"}}  "n_ot kind m_atch \"tick\"" u‾nless< "[]S_HOW u:s_tone next"\ \ {\text{"n\_ot kind m\_atch \textbackslash{}"tick\textbackslash{}""}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"[]S\_HOW u:s\_tone next"}}
215 u:l_oop next\ \ {{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\mathrm{next}}  ul‾oop next\ \ {{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\mathrm{next}}
216}{\}}}{\}}
221start := cm:r_esume cm:s_ettle (cm:BOTTOM c_at 2.0) cm:c_hoose (t_ally idioms) cm:s_tart t_ally languages{\mathrm{start}}\ {\leftarrow}\ {{}^{\mathrm{cm}}\mathrm{\underline{r}esume}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}ettle}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {2.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{idioms}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tart}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{languages}}start ← cmr‾esume cms‾ettle (cmBOTTOM c‾at 2.0) cmc‾hoose (t‾ally idioms) cms‾tart t‾ally languages{\mathrm{start}}\ {\leftarrow}\ {{}^{\mathrm{cm}}\mathrm{\underline{r}esume}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}ettle}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {2.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{idioms}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tart}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{languages}}
222shown := p_rint! u:w_here start{\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\mathrm{start}}shown ← p‾rint! uw‾here start{\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\mathrm{start}}
223mode := p_rint! "mode " c_at cm:m_ode start{\mathrm{mode}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"mode "}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{\underline{m}ode}}\ {\mathrm{start}}mode ← p‾rint! "mode " c‾at cmm‾ode start{\mathrm{mode}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"mode "}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{\underline{m}ode}}\ {\mathrm{start}}
224u:l_oop start{{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\mathrm{start}}ul‾oop start{{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\mathrm{start}}

demos/rotate.xtl

5u:f_rames := { n b ->{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}uf‾rames ← { n b →{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}
6 n = 0 ? n\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {\mathrm{n}}  n = 0 ? n\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {\mathrm{n}}
7 s := p_rint! b\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{b}}  s ← p‾rint! b\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{b}}
8 gap := p_rint! ""\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}  gap ← p‾rint! ""\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}
9 (n - 1) u:f_rames -1 o_-_12 b\ \ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{b}}  (n − 1) uf‾rames −1 o‾−12 b\ \ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{b}}
10}{\}}}{\}}
11arrow := 6 8 r_eshape ".#.......##.....###.....##......#......................."{\mathrm{arrow}}\ {\leftarrow}\ {6}\ {8}\ {\mathrm{\underline{r}eshape}}\ {\text{".\#.......\#\#.....\#\#\#.....\#\#......\#......................."}}arrow ← 6 8 r‾eshape ".#.......##.....###.....##......#......................."{\mathrm{arrow}}\ {\leftarrow}\ {6}\ {8}\ {\mathrm{\underline{r}eshape}}\ {\text{".\#.......\#\#.....\#\#\#.....\#\#......\#......................."}}
12shown := 8 u:f_rames arrow{\mathrm{shown}}\ {\leftarrow}\ {8}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\mathrm{arrow}}shown ← 8 uf‾rames arrow{\mathrm{shown}}\ {\leftarrow}\ {8}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\mathrm{arrow}}

demos/square.xtl

3u:s_quare := { _r * _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}us‾quare ← { _r × _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
4u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}

demos/stats.xtl

5"s:" u_se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
7v := 2 4 4 4 5 5 7 9{\mathrm{v}}\ {\leftarrow}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}v ← 2 4 4 4 5 5 7 9{\mathrm{v}}\ {\leftarrow}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}
8s:m_ean v # 5.0{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {\mathrm{v}}sm‾ean v{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {\mathrm{v}}
9s:v_ariance v # the mean squared deviation: 4.0{{}^{\mathrm{s}}\mathrm{\underline{v}ariance}}\ {\mathrm{v}}sv‾ariance v{{}^{\mathrm{s}}\mathrm{\underline{v}ariance}}\ {\mathrm{v}}
10s:s_d v # the standard deviation: 2.0{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {\mathrm{v}}ss‾d v{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {\mathrm{v}}
11s:r_ange v # largest minus smallest: 7{{}^{\mathrm{s}}\mathrm{\underline{r}ange}}\ {\mathrm{v}}sr‾ange v{{}^{\mathrm{s}}\mathrm{\underline{r}ange}}\ {\mathrm{v}}
12s:m_ean 1.5 2.5 # the same functions work on Floats{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {1.5}\ {2.5}sm‾ean 1.5 2.5{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {1.5}\ {2.5}

demos/sub.xtl

3u:s_ub := { _l - _r }{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}us‾ub ← { _l − _r }{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}
410 u:s_ub 3{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}10 us‾ub 3{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}
5u:t_enMinus := u:s_ub 10 # partial application fixes the left argument{{}^{\mathrm{u}}\mathrm{\underline{t}enMinus}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {10}ut‾enMinus ← us‾ub 10{{}^{\mathrm{u}}\mathrm{\underline{t}enMinus}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {10}
6u:t_enMinus 3{{}^{\mathrm{u}}\mathrm{\underline{t}enMinus}}\ {3}ut‾enMinus 3{{}^{\mathrm{u}}\mathrm{\underline{t}enMinus}}\ {3}

demos/tour.xtl

1242 # an Int{42}42{42}
13-3 2.5 # a negative literal; a strand has one type (Float){-3}\ {2.5}−3 2.5{-3}\ {2.5}
14x := 3 # `:=` binds; `=` is always equality{\mathrm{x}}\ {\leftarrow}\ {3}x ← 3{\mathrm{x}}\ {\leftarrow}\ {3}
15x^2 # a literal exponent touches its value: superscript{\mathrm{x}}^{2}x2{\mathrm{x}}^{2}
164^-1 # a negative exponent gives a Float (a literal base){4}^{-1}4−1{4}^{-1}
172 ^ 10 # spaced `^` is the power function (computed exponents){2}\ {\mathbin{\hat{}}}\ {10}2 ^ 10{2}\ {\mathbin{\hat{}}}\ {10}
187 / 2 # `/` always gives a Float{7}\ {\div}\ {2}7 ÷ 2{7}\ {\div}\ {2}
197 d_iv 2; 7 m_od 3 # integer quotient and remainder; `;` separates statements{7}\ {\mathrm{\underline{d}iv}}\ {2}{\diamond}\ {7}\ {\mathrm{\underline{m}od}}\ {3}7 d‾iv 2⋄ 7 m‾od 3{7}\ {\mathrm{\underline{d}iv}}\ {2}{\diamond}\ {7}\ {\mathrm{\underline{m}od}}\ {3}
20(0.1 + 0.2) = 0.3 # `=` is exact: 0 (false){(}{0.1}\ {+}\ {0.2}{)}\ {=}\ {0.3}(0.1 + 0.2) = 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {=}\ {0.3}
21(0.1 + 0.2) e_q~ 0.3 # tolerant equality: 1{(}{0.1}\ {+}\ {0.2}{)}\ {\mathrm{\underline{e}q}{\sim}}\ {0.3}(0.1 + 0.2) e‾q∼ 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {\mathrm{\underline{e}q}{\sim}}\ {0.3}
22(3 < 4) & 2 != 2 # Bool (`& | !=`); no precedence: parenthesize the left{(}{3}\ {<}\ {4}{)}\ {\wedge}\ {2}\ {\neq}\ {2}(3 < 4) ∧ 2 ≠ 2{(}{3}\ {<}\ {4}{)}\ {\wedge}\ {2}\ {\neq}\ {2}
23f_loat 3 # Int to Float{\mathrm{\underline{f}loat}}\ {3}f‾loat 3{\mathrm{\underline{f}loat}}\ {3}
24s_in (p_i @) / 2 # trigonometry in radians; `p_i @` is pi (niladic){\mathrm{\underline{s}in}}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {2}s‾in (p‾i @) ÷ 2{\mathrm{\underline{s}in}}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {2}
25a_tan 1 # and c_os{\mathrm{\underline{a}tan}}\ {1}a‾tan 1{\mathrm{\underline{a}tan}}\ {1}
28count! := 0 # only names ending in ! (like `count!`) may be reassigned{\mathrm{count}!}\ {\leftarrow}\ {0}count! ← 0{\mathrm{count}!}\ {\leftarrow}\ {0}
29count! := count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}count! ← count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}
30count!{\mathrm{count}!}count!{\mathrm{count}!}
33"hello"{\text{"hello"}}"hello"{\text{"hello"}}
34"abc" = "abd" # item by item{\text{"abc"}}\ {=}\ {\text{"abd"}}"abc" = "abd"{\text{"abc"}}\ {=}\ {\text{"abd"}}
353 t_ake "hello"{3}\ {\mathrm{\underline{t}ake}}\ {\text{"hello"}}3 t‾ake "hello"{3}\ {\mathrm{\underline{t}ake}}\ {\text{"hello"}}
36"hello X̲ᵉTᵃL" # strings and comments may hold any Unicode (code may not){\text{"hello \underline{X}ᵉTᵃL"}}"hello X‾ᵉTᵃL"{\text{"hello \underline{X}ᵉTᵃL"}}
39m := 2 3 r_eshape r_ange 6 # 1-origin: `r_ange 6` is 1 2 3 4 5 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}m ← 2 3 r‾eshape r‾ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
40m{\mathrm{m}}m{\mathrm{m}}
41s_hape m; t_ally m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}{\diamond}\ {\mathrm{\underline{t}ally}}\ {\mathrm{m}}s‾hape m⋄ t‾ally m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}{\diamond}\ {\mathrm{\underline{t}ally}}\ {\mathrm{m}}
42m * 10 # a scalar extends to every item{\mathrm{m}}\ {\times}\ {10}m × 10{\mathrm{m}}\ {\times}\ {10}
432 s_elect m # the 2nd major cell (row){2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}2 s‾elect m{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
44-1 t_ake m; 1 d_rop m # take and drop count from the end when negative{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{m}}{\diamond}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}−1 t‾ake m⋄ 1 d‾rop m{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{m}}{\diamond}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}
45(f_irst m) c_at 7 8 9 # join along the leading axis{(}{\mathrm{\underline{f}irst}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {7}\ {8}\ {9}(f‾irst m) c‾at 7 8 9{(}{\mathrm{\underline{f}irst}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {7}\ {8}\ {9}
46m c_at_2 0 9 # ... or along axis 2: a column on the right{\mathrm{m}}\ {{\mathrm{\underline{c}at}}_{2}}\ {0}\ {9}m c‾at2 0 9{\mathrm{m}}\ {{\mathrm{\underline{c}at}}_{2}}\ {0}\ {9}
471 0 2 r_eplicate 7 8 9 # replicate: each item, as many times as its count{1}\ {0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {7}\ {8}\ {9}1 0 2 r‾eplicate 7 8 9{1}\ {0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {7}\ {8}\ {9}
4810 10 10 e_ncode 123 # encode: the digits, in the radices on the left{10}\ {10}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}10 10 10 e‾ncode 123{10}\ {10}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}
4924 60 60 d_ecode 1 2 5 # decode: 1 hour 2 minutes 5 seconds, in seconds{24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {5}24 60 60 d‾ecode 1 2 5{24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {5}
50r_avel m{\mathrm{\underline{r}avel}}\ {\mathrm{m}}r‾avel m{\mathrm{\underline{r}avel}}\ {\mathrm{m}}
5110 ^ r_ev o_ffsets 3 # `o_ffsets` counts from 0: place values 100 10 1{10}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{o}ffsets}}\ {3}10 ^ r‾ev o‾ffsets 3{10}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{o}ffsets}}\ {3}
54u:s_quare := { _r * _r } # `_r` is the right argument{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}us‾quare ← { _r × _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
55u:s_quare 1 2 3 # scalar functions work on arrays unchanged{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {1}\ {2}\ {3}us‾quare 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {1}\ {2}\ {3}
56u:s_ub := { _l - _r } # `_l` is the left argument{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}us‾ub ← { _l − _r }{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}
5710 u:s_ub 3 # dyadic use is currying: `(u:s_ub 10) 3`{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}10 us‾ub 3{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}
58u:h_yp := { a b -> ((a * a) + b * b) ^ 0.5 } # named parameters before `->`{{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{(}{\mathrm{a}}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\times}\ {\mathrm{b}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}uh‾yp ← { a b → ((a × a) + b × b) ^ 0.5 }{{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{(}{\mathrm{a}}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\times}\ {\mathrm{b}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}
593 u:h_yp 4{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {4}3 uh‾yp 4{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {4}
60u:s_ign := { x -> x < 0 ? -1; x = 0 ? 0; 1 } # guards: condition `?` result{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}us‾ign ← { x → x < 0 ? −1⋄ x = 0 ? 0⋄ 1 }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}
61u:f_act := { n ->{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}uf‾act ← { n →{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
62 n <= 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}  n ≤ 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}
63 n * u:f_act n - 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}  n × uf‾act n − 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}
64}{\}}}{\}}
65u:f_act 10 # recursion{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}uf‾act 10{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}
66u:t_wo := { @ -> 2 } # a niladic function takes `@`{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {2}\ {\}}ut‾wo ← { @ → 2 }{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {2}\ {\}}
67u:t_wo @{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {@}ut‾wo @{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {@}
68u:k_eep := { a ~b -> a } # `~b` is a lazy parameter: evaluated{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\sim}{\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\}}uk‾eep ← { a ∼b → a }{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\sim}{\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\}}
697 u:k_eep 1 / 0 # only if used, so no division by zero{7}\ {{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {1}\ {\div}\ {0}7 uk‾eep 1 ÷ 0{7}\ {{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {1}\ {\div}\ {0}
70(u:s_ub 100)_ 1 # `(expr)_` applies a function value{(}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {100}{)}{\_}\ {1}(us‾ub 100)_ 1{(}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {100}{)}{\_}\ {1}
71u:t_wice := { f_ x -> f_ f_ x } # apply a function parameter two times{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}ut‾wice ← { f‾ x → f‾ f‾ x }{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}
72'{ _r + 10 } u:t_wice 3 # 3 + 10 + 10{\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {10}\ {\}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {3}’{ _r + 10 } ut‾wice 3{\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {10}\ {\}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {3}
73'u:s_quare u:t_wice 3 # square (square 3) = 9 squared{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {3}’us‾quare ut‾wice 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {3}
76'+ r_/ 1 2 3 4 # a quoted function is the operand of `r_/` (reduce){\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}’+ r‾/ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}
77'- r_/ 1 2 3 # reduce folds from the right: 1 - (2 - 3){\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’− r‾/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
78'+ s_\ 1 2 3 4 # scan: the prefix reductions{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}\ {4}’+ s‾\ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}\ {4}
79'+ r_/ m # the leading axis: column sums{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
80'u:s_ign e_ach -5 0 5 # each: apply to every item{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {-5}\ {0}\ {5}’us‾ign e‾ach −5 0 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {-5}\ {0}\ {5}
811 2 3 '= e_ach 1 5 3 # dyadic each is currying{1}\ {2}\ {3}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {1}\ {5}\ {3}1 2 3 ’= e‾ach 1 5 3{1}\ {2}\ {3}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {1}\ {5}\ {3}
821 2 3 '* t_able 1 2 3 # table: the outer product{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}1 2 3 ’× t‾able 1 2 3{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}
83m '+ '* i_nner 1 1 1 # inner product: the nearest operand pairs{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}m ’+ ’× i‾nner 1 1 1{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}
84'n_eg 'a_bs c_ompose -4 # compose: the nearest operand applies first{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-4}’n‾eg ’a‾bs c‾ompose −4{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-4}
852 '/ s_wap 1 # swap the arguments: 1 / 2{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}2 ’÷ s‾wap 1{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}
86'{ _l + _r } r_/ 1 2 3 # a quoted lambda is an operand too{\text{'}}{\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’{ _l + _r } r‾/ 1 2 3{\text{'}}{\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
89u:a_vg := ['+ r_/ / t_ally] # fork: `('+ r_/ x) / t_ally x`{{}^{\mathrm{u}}\mathrm{\underline{a}vg}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}ua‾vg ← [’+ r‾/ ÷ t‾ally]{{}^{\mathrm{u}}\mathrm{\underline{a}vg}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}
90u:a_vg 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{a}vg}}\ {1}\ {2}\ {3}\ {4}ua‾vg 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{a}vg}}\ {1}\ {2}\ {3}\ {4}
91{ x -> ('+ r_/ x) / t_ally x } 1 2 3 4 # the same, spelled out{\{}\ {\mathrm{x}}\ {\to}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{x}}{)}\ {\div}\ {\mathrm{\underline{t}ally}}\ {\mathrm{x}}\ {\}}\ {1}\ {2}\ {3}\ {4}{ x → (’+ r‾/ x) ÷ t‾ally x } 1 2 3 4{\{}\ {\mathrm{x}}\ {\to}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{x}}{)}\ {\div}\ {\mathrm{\underline{t}ally}}\ {\mathrm{x}}\ {\}}\ {1}\ {2}\ {3}\ {4}
92[n_eg a_bs] -5 # atop: `n_eg a_bs x`{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-5}[n‾eg a‾bs] −5{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-5}
933 [l_eft + r_ight] 4 # dyadic fork: `(x l_eft y) + (x r_ight y)`, so `x + y`{3}\ {[}{\mathrm{\underline{l}eft}}\ {+}\ {\mathrm{\underline{r}ight}}{]}\ {4}3 [l‾eft + r‾ight] 4{3}\ {[}{\mathrm{\underline{l}eft}}\ {+}\ {\mathrm{\underline{r}ight}}{]}\ {4}
94[i_d - n_eg] 5 # hook: `x - n_eg x`{[}{\mathrm{\underline{i}d}}\ {-}\ {\mathrm{\underline{n}eg}}{]}\ {5}[i‾d − n‾eg] 5{[}{\mathrm{\underline{i}d}}\ {-}\ {\mathrm{\underline{n}eg}}{]}\ {5}
951 2 [+ * -] 3 4 # dyadic fork: `(x + y) * (x - y)`{1}\ {2}\ {[}{+}\ {\times}\ {-}{]}\ {3}\ {4}1 2 [+ × −] 3 4{1}\ {2}\ {[}{+}\ {\times}\ {-}{]}\ {3}\ {4}
96[f_irst c_at 'm_ax r_/ c_at 'm_in r_/] 3 1 4 1 5 # `(f_irst x) c_at ('m_ax r_/ x) c_at 'm_in r_/ x`{[}{\mathrm{\underline{f}irst}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}\ {3}\ {1}\ {4}\ {1}\ {5}[f‾irst c‾at ’m‾ax r‾/ c‾at ’m‾in r‾/] 3 1 4 1 5{[}{\mathrm{\underline{f}irst}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}\ {3}\ {1}\ {4}\ {1}\ {5}
97'[t_ally d_isclose] e_ach "ab" "cde" "f" # each item i: `t_ally d_isclose i`{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\text{"ab"}}\ {\text{"cde"}}\ {\text{"f"}}’[t‾ally d‾isclose] e‾ach "ab" "cde" "f"{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\text{"ab"}}\ {\text{"cde"}}\ {\text{"f"}}
1001 o_- 1 2 3 4 # rotate toward the front{1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}\ {4}1 o‾− 1 2 3 4{1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}\ {4}
101r_ev "stressed"{\mathrm{\underline{r}ev}}\ {\text{"stressed"}}r‾ev "stressed"{\mathrm{\underline{r}ev}}\ {\text{"stressed"}}
105'+ r_/ m # implicit: axis 1, so column sums{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
106'+ r_/_1 m # the same, explicit{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{m}}’+ r‾/1 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{m}}
107'+ r_/_2 m # axis 2: row sums{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}’+ r‾/2 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}
108'+ s_\_2 m # running sums along each row{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{m}}’+ s‾\2 m{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{m}}
1091 o_- m # rotate the rows (axis 1){1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{m}}1 o‾− m{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{m}}
1101 o_-_1 m # the same, explicit{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{m}}1 o‾−1 m{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{m}}
1111 o_-_2 m # rotate within each row (axis 2){1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{m}}1 o‾−2 m{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{m}}
112r_ev_2 m # reverse each row{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{m}}r‾ev2 m{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{m}}
113'+ r_/_12 m # two axes in turn: the total{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{m}}’+ r‾/12 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{m}}
114-1 0 1 o_- 1 2 3 # a list of amounts gives every rotation{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}−1 0 1 o‾− 1 2 3{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}
115s_hape -1 0 1 o_-_12 m # every combination along both axes: 3 3 2 3{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{m}}s‾hape −1 0 1 o‾−12 m{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{m}}
116o_\ m # transpose: rows become columns{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}o‾\ m{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}
117a := 2 3 4 r_eshape r_ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}a ← 2 3 4 r‾eshape r‾ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}
118s_hape o_\ a # every axis reversed: 4 3 2{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}s‾hape o‾\ a{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}
119s_hape o_\_23 a # axes 2 and 3 swapped: 2 4 3{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}s‾hape o‾\23 a{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}
120s_hape 3 1 2 t_ranspose a # axis 1 to 3, 2 to 1, 3 to 2: 3 4 2{\mathrm{\underline{s}hape}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}s‾hape 3 1 2 t‾ranspose a{\mathrm{\underline{s}hape}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}
123v := 3 1 4 1 5 9 2 6{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}v ← 3 1 4 1 5 9 2 6{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}
124s_ort v; g_rade v # sort, and the indices that sort{\mathrm{\underline{s}ort}}\ {\mathrm{v}}{\diamond}\ {\mathrm{\underline{g}rade}}\ {\mathrm{v}}s‾ort v⋄ g‾rade v{\mathrm{\underline{s}ort}}\ {\mathrm{v}}{\diamond}\ {\mathrm{\underline{g}rade}}\ {\mathrm{v}}
125u_nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}u‾nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}
126v i_ndexOf 5 7 # 7 is absent: tally + 1{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {5}\ {7}v i‾ndexOf 5 7{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {5}\ {7}
1272 7 m_ember? v{2}\ {7}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{v}}2 7 m‾ember? v{2}\ {7}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{v}}
128w_here v > 4 # indices of the 1s{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {4}w‾here v > 4{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {4}
131n := "ab" "cde" # a strand of strings: a vector of 2 boxes{\mathrm{n}}\ {\leftarrow}\ {\text{"ab"}}\ {\text{"cde"}}n ← "ab" "cde"{\mathrm{n}}\ {\leftarrow}\ {\text{"ab"}}\ {\text{"cde"}}
132n # nested values print framed (APL2's DISPLAY){\mathrm{n}}n{\mathrm{n}}
133t_ally n{\mathrm{\underline{t}ally}}\ {\mathrm{n}}t‾ally n{\mathrm{\underline{t}ally}}\ {\mathrm{n}}
134d_isclose 2 s_elect n # open the 2nd box{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}d‾isclose 2 s‾elect n{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}
135s := "to be or not"{\mathrm{s}}\ {\leftarrow}\ {\text{"to be or not"}}s ← "to be or not"{\mathrm{s}}\ {\leftarrow}\ {\text{"to be or not"}}
136(s != f_irst " ") p_artition s # cut where the mask is 0: the words, boxed{(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}(s ≠ f‾irst " ") p‾artition s{(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}
137'r_ange m_ap 1 2 3 # map: each result boxed, so it may be an array{\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}’r‾ange m‾ap 1 2 3{\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}
138d_isplay m # any value framed, as a character matrix (xetal --box prints all so){\mathrm{\underline{d}isplay}}\ {\mathrm{m}}d‾isplay m{\mathrm{\underline{d}isplay}}\ {\mathrm{m}}
141r_oll! 6 6 6 # three dice: random 1..6 each, so every run differs{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}r‾oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}
142r_oll! 6 6 6 # (and each line rolls again){\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}r‾oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}
143r_oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}r‾oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}
144p_rint! "printed, then returned" # `p_rint!` prints and returns its argument{\mathrm{\underline{p}rint}{!}}\ {\text{"printed, then returned"}}p‾rint! "printed, then returned"{\mathrm{\underline{p}rint}{!}}\ {\text{"printed, then returned"}}
15115 t_ake []G_RID 2 2 r_eshape 1 0 0 1{15}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{\underline{G}RID}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {0}\ {0}\ {1}15 t‾ake □G‾RID 2 2 r‾eshape 1 0 0 1{15}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{\underline{G}RID}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {0}\ {0}\ {1}
154"s:" u_se< "Stats" # import a library under an alias of your choosing{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
155s:m_ean 2 4 4 4 5 5 7 9 # its exported names, used through the alias{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}sm‾ean 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}
156s:s_d 2 4 4 4 5 5 7 9 # the standard deviation{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}ss‾d 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}
157s:r_ange 3 1 4 1 5 # largest minus smallest{{}^{\mathrm{s}}\mathrm{\underline{r}ange}}\ {3}\ {1}\ {4}\ {1}\ {5}sr‾ange 3 1 4 1 5{{}^{\mathrm{s}}\mathrm{\underline{r}ange}}\ {3}\ {1}\ {4}\ {1}\ {5}
158"h:" u_se< "Hello" # a library of your own, found in userlibs/{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}"h:" u‾se< "Hello"{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}
159h:h_ello @ # niladic: called with Unit{{}^{\mathrm{h}}\mathrm{\underline{h}ello}}\ {@}hh‾ello @{{}^{\mathrm{h}}\mathrm{\underline{h}ello}}\ {@}
162"c:" u_se< "Combinators" # Smullyan's birds, a standard library{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
1631 c:K_ 2 # K keeps its first argument{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}1 cK‾ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}
16410 '- c:C_ 3 # C swaps the arguments: 3 - 10{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}10 ’− cC‾ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}
165'n_eg 'a_bs c:B_ -5 # B composes, the nearest operand last: a_bs n_eg -5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {-5}’n‾eg ’a‾bs cB‾ −5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {-5}
166'* c:W_ 4 # W uses its argument twice: 4 * 4{\text{'}}{\times}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {4}’× cW‾ 4{\text{'}}{\times}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {4}
167u:t_riangle := { ~s_elf n -> n <= 1 ? 1; n + s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {+}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}ut‾riangle ← { ∼s‾elf n → n ≤ 1 ? 1⋄ n + s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {+}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
168'u:t_riangle c:Y_ 5 # Y: recursion, from a function handed itself: 1+2+3+4+5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {5}’ut‾riangle cY‾ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {5}
169n_eg^3 5 # a superscript repeats a function: n_eg three times{\mathrm{\underline{n}eg}}^{3}\ {5}n‾eg3 5{\mathrm{\underline{n}eg}}^{3}\ {5}
172u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}
173u:l_ife 5 5 r_eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}ul‾ife 5 5 r‾eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}

demos/tttml-play.xtl

6"t:" u_se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}"t:" u‾se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}
10v := n_umbers []N_GET "work/tttml.model"{\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{n}umbers}}\ {\square \mathrm{\underline{N}GET}}\ {\text{"work/tttml.model"}}v ← n‾umbers □N‾GET "work/tttml.model"{\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{n}umbers}}\ {\square \mathrm{\underline{N}GET}}\ {\text{"work/tttml.model"}}
11m := (2 c_at (t_ally v) d_iv 2) r_eshape v{\mathrm{m}}\ {\leftarrow}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{v}}m ← (2 c‾at (t‾ally v) d‾iv 2) r‾eshape v{\mathrm{m}}\ {\leftarrow}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{v}}
12t_ally 1 s_elect m{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}t‾ally 1 s‾elect m{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
15u:a_sk := { s ->{{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}ua‾sk ← { s →{{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
16 shown := p_rint! "your move (1 to 9):"\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"your move (1 to 9):"}}  shown ← p‾rint! "your move (1 to 9):"\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"your move (1 to 9):"}}
17 t := []R_EAD @\ \ {\mathrm{t}}\ {\leftarrow}\ {\square \mathrm{\underline{R}EAD}}\ {@}  t ← □R‾EAD @\ \ {\mathrm{t}}\ {\leftarrow}\ {\square \mathrm{\underline{R}EAD}}\ {@}
18 k := "123456789" i_ndexOf f_irst t c_at " "\ \ {\mathrm{k}}\ {\leftarrow}\ {\text{"123456789"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{t}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}  k ← "123456789" i‾ndexOf f‾irst t c‾at " "\ \ {\mathrm{k}}\ {\leftarrow}\ {\text{"123456789"}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{t}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}
19 (k <= 9) & 0 = k s_elect s c_at 1 ? k; u:a_sk s\ \ {(}{\mathrm{k}}\ {\leq}\ {9}{)}\ {\wedge}\ {0}\ {=}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {1}\ {?}\ {\mathrm{k}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\mathrm{s}}  (k ≤ 9) ∧ 0 = k s‾elect s c‾at 1 ? k⋄ ua‾sk s\ \ {(}{\mathrm{k}}\ {\leq}\ {9}{)}\ {\wedge}\ {0}\ {=}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {1}\ {?}\ {\mathrm{k}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\mathrm{s}}
20}{\}}}{\}}
23u:y_ou := { s ->{{}^{\mathrm{u}}\mathrm{\underline{y}ou}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}uy‾ou ← { s →{{}^{\mathrm{u}}\mathrm{\underline{y}ou}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
24 s := s t:a_fter u:a_sk s\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\mathrm{s}}  s ← s ta‾fter ua‾sk s\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}}\ {\mathrm{s}}
25 shown := p_rint! t:s_how s\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {\mathrm{s}}  shown ← p‾rint! ts‾how s\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {\mathrm{s}}
26 gap := p_rint! ""\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}  gap ← p‾rint! ""\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}
27 0 = t:o_utcome s ? u:m_e s; s\ \ {0}\ {=}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {\mathrm{s}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{m}e}}\ {\mathrm{s}}{\diamond}\ {\mathrm{s}}  0 = to‾utcome s ? um‾e s⋄ s\ \ {0}\ {=}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {\mathrm{s}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{m}e}}\ {\mathrm{s}}{\diamond}\ {\mathrm{s}}
28}{\}}}{\}}
29u:m_e := { s ->{{}^{\mathrm{u}}\mathrm{\underline{m}e}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}um‾e ← { s →{{}^{\mathrm{u}}\mathrm{\underline{m}e}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
30 s := s t:a_fter m t:c_hoose s\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}  s ← s ta‾fter m tc‾hoose s\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}
31 shown := p_rint! t:s_how s\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {\mathrm{s}}  shown ← p‾rint! ts‾how s\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {\mathrm{s}}
32 gap := p_rint! ""\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}  gap ← p‾rint! ""\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}
33 0 = t:o_utcome s ? u:y_ou s; s\ \ {0}\ {=}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {\mathrm{s}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{y}ou}}\ {\mathrm{s}}{\diamond}\ {\mathrm{s}}  0 = to‾utcome s ? uy‾ou s⋄ s\ \ {0}\ {=}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {\mathrm{s}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{y}ou}}\ {\mathrm{s}}{\diamond}\ {\mathrm{s}}
34}{\}}}{\}}
35u:v_erdict := { w -> w = 1 ? "you win"; w = -1 ? "it wins"; "a draw" }{{}^{\mathrm{u}}\mathrm{\underline{v}erdict}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\to}\ {\mathrm{w}}\ {=}\ {1}\ {?}\ {\text{"you win"}}{\diamond}\ {\mathrm{w}}\ {=}\ {-1}\ {?}\ {\text{"it wins"}}{\diamond}\ {\text{"a draw"}}\ {\}}uv‾erdict ← { w → w = 1 ? "you win"⋄ w = −1 ? "it wins"⋄ "a draw" }{{}^{\mathrm{u}}\mathrm{\underline{v}erdict}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\to}\ {\mathrm{w}}\ {=}\ {1}\ {?}\ {\text{"you win"}}{\diamond}\ {\mathrm{w}}\ {=}\ {-1}\ {?}\ {\text{"it wins"}}{\diamond}\ {\text{"a draw"}}\ {\}}
37u:v_erdict t:o_utcome u:y_ou 9 r_eshape 0{{}^{\mathrm{u}}\mathrm{\underline{v}erdict}}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {{}^{\mathrm{u}}\mathrm{\underline{y}ou}}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}uv‾erdict to‾utcome uy‾ou 9 r‾eshape 0{{}^{\mathrm{u}}\mathrm{\underline{v}erdict}}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {{}^{\mathrm{u}}\mathrm{\underline{y}ou}}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}

demos/tttml-train.xtl

6"t:" u_se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}"t:" u‾se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}
8m := 2000 t:t_rain! t:empty{\mathrm{m}}\ {\leftarrow}\ {2000}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rain}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}m ← 2000 tt‾rain! tempty{\mathrm{m}}\ {\leftarrow}\ {2000}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rain}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}
1150 t:t_rial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rial}{!}}\ {\mathrm{m}}50 tt‾rial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rial}{!}}\ {\mathrm{m}}
15(f_ormat m) []N_PUT "work/tttml.model"{(}{\mathrm{\underline{f}ormat}}\ {\mathrm{m}}{)}\ {\square \mathrm{\underline{N}PUT}}\ {\text{"work/tttml.model"}}(f‾ormat m) □N‾PUT "work/tttml.model"{(}{\mathrm{\underline{f}ormat}}\ {\mathrm{m}}{)}\ {\square \mathrm{\underline{N}PUT}}\ {\text{"work/tttml.model"}}

demos/tttml.xtl

6"t:" u_se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}"t:" u‾se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}
9t:s_how 1 -1 0 0 1 0 0 0 -1{{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {1}\ {-1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {-1}ts‾how 1 −1 0 0 1 0 0 0 −1{{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {1}\ {-1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {-1}
12t:o_utcome 1 1 1 -1 -1 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {1}\ {1}\ {-1}\ {-1}\ {0}\ {0}\ {0}\ {0}to‾utcome 1 1 1 −1 −1 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {1}\ {1}\ {-1}\ {-1}\ {0}\ {0}\ {0}\ {0}
13t:o_utcome 1 -1 1 1 -1 -1 -1 1 1{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {-1}\ {1}\ {1}to‾utcome 1 −1 1 1 −1 −1 −1 1 1{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {-1}\ {1}\ {1}
16t:c_ode 1 0 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}tc‾ode 1 0 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
17t:c_ode 0 0 1 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}tc‾ode 0 0 1 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
21m := 2000 t:t_rain! t:empty{\mathrm{m}}\ {\leftarrow}\ {2000}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rain}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}m ← 2000 tt‾rain! tempty{\mathrm{m}}\ {\leftarrow}\ {2000}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rain}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}
22t_ally 1 s_elect m{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}t‾ally 1 s‾elect m{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
2650 t:t_rial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rial}{!}}\ {\mathrm{m}}50 tt‾rial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rial}{!}}\ {\mathrm{m}}
3050 t:s_elfTrial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{s}elfTrial}{!}}\ {\mathrm{m}}50 ts‾elfTrial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{s}elfTrial}{!}}\ {\mathrm{m}}
33t:b_oards t:b_est m{{}^{\mathrm{t}}\mathrm{\underline{b}oards}}\ {{}^{\mathrm{t}}\mathrm{\underline{b}est}}\ {\mathrm{m}}tb‾oards tb‾est m{{}^{\mathrm{t}}\mathrm{\underline{b}oards}}\ {{}^{\mathrm{t}}\mathrm{\underline{b}est}}\ {\mathrm{m}}

demos/unit.xtl

4u:a_nswer := { @ -> 42 }{{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {42}\ {\}}ua‾nswer ← { @ → 42 }{{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {42}\ {\}}
5u:a_nswer @{{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {@}ua‾nswer @{{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {@}

demos/user-macros.xtl

7"r:" u_se< "Repeat"{\text{"r:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Repeat"}}"r:" u‾se< "Repeat"{\text{"r:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Repeat"}}
8"3" r:t_imes< "\"hip hip\""{\text{"3"}}\ {{}^{\mathrm{r}}\mathrm{\underline{t}imes}{<}}\ {\text{"\textbackslash{}"hip hip\textbackslash{}""}}"3" rt‾imes< "\"hip hip\""{\text{"3"}}\ {{}^{\mathrm{r}}\mathrm{\underline{t}imes}{<}}\ {\text{"\textbackslash{}"hip hip\textbackslash{}""}}
9"hooray"{\text{"hooray"}}"hooray"{\text{"hooray"}}
13x := 1{\mathrm{x}}\ {\leftarrow}\ {1}x ← 1{\mathrm{x}}\ {\leftarrow}\ {1}
14"5" r:t_imes< "x := x * 2"{\text{"5"}}\ {{}^{\mathrm{r}}\mathrm{\underline{t}imes}{<}}\ {\text{"x := x * 2"}}"5" rt‾imes< "x := x * 2"{\text{"5"}}\ {{}^{\mathrm{r}}\mathrm{\underline{t}imes}{<}}\ {\text{"x := x * 2"}}
15x{\mathrm{x}}x{\mathrm{x}}

lib/Combinators.xtl

11l:I_ := { x -> x } # Idiot Bird (identity){{}^{\mathrm{l}}\mathrm{\underline{I}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}lI‾ ← { x → x }{{}^{\mathrm{l}}\mathrm{\underline{I}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}
12l:K_ := { x y -> x } # Kestrel{{}^{\mathrm{l}}\mathrm{\underline{K}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{x}}\ {\}}lK‾ ← { x y → x }{{}^{\mathrm{l}}\mathrm{\underline{K}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{x}}\ {\}}
13l:T_ := { x y_ -> y_ x } # Thrush{{}^{\mathrm{l}}\mathrm{\underline{T}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{\underline{y}}}\ {\mathrm{x}}\ {\}}lT‾ ← { x y‾ → y‾ x }{{}^{\mathrm{l}}\mathrm{\underline{T}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{\underline{y}}}\ {\mathrm{x}}\ {\}}
14l:W_ := { x_ y -> y x_ y } # Warbler{{}^{\mathrm{l}}\mathrm{\underline{W}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\}}lW‾ ← { x‾ y → y x‾ y }{{}^{\mathrm{l}}\mathrm{\underline{W}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\}}
15l:W_1 := { x y_ -> x y_ x } # Converse Warbler{{}^{\mathrm{l}}\mathrm{\underline{W}1}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\mathrm{x}}\ {\}}lW‾1 ← { x y‾ → x y‾ x }{{}^{\mathrm{l}}\mathrm{\underline{W}1}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\mathrm{x}}\ {\}}
17l:B_ := { x_ y_ z -> x_ y_ z } # Bluebird: compose{{}^{\mathrm{l}}\mathrm{\underline{B}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\}}lB‾ ← { x‾ y‾ z → x‾ y‾ z }{{}^{\mathrm{l}}\mathrm{\underline{B}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\}}
18l:B_1 := { x_ y_ z w -> x_ z y_ w } # Blackbird{{}^{\mathrm{l}}\mathrm{\underline{B}1}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}\ {\mathrm{\underline{y}}}\ {\mathrm{w}}\ {\}}lB‾1 ← { x‾ y‾ z w → x‾ z y‾ w }{{}^{\mathrm{l}}\mathrm{\underline{B}1}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}\ {\mathrm{\underline{y}}}\ {\mathrm{w}}\ {\}}
19l:B_2 := { x_ y_ z w v -> x_ (z y_ w)_ v } # Bunting{{}^{\mathrm{l}}\mathrm{\underline{B}2}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {\mathrm{\underline{x}}}\ {(}{\mathrm{z}}\ {\mathrm{\underline{y}}}\ {\mathrm{w}}{)}{\_}\ {\mathrm{v}}\ {\}}lB‾2 ← { x‾ y‾ z w v → x‾ (z y‾ w)_ v }{{}^{\mathrm{l}}\mathrm{\underline{B}2}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {\mathrm{\underline{x}}}\ {(}{\mathrm{z}}\ {\mathrm{\underline{y}}}\ {\mathrm{w}}{)}{\_}\ {\mathrm{v}}\ {\}}
20l:B_3 := { x_ y_ z_ w -> x_ y_ z_ w } # Becard{{}^{\mathrm{l}}\mathrm{\underline{B}3}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\}}lB‾3 ← { x‾ y‾ z‾ w → x‾ y‾ z‾ w }{{}^{\mathrm{l}}\mathrm{\underline{B}3}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\}}
21l:C_ := { x_ y z -> z x_ y } # Cardinal: swap{{}^{\mathrm{l}}\mathrm{\underline{C}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\to}\ {\mathrm{z}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\}}lC‾ ← { x‾ y z → z x‾ y }{{}^{\mathrm{l}}\mathrm{\underline{C}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\to}\ {\mathrm{z}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\}}
22l:D_ := { x_ y z_ w -> y x_ z_ w } # Dove{{}^{\mathrm{l}}\mathrm{\underline{D}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\}}lD‾ ← { x‾ y z‾ w → y x‾ z‾ w }{{}^{\mathrm{l}}\mathrm{\underline{D}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\}}
23l:D_1 := { x_ y z w_ v -> (y x_ z)_ w_ v } # Dickcissel{{}^{\mathrm{l}}\mathrm{\underline{D}1}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{\underline{w}}}\ {\mathrm{v}}\ {\to}\ {(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{\underline{w}}}\ {\mathrm{v}}\ {\}}lD‾1 ← { x‾ y z w‾ v → (y x‾ z)_ w‾ v }{{}^{\mathrm{l}}\mathrm{\underline{D}1}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{\underline{w}}}\ {\mathrm{v}}\ {\to}\ {(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{\underline{w}}}\ {\mathrm{v}}\ {\}}
24l:D_2 := { x_ y_ z w_ v -> (y_ z) x_ w_ v } # Dovekie{{}^{\mathrm{l}}\mathrm{\underline{D}2}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{\underline{w}}}\ {\mathrm{v}}\ {\to}\ {(}{\mathrm{\underline{y}}}\ {\mathrm{z}}{)}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{w}}}\ {\mathrm{v}}\ {\}}lD‾2 ← { x‾ y‾ z w‾ v → (y‾ z) x‾ w‾ v }{{}^{\mathrm{l}}\mathrm{\underline{D}2}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{\underline{w}}}\ {\mathrm{v}}\ {\to}\ {(}{\mathrm{\underline{y}}}\ {\mathrm{z}}{)}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{w}}}\ {\mathrm{v}}\ {\}}
25l:E_ := { x_ y z_ w v -> y x_ w z_ v } # Eagle{{}^{\mathrm{l}}\mathrm{\underline{E}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}\ {\mathrm{\underline{z}}}\ {\mathrm{v}}\ {\}}lE‾ ← { x‾ y z‾ w v → y x‾ w z‾ v }{{}^{\mathrm{l}}\mathrm{\underline{E}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}\ {\mathrm{\underline{z}}}\ {\mathrm{v}}\ {\}}
26l:E_h := { x_ a_ b c d_ e f -> (b a_ c) x_ e d_ f } # Bald Eagle{{}^{\mathrm{l}}\mathrm{\underline{E}h}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{a}}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\mathrm{\underline{d}}}\ {\mathrm{e}}\ {\mathrm{f}}\ {\to}\ {(}{\mathrm{b}}\ {\mathrm{\underline{a}}}\ {\mathrm{c}}{)}\ {\mathrm{\underline{x}}}\ {\mathrm{e}}\ {\mathrm{\underline{d}}}\ {\mathrm{f}}\ {\}}lE‾h ← { x‾ a‾ b c d‾ e f → (b a‾ c) x‾ e d‾ f }{{}^{\mathrm{l}}\mathrm{\underline{E}h}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{a}}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\mathrm{\underline{d}}}\ {\mathrm{e}}\ {\mathrm{f}}\ {\to}\ {(}{\mathrm{b}}\ {\mathrm{\underline{a}}}\ {\mathrm{c}}{)}\ {\mathrm{\underline{x}}}\ {\mathrm{e}}\ {\mathrm{\underline{d}}}\ {\mathrm{f}}\ {\}}
27l:F_ := { x y z_ -> y z_ x } # Finch{{}^{\mathrm{l}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\mathrm{x}}\ {\}}lF‾ ← { x y z‾ → y z‾ x }{{}^{\mathrm{l}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\mathrm{x}}\ {\}}
28l:G_ := { x_ y_ z w -> w x_ y_ z } # Goldfinch{{}^{\mathrm{l}}\mathrm{\underline{G}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\}}lG‾ ← { x‾ y‾ z w → w x‾ y‾ z }{{}^{\mathrm{l}}\mathrm{\underline{G}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\}}
29l:H_ := { x_ y z -> (y x_ z)_ y } # Hummingbird{{}^{\mathrm{l}}\mathrm{\underline{H}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\to}\ {(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{y}}\ {\}}lH‾ ← { x‾ y z → (y x‾ z)_ y }{{}^{\mathrm{l}}\mathrm{\underline{H}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\to}\ {(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{y}}\ {\}}
30l:J_ := { x_ y z w -> y x_ w x_ z } # Jay{{}^{\mathrm{l}}\mathrm{\underline{J}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}\ {\}}lJ‾ ← { x‾ y z w → y x‾ w x‾ z }{{}^{\mathrm{l}}\mathrm{\underline{J}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}\ {\}}
31l:O_ := { x_ y_ -> y_ x_ 'y_ } # Owl{{}^{\mathrm{l}}\mathrm{\underline{O}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{y}}}\ {\}}lO‾ ← { x‾ y‾ → y‾ x‾ ’y‾ }{{}^{\mathrm{l}}\mathrm{\underline{O}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\to}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{y}}}\ {\}}
32l:Q_ := { x_ y_ z -> y_ x_ z } # Queer Bird{{}^{\mathrm{l}}\mathrm{\underline{Q}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\to}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}\ {\}}lQ‾ ← { x‾ y‾ z → y‾ x‾ z }{{}^{\mathrm{l}}\mathrm{\underline{Q}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\to}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}\ {\}}
33l:Q_1 := { x_ y z_ -> x_ z_ y } # Quixotic Bird{{}^{\mathrm{l}}\mathrm{\underline{Q}1}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{z}}}\ {\mathrm{y}}\ {\}}lQ‾1 ← { x‾ y z‾ → x‾ z‾ y }{{}^{\mathrm{l}}\mathrm{\underline{Q}1}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{z}}}\ {\mathrm{y}}\ {\}}
34l:Q_2 := { x y_ z_ -> y_ z_ x } # Quizzical Bird{{}^{\mathrm{l}}\mathrm{\underline{Q}2}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\mathrm{x}}\ {\}}lQ‾2 ← { x y‾ z‾ → y‾ z‾ x }{{}^{\mathrm{l}}\mathrm{\underline{Q}2}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\mathrm{x}}\ {\}}
35l:Q_3 := { x_ y z_ -> z_ x_ y } # Quirky Bird{{}^{\mathrm{l}}\mathrm{\underline{Q}3}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{\underline{z}}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\}}lQ‾3 ← { x‾ y z‾ → z‾ x‾ y }{{}^{\mathrm{l}}\mathrm{\underline{Q}3}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{\underline{z}}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\}}
36l:Q_4 := { x y_ z_ -> z_ y_ x } # Quacky Bird{{}^{\mathrm{l}}\mathrm{\underline{Q}4}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{\underline{z}}}\ {\mathrm{\underline{y}}}\ {\mathrm{x}}\ {\}}lQ‾4 ← { x y‾ z‾ → z‾ y‾ x }{{}^{\mathrm{l}}\mathrm{\underline{Q}4}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{\underline{z}}}\ {\mathrm{\underline{y}}}\ {\mathrm{x}}\ {\}}
37l:R_ := { x y_ z -> z y_ x } # Robin{{}^{\mathrm{l}}\mathrm{\underline{R}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\to}\ {\mathrm{z}}\ {\mathrm{\underline{y}}}\ {\mathrm{x}}\ {\}}lR‾ ← { x y‾ z → z y‾ x }{{}^{\mathrm{l}}\mathrm{\underline{R}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\to}\ {\mathrm{z}}\ {\mathrm{\underline{y}}}\ {\mathrm{x}}\ {\}}
38l:S_ := { x_ y_ z -> z x_ y_ z } # Starling{{}^{\mathrm{l}}\mathrm{\underline{S}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\to}\ {\mathrm{z}}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\}}lS‾ ← { x‾ y‾ z → z x‾ y‾ z }{{}^{\mathrm{l}}\mathrm{\underline{S}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\to}\ {\mathrm{z}}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\}}
39l:V_ := { x y z_ -> x z_ y } # Vireo: a pair{{}^{\mathrm{l}}\mathrm{\underline{V}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{z}}}\ {\mathrm{y}}\ {\}}lV‾ ← { x y z‾ → x z‾ y }{{}^{\mathrm{l}}\mathrm{\underline{V}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\mathrm{\underline{z}}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{z}}}\ {\mathrm{y}}\ {\}}
42l:C_s := { x_ y z w -> (y x_ w)_ z }{{}^{\mathrm{l}}\mathrm{\underline{C}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{)}{\_}\ {\mathrm{z}}\ {\}}lC‾s ← { x‾ y z w → (y x‾ w)_ z }{{}^{\mathrm{l}}\mathrm{\underline{C}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{)}{\_}\ {\mathrm{z}}\ {\}}
43l:R_s := { x_ y z w -> (z x_ w)_ y }{{}^{\mathrm{l}}\mathrm{\underline{R}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{z}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{)}{\_}\ {\mathrm{y}}\ {\}}lR‾s ← { x‾ y z w → (z x‾ w)_ y }{{}^{\mathrm{l}}\mathrm{\underline{R}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{z}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{)}{\_}\ {\mathrm{y}}\ {\}}
44l:F_s := { x_ y z w -> (w x_ z)_ y }{{}^{\mathrm{l}}\mathrm{\underline{F}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{y}}\ {\}}lF‾s ← { x‾ y z w → (w x‾ z)_ y }{{}^{\mathrm{l}}\mathrm{\underline{F}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{y}}\ {\}}
45l:V_s := { x_ y z w -> (w x_ y)_ z }{{}^{\mathrm{l}}\mathrm{\underline{V}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}{)}{\_}\ {\mathrm{z}}\ {\}}lV‾s ← { x‾ y z w → (w x‾ y)_ z }{{}^{\mathrm{l}}\mathrm{\underline{V}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}{)}{\_}\ {\mathrm{z}}\ {\}}
46l:W_s := { x_ y z -> (y x_ z)_ z }{{}^{\mathrm{l}}\mathrm{\underline{W}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\to}\ {(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{z}}\ {\}}lW‾s ← { x‾ y z → (y x‾ z)_ z }{{}^{\mathrm{l}}\mathrm{\underline{W}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\to}\ {(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{z}}\ {\}}
49l:C_ss := { x_ y z w v -> ((y x_ z)_ v)_ w }{{}^{\mathrm{l}}\mathrm{\underline{C}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{v}}{)}{\_}\ {\mathrm{w}}\ {\}}lC‾ss ← { x‾ y z w v → ((y x‾ z)_ v)_ w }{{}^{\mathrm{l}}\mathrm{\underline{C}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{v}}{)}{\_}\ {\mathrm{w}}\ {\}}
50l:R_ss := { x_ y z w v -> ((y x_ w)_ v)_ z }{{}^{\mathrm{l}}\mathrm{\underline{R}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{)}{\_}\ {\mathrm{v}}{)}{\_}\ {\mathrm{z}}\ {\}}lR‾ss ← { x‾ y z w v → ((y x‾ w)_ v)_ z }{{}^{\mathrm{l}}\mathrm{\underline{R}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{)}{\_}\ {\mathrm{v}}{)}{\_}\ {\mathrm{z}}\ {\}}
51l:F_ss := { x_ y z w v -> ((y x_ v)_ w)_ z }{{}^{\mathrm{l}}\mathrm{\underline{F}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}{)}{\_}\ {\mathrm{w}}{)}{\_}\ {\mathrm{z}}\ {\}}lF‾ss ← { x‾ y z w v → ((y x‾ v)_ w)_ z }{{}^{\mathrm{l}}\mathrm{\underline{F}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}{)}{\_}\ {\mathrm{w}}{)}{\_}\ {\mathrm{z}}\ {\}}
52l:V_ss := { x_ y z w v -> ((y x_ v)_ z)_ w }{{}^{\mathrm{l}}\mathrm{\underline{V}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}{)}{\_}\ {\mathrm{z}}{)}{\_}\ {\mathrm{w}}\ {\}}lV‾ss ← { x‾ y z w v → ((y x‾ v)_ z)_ w }{{}^{\mathrm{l}}\mathrm{\underline{V}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}{)}{\_}\ {\mathrm{z}}{)}{\_}\ {\mathrm{w}}\ {\}}
53l:W_ss := { x_ y z w -> ((y x_ z)_ w)_ w }{{}^{\mathrm{l}}\mathrm{\underline{W}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{w}}{)}{\_}\ {\mathrm{w}}\ {\}}lW‾ss ← { x‾ y z w → ((y x‾ z)_ w)_ w }{{}^{\mathrm{l}}\mathrm{\underline{W}ss}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{(}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{)}{\_}\ {\mathrm{w}}{)}{\_}\ {\mathrm{w}}\ {\}}
57l:Y_ := { f_ -> f_ l:Y_ 'f_ }{{}^{\mathrm{l}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\mathrm{\underline{f}}}\ {{}^{\mathrm{l}}\mathrm{\underline{Y}}}\ {\text{'}}{\mathrm{\underline{f}}}\ {\}}lY‾ ← { f‾ → f‾ lY‾ ’f‾ }{{}^{\mathrm{l}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\mathrm{\underline{f}}}\ {{}^{\mathrm{l}}\mathrm{\underline{Y}}}\ {\text{'}}{\mathrm{\underline{f}}}\ {\}}

lib/Geometry3D.xtl

10r_adians := { (f_loat _r) * (p_i @) / 180 } # private{\mathrm{\underline{r}adians}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{\underline{f}loat}}\ {\_\mathrm{r}}{)}\ {\times}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {180}\ {\}}r‾adians ← { (f‾loat _r) × (p‾i @) ÷ 180 }{\mathrm{\underline{r}adians}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{\underline{f}loat}}\ {\_\mathrm{r}}{)}\ {\times}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {180}\ {\}}
18l:r_otX := { d ->{{}^{\mathrm{l}}\mathrm{\underline{r}otX}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}lr‾otX ← { d →{{}^{\mathrm{l}}\mathrm{\underline{r}otX}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}
19 c := c_os r_adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}  c ← c‾os r‾adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}
20 s := s_in r_adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}  s ← s‾in r‾adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}
21 3 3 r_eshape 1.0 0.0 0.0 0.0 c_at c c_at (n_eg s) c_at 0.0 c_at s c_at c\ \ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1.0}\ {0.0}\ {0.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{c}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {\mathrm{c}}  3 3 r‾eshape 1.0 0.0 0.0 0.0 c‾at c c‾at (n‾eg s) c‾at 0.0 c‾at s c‾at c\ \ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1.0}\ {0.0}\ {0.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{c}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {\mathrm{c}}
22}{\}}}{\}}
30l:r_otY := { d ->{{}^{\mathrm{l}}\mathrm{\underline{r}otY}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}lr‾otY ← { d →{{}^{\mathrm{l}}\mathrm{\underline{r}otY}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}
31 c := c_os r_adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}  c ← c‾os r‾adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}
32 s := s_in r_adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}  s ← s‾in r‾adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}
33 3 3 r_eshape c c_at 0.0 c_at s c_at 0.0 1.0 0.0 c_at (n_eg s) c_at 0.0 c_at c\ \ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{c}}\ {\mathrm{\underline{c}at}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {0.0}\ {1.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{c}}  3 3 r‾eshape c c‾at 0.0 c‾at s c‾at 0.0 1.0 0.0 c‾at (n‾eg s) c‾at 0.0 c‾at c\ \ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{c}}\ {\mathrm{\underline{c}at}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {0.0}\ {1.0}\ {0.0}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{c}}
34}{\}}}{\}}
42l:r_otZ := { d ->{{}^{\mathrm{l}}\mathrm{\underline{r}otZ}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}lr‾otZ ← { d →{{}^{\mathrm{l}}\mathrm{\underline{r}otZ}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}
43 c := c_os r_adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}  c ← c‾os r‾adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}
44 s := s_in r_adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}  s ← s‾in r‾adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {\mathrm{\underline{r}adians}}\ {\mathrm{d}}
45 3 3 r_eshape c c_at (n_eg s) c_at 0.0 c_at s c_at c c_at 0.0 0.0 0.0 1.0\ \ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{c}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {\mathrm{c}}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {0.0}\ {1.0}  3 3 r‾eshape c c‾at (n‾eg s) c‾at 0.0 c‾at s c‾at c c‾at 0.0 0.0 0.0 1.0\ \ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{c}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {\mathrm{c}}\ {\mathrm{\underline{c}at}}\ {0.0}\ {0.0}\ {0.0}\ {1.0}
46}{\}}}{\}}
56l:t_urn := { m points -> m '+ '* i_nner points }{{}^{\mathrm{l}}\mathrm{\underline{t}urn}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{points}}\ {\to}\ {\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{points}}\ {\}}lt‾urn ← { m points → m ’+ ’× i‾nner points }{{}^{\mathrm{l}}\mathrm{\underline{t}urn}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{points}}\ {\to}\ {\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{points}}\ {\}}
65l:p_roject := { d points ->{{}^{\mathrm{l}}\mathrm{\underline{p}roject}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\mathrm{points}}\ {\to}lp‾roject ← { d points →{{}^{\mathrm{l}}\mathrm{\underline{p}roject}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\mathrm{points}}\ {\to}
66 scale := (f_loat d) / (f_loat d) - 3 s_elect points\ \ {\mathrm{scale}}\ {\leftarrow}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{d}}{)}\ {\div}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{d}}{)}\ {-}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{points}}  scale ← (f‾loat d) ÷ (f‾loat d) − 3 s‾elect points\ \ {\mathrm{scale}}\ {\leftarrow}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{d}}{)}\ {\div}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{d}}{)}\ {-}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{points}}
67 (2 t_ake points) * (2 c_at t_ally scale) r_eshape scale\ \ {(}{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{points}}{)}\ {\times}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{scale}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{scale}}  (2 t‾ake points) × (2 c‾at t‾ally scale) r‾eshape scale\ \ {(}{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{points}}{)}\ {\times}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{scale}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{scale}}
68}{\}}}{\}}
75l:f_ar := { faces -> (f_loat '+ r_/ o_\ 3 s_elect_2 faces) / f_loat 1 s_elect r_ev s_hape faces }{{}^{\mathrm{l}}\mathrm{\underline{f}ar}}\ {\leftarrow}\ {\{}\ {\mathrm{faces}}\ {\to}\ {(}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{o}}{\backslash}}\ {3}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{faces}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{faces}}\ {\}}lf‾ar ← { faces → (f‾loat ’+ r‾/ o‾\ 3 s‾elect2 faces) ÷ f‾loat 1 s‾elect r‾ev s‾hape faces }{{}^{\mathrm{l}}\mathrm{\underline{f}ar}}\ {\leftarrow}\ {\{}\ {\mathrm{faces}}\ {\to}\ {(}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{o}}{\backslash}}\ {3}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{faces}}{)}\ {\div}\ {\mathrm{\underline{f}loat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{faces}}\ {\}}
82l:o_rder := { faces -> g_rade l:f_ar faces }{{}^{\mathrm{l}}\mathrm{\underline{o}rder}}\ {\leftarrow}\ {\{}\ {\mathrm{faces}}\ {\to}\ {\mathrm{\underline{g}rade}}\ {{}^{\mathrm{l}}\mathrm{\underline{f}ar}}\ {\mathrm{faces}}\ {\}}lo‾rder ← { faces → g‾rade lf‾ar faces }{{}^{\mathrm{l}}\mathrm{\underline{o}rder}}\ {\leftarrow}\ {\{}\ {\mathrm{faces}}\ {\to}\ {\mathrm{\underline{g}rade}}\ {{}^{\mathrm{l}}\mathrm{\underline{f}ar}}\ {\mathrm{faces}}\ {\}}
90l:c_ube := { s ->{{}^{\mathrm{l}}\mathrm{\underline{c}ube}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}lc‾ube ← { s →{{}^{\mathrm{l}}\mathrm{\underline{c}ube}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
91 h := (f_loat s) / 2\ \ {\mathrm{h}}\ {\leftarrow}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{s}}{)}\ {\div}\ {2}  h ← (f‾loat s) ÷ 2\ \ {\mathrm{h}}\ {\leftarrow}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{s}}{)}\ {\div}\ {2}
92 h * 3 8 r_eshape -1 1 1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 -1 1 1 1 1 -1 -1 -1 -1\ \ {\mathrm{h}}\ {\times}\ {3}\ {8}\ {\mathrm{\underline{r}eshape}}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {1}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {1}\ {1}\ {1}\ {-1}\ {-1}\ {-1}\ {-1}  h × 3 8 r‾eshape −1 1 1 −1 −1 1 1 −1 1 1 −1 −1 1 1 −1 −1 1 1 1 1 −1 −1 −1 −1\ \ {\mathrm{h}}\ {\times}\ {3}\ {8}\ {\mathrm{\underline{r}eshape}}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {1}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {1}\ {1}\ {1}\ {-1}\ {-1}\ {-1}\ {-1}
93}{\}}}{\}}
100l:c_ubeFaces := { @ -> 6 4 r_eshape 1 2 3 4 5 6 7 8 1 2 6 5 4 3 7 8 1 4 8 5 2 3 7 6 }{{}^{\mathrm{l}}\mathrm{\underline{c}ubeFaces}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {6}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}\ {7}\ {8}\ {1}\ {2}\ {6}\ {5}\ {4}\ {3}\ {7}\ {8}\ {1}\ {4}\ {8}\ {5}\ {2}\ {3}\ {7}\ {6}\ {\}}lc‾ubeFaces ← { @ → 6 4 r‾eshape 1 2 3 4 5 6 7 8 1 2 6 5 4 3 7 8 1 4 8 5 2 3 7 6 }{{}^{\mathrm{l}}\mathrm{\underline{c}ubeFaces}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {6}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}\ {7}\ {8}\ {1}\ {2}\ {6}\ {5}\ {4}\ {3}\ {7}\ {8}\ {1}\ {4}\ {8}\ {5}\ {2}\ {3}\ {7}\ {6}\ {\}}
109l:f_ace := { positions points -> positions s_elect_2 points }{{}^{\mathrm{l}}\mathrm{\underline{f}ace}}\ {\leftarrow}\ {\{}\ {\mathrm{positions}}\ {\mathrm{points}}\ {\to}\ {\mathrm{positions}}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{points}}\ {\}}lf‾ace ← { positions points → positions s‾elect2 points }{{}^{\mathrm{l}}\mathrm{\underline{f}ace}}\ {\leftarrow}\ {\{}\ {\mathrm{positions}}\ {\mathrm{points}}\ {\to}\ {\mathrm{positions}}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{points}}\ {\}}
116l:s_olid := { faces points -> 2 1 3 t_ranspose (3 c_at s_hape faces) r_eshape (r_avel faces) s_elect_2 points }{{}^{\mathrm{l}}\mathrm{\underline{s}olid}}\ {\leftarrow}\ {\{}\ {\mathrm{faces}}\ {\mathrm{points}}\ {\to}\ {2}\ {1}\ {3}\ {\mathrm{\underline{t}ranspose}}\ {(}{3}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{faces}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{\mathrm{\underline{r}avel}}\ {\mathrm{faces}}{)}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{points}}\ {\}}ls‾olid ← { faces points → 2 1 3 t‾ranspose (3 c‾at s‾hape faces) r‾eshape (r‾avel faces) s‾elect2 points }{{}^{\mathrm{l}}\mathrm{\underline{s}olid}}\ {\leftarrow}\ {\{}\ {\mathrm{faces}}\ {\mathrm{points}}\ {\to}\ {2}\ {1}\ {3}\ {\mathrm{\underline{t}ranspose}}\ {(}{3}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{faces}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{\mathrm{\underline{r}avel}}\ {\mathrm{faces}}{)}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{points}}\ {\}}

lib/Maybe.xtl

18l:n_othing := { n j -> n }{{}^{\mathrm{l}}\mathrm{\underline{n}othing}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{j}}\ {\to}\ {\mathrm{n}}\ {\}}ln‾othing ← { n j → n }{{}^{\mathrm{l}}\mathrm{\underline{n}othing}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{j}}\ {\to}\ {\mathrm{n}}\ {\}}
24l:j_ust := { x n j_ -> j_ x }{{}^{\mathrm{l}}\mathrm{\underline{j}ust}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{n}}\ {\mathrm{\underline{j}}}\ {\to}\ {\mathrm{\underline{j}}}\ {\mathrm{x}}\ {\}}lj‾ust ← { x n j‾ → j‾ x }{{}^{\mathrm{l}}\mathrm{\underline{j}ust}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{n}}\ {\mathrm{\underline{j}}}\ {\to}\ {\mathrm{\underline{j}}}\ {\mathrm{x}}\ {\}}
29l:m_aybe := { f_ d m_ -> d m_ 'f_ }{{}^{\mathrm{l}}\mathrm{\underline{m}aybe}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\to}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\mathrm{\underline{f}}}\ {\}}lm‾aybe ← { f‾ d m‾ → d m‾ ’f‾ }{{}^{\mathrm{l}}\mathrm{\underline{m}aybe}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\to}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\mathrm{\underline{f}}}\ {\}}
32l:o_r := { d m_ -> d m_ '{ x -> x } }{{}^{\mathrm{l}}\mathrm{\underline{o}r}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\to}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}\ {\}}lo‾r ← { d m‾ → d m‾ ’{ x → x } }{{}^{\mathrm{l}}\mathrm{\underline{o}r}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\to}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}\ {\}}
35l:m_ap := { f_ m_ -> 'l:n_othing m_ '{ x -> l:j_ust f_ x } }{{}^{\mathrm{l}}\mathrm{\underline{m}ap}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{m}}}\ {\to}\ {\text{'}}{{}^{\mathrm{l}}\mathrm{\underline{n}othing}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {{}^{\mathrm{l}}\mathrm{\underline{j}ust}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}\ {\}}lm‾ap ← { f‾ m‾ → ’ln‾othing m‾ ’{ x → lj‾ust f‾ x } }{{}^{\mathrm{l}}\mathrm{\underline{m}ap}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{m}}}\ {\to}\ {\text{'}}{{}^{\mathrm{l}}\mathrm{\underline{n}othing}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {{}^{\mathrm{l}}\mathrm{\underline{j}ust}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}\ {\}}
39l:b_ind := { f_ m_ -> 'l:n_othing m_ 'f_ }{{}^{\mathrm{l}}\mathrm{\underline{b}ind}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{m}}}\ {\to}\ {\text{'}}{{}^{\mathrm{l}}\mathrm{\underline{n}othing}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\mathrm{\underline{f}}}\ {\}}lb‾ind ← { f‾ m‾ → ’ln‾othing m‾ ’f‾ }{{}^{\mathrm{l}}\mathrm{\underline{b}ind}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{m}}}\ {\to}\ {\text{'}}{{}^{\mathrm{l}}\mathrm{\underline{n}othing}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\mathrm{\underline{f}}}\ {\}}

lib/Stats.xtl

12l:m_ean := [[f_loat '+ r_/] / [f_loat t_ally]]{{}^{\mathrm{l}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{[}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}{]}\ {\div}\ {[}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{t}ally}}{]}{]}lm‾ean ← [[f‾loat ’+ r‾/] ÷ [f‾loat t‾ally]]{{}^{\mathrm{l}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{[}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}{]}\ {\div}\ {[}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{t}ally}}{]}{]}
14s_quare := { _r * _r } # private: not visible outside{\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}s‾quare ← { _r × _r }{\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
15d_eviations := [f_loat - l:m_ean]{\mathrm{\underline{d}eviations}}\ {\leftarrow}\ {[}{\mathrm{\underline{f}loat}}\ {-}\ {{}^{\mathrm{l}}\mathrm{\underline{m}ean}}{]}d‾eviations ← [f‾loat − lm‾ean]{\mathrm{\underline{d}eviations}}\ {\leftarrow}\ {[}{\mathrm{\underline{f}loat}}\ {-}\ {{}^{\mathrm{l}}\mathrm{\underline{m}ean}}{]}
21l:v_ariance := [l:m_ean [s_quare d_eviations]]{{}^{\mathrm{l}}\mathrm{\underline{v}ariance}}\ {\leftarrow}\ {[}{{}^{\mathrm{l}}\mathrm{\underline{m}ean}}\ {[}{\mathrm{\underline{s}quare}}\ {\mathrm{\underline{d}eviations}}{]}{]}lv‾ariance ← [lm‾ean [s‾quare d‾eviations]]{{}^{\mathrm{l}}\mathrm{\underline{v}ariance}}\ {\leftarrow}\ {[}{{}^{\mathrm{l}}\mathrm{\underline{m}ean}}\ {[}{\mathrm{\underline{s}quare}}\ {\mathrm{\underline{d}eviations}}{]}{]}
27l:s_d := { (l:v_ariance _r) ^ 0.5 }{{}^{\mathrm{l}}\mathrm{\underline{s}d}}\ {\leftarrow}\ {\{}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{v}ariance}}\ {\_\mathrm{r}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}ls‾d ← { (lv‾ariance _r) ^ 0.5 }{{}^{\mathrm{l}}\mathrm{\underline{s}d}}\ {\leftarrow}\ {\{}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{v}ariance}}\ {\_\mathrm{r}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}
33l:r_ange := ['m_ax r_/ - 'm_in r_/]{{}^{\mathrm{l}}\mathrm{\underline{r}ange}}\ {\leftarrow}\ {[}{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {-}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}lr‾ange ← [’m‾ax r‾/ − ’m‾in r‾/]{{}^{\mathrm{l}}\mathrm{\underline{r}ange}}\ {\leftarrow}\ {[}{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {-}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}

lib/Svg.xtl

16l:a_ttr := { name value -> " " c_at name c_at "=\"" c_at (l:e_scape value) c_at "\"" }{{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\leftarrow}\ {\{}\ {\mathrm{name}}\ {\mathrm{value}}\ {\to}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{name}}\ {\mathrm{\underline{c}at}}\ {\text{"=\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{e}scape}}\ {\mathrm{value}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\}}la‾ttr ← { name value → " " c‾at name c‾at "=\"" c‾at (le‾scape value) c‾at "\"" }{{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\leftarrow}\ {\{}\ {\mathrm{name}}\ {\mathrm{value}}\ {\to}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{name}}\ {\mathrm{\underline{c}at}}\ {\text{"=\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{e}scape}}\ {\mathrm{value}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\}}
29l:e_scape := { t ->{{}^{\mathrm{l}}\mathrm{\underline{e}scape}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\to}le‾scape ← { t →{{}^{\mathrm{l}}\mathrm{\underline{e}scape}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\to}
30 0 = '+ r_/ t m_ember? "&<>\"" ? t\ \ {0}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{t}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"\&<>\textbackslash{}""}}\ {?}\ {\mathrm{t}}  0 = ’+ r‾/ t m‾ember? "&<>\"" ? t\ \ {0}\ {=}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{t}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"\&<>\textbackslash{}""}}\ {?}\ {\mathrm{t}}
31 j_oin 'e_sc m_ap t\ \ {\mathrm{\underline{j}oin}}\ {\text{'}}{\mathrm{\underline{e}sc}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{t}}  j‾oin ’e‾sc m‾ap t\ \ {\mathrm{\underline{j}oin}}\ {\text{'}}{\mathrm{\underline{e}sc}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{t}}
32}{\}}}{\}}
38l:f_ill := { color -> "fill" l:a_ttr color }{{}^{\mathrm{l}}\mathrm{\underline{f}ill}}\ {\leftarrow}\ {\{}\ {\mathrm{color}}\ {\to}\ {\text{"fill"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{color}}\ {\}}lf‾ill ← { color → "fill" la‾ttr color }{{}^{\mathrm{l}}\mathrm{\underline{f}ill}}\ {\leftarrow}\ {\{}\ {\mathrm{color}}\ {\to}\ {\text{"fill"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{color}}\ {\}}
45l:r_gb := { c ->{{}^{\mathrm{l}}\mathrm{\underline{r}gb}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}lr‾gb ← { c →{{}^{\mathrm{l}}\mathrm{\underline{r}gb}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}
46 k := 0 m_ax 255 m_in f_loor 0.5 + f_loat c\ \ {\mathrm{k}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{m}ax}}\ {255}\ {\mathrm{\underline{m}in}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {\mathrm{\underline{f}loat}}\ {\mathrm{c}}  k ← 0 m‾ax 255 m‾in f‾loor 0.5 + f‾loat c\ \ {\mathrm{k}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{m}ax}}\ {255}\ {\mathrm{\underline{m}in}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {\mathrm{\underline{f}loat}}\ {\mathrm{c}}
47 "rgb(" c_at (f_ormat 1 s_elect k) c_at "," c_at (f_ormat 2 s_elect k) c_at "," c_at (f_ormat 3 s_elect k) c_at ")"\ \ {\text{"rgb("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\text{","}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\text{","}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}  "rgb(" c‾at (f‾ormat 1 s‾elect k) c‾at "," c‾at (f‾ormat 2 s‾elect k) c‾at "," c‾at (f‾ormat 3 s‾elect k) c‾at ")"\ \ {\text{"rgb("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\text{","}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\text{","}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}
48}{\}}}{\}}
54l:s_troke := { color width -> ("stroke" l:a_ttr color) c_at ("stroke-width" l:a_ttr f_ormat width) c_at " stroke-linejoin=\"round\"" }{{}^{\mathrm{l}}\mathrm{\underline{s}troke}}\ {\leftarrow}\ {\{}\ {\mathrm{color}}\ {\mathrm{width}}\ {\to}\ {(}{\text{"stroke"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{color}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"stroke-width"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{\underline{f}ormat}}\ {\mathrm{width}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" stroke-linejoin=\textbackslash{}"round\textbackslash{}""}}\ {\}}ls‾troke ← { color width → ("stroke" la‾ttr color) c‾at ("stroke-width" la‾ttr f‾ormat width) c‾at " stroke-linejoin=\"round\"" }{{}^{\mathrm{l}}\mathrm{\underline{s}troke}}\ {\leftarrow}\ {\{}\ {\mathrm{color}}\ {\mathrm{width}}\ {\to}\ {(}{\text{"stroke"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{color}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"stroke-width"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{\underline{f}ormat}}\ {\mathrm{width}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" stroke-linejoin=\textbackslash{}"round\textbackslash{}""}}\ {\}}
61l:p_olygon := { attrs points -> "<polygon points=\"" c_at (p_airs points) c_at "\"" c_at attrs c_at "/>" }{{}^{\mathrm{l}}\mathrm{\underline{p}olygon}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{points}}\ {\to}\ {\text{"<polygon points=\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{p}airs}}\ {\mathrm{points}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{"/>"}}\ {\}}lp‾olygon ← { attrs points → "<polygon points=\"" c‾at (p‾airs points) c‾at "\"" c‾at attrs c‾at "/>" }{{}^{\mathrm{l}}\mathrm{\underline{p}olygon}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{points}}\ {\to}\ {\text{"<polygon points=\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{p}airs}}\ {\mathrm{points}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{"/>"}}\ {\}}
67l:p_olyline := { attrs points -> "<polyline points=\"" c_at (p_airs points) c_at "\"" c_at attrs c_at "/>" }{{}^{\mathrm{l}}\mathrm{\underline{p}olyline}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{points}}\ {\to}\ {\text{"<polyline points=\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{p}airs}}\ {\mathrm{points}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{"/>"}}\ {\}}lp‾olyline ← { attrs points → "<polyline points=\"" c‾at (p‾airs points) c‾at "\"" c‾at attrs c‾at "/>" }{{}^{\mathrm{l}}\mathrm{\underline{p}olyline}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{points}}\ {\to}\ {\text{"<polyline points=\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{p}airs}}\ {\mathrm{points}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{"/>"}}\ {\}}
73l:a_t := { xy -> ("x" l:a_ttr f_ormat 1 s_elect xy) c_at "y" l:a_ttr f_ormat 2 s_elect xy }{{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\to}\ {(}{\text{"x"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{\underline{f}ormat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"y"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{\underline{f}ormat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}\ {\}}la‾t ← { xy → ("x" la‾ttr f‾ormat 1 s‾elect xy) c‾at "y" la‾ttr f‾ormat 2 s‾elect xy }{{}^{\mathrm{l}}\mathrm{\underline{a}t}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\to}\ {(}{\text{"x"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{\underline{f}ormat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"y"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{\underline{f}ormat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}\ {\}}
80l:t_ext := { attrs t -> "<text" c_at attrs c_at ">" c_at (l:e_scape t) c_at "</text>" }{{}^{\mathrm{l}}\mathrm{\underline{t}ext}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{t}}\ {\to}\ {\text{"<text"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{e}scape}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"</text>"}}\ {\}}lt‾ext ← { attrs t → "<text" c‾at attrs c‾at ">" c‾at (le‾scape t) c‾at "</text>" }{{}^{\mathrm{l}}\mathrm{\underline{t}ext}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{t}}\ {\to}\ {\text{"<text"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{e}scape}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"</text>"}}\ {\}}
87l:s_pan := { color t -> "<tspan" c_at (l:f_ill color) c_at ">" c_at (l:e_scape t) c_at "</tspan>" }{{}^{\mathrm{l}}\mathrm{\underline{s}pan}}\ {\leftarrow}\ {\{}\ {\mathrm{color}}\ {\mathrm{t}}\ {\to}\ {\text{"<tspan"}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{f}ill}}\ {\mathrm{color}}{)}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{e}scape}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"</tspan>"}}\ {\}}ls‾pan ← { color t → "<tspan" c‾at (lf‾ill color) c‾at ">" c‾at (le‾scape t) c‾at "</tspan>" }{{}^{\mathrm{l}}\mathrm{\underline{s}pan}}\ {\leftarrow}\ {\{}\ {\mathrm{color}}\ {\mathrm{t}}\ {\to}\ {\text{"<tspan"}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{f}ill}}\ {\mathrm{color}}{)}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{l}}\mathrm{\underline{e}scape}}\ {\mathrm{t}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"</tspan>"}}\ {\}}
94l:s_ized := { size inner -> "<tspan" c_at ("font-size" l:a_ttr f_ormat size) c_at ">" c_at inner c_at "</tspan>" }{{}^{\mathrm{l}}\mathrm{\underline{s}ized}}\ {\leftarrow}\ {\{}\ {\mathrm{size}}\ {\mathrm{inner}}\ {\to}\ {\text{"<tspan"}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"font-size"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{\underline{f}ormat}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{inner}}\ {\mathrm{\underline{c}at}}\ {\text{"</tspan>"}}\ {\}}ls‾ized ← { size inner → "<tspan" c‾at ("font-size" la‾ttr f‾ormat size) c‾at ">" c‾at inner c‾at "</tspan>" }{{}^{\mathrm{l}}\mathrm{\underline{s}ized}}\ {\leftarrow}\ {\{}\ {\mathrm{size}}\ {\mathrm{inner}}\ {\to}\ {\text{"<tspan"}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"font-size"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{\underline{f}ormat}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{inner}}\ {\mathrm{\underline{c}at}}\ {\text{"</tspan>"}}\ {\}}
101l:m_arkup := { attrs inner -> "<text" c_at attrs c_at ">" c_at inner c_at "</text>" }{{}^{\mathrm{l}}\mathrm{\underline{m}arkup}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{inner}}\ {\to}\ {\text{"<text"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{inner}}\ {\mathrm{\underline{c}at}}\ {\text{"</text>"}}\ {\}}lm‾arkup ← { attrs inner → "<text" c‾at attrs c‾at ">" c‾at inner c‾at "</text>" }{{}^{\mathrm{l}}\mathrm{\underline{m}arkup}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{inner}}\ {\to}\ {\text{"<text"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{inner}}\ {\mathrm{\underline{c}at}}\ {\text{"</text>"}}\ {\}}
108l:g_roup := { attrs elements -> "<g" c_at attrs c_at ">" c_at elements c_at "</g>" }{{}^{\mathrm{l}}\mathrm{\underline{g}roup}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{elements}}\ {\to}\ {\text{"<g"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{elements}}\ {\mathrm{\underline{c}at}}\ {\text{"</g>"}}\ {\}}lg‾roup ← { attrs elements → "<g" c‾at attrs c‾at ">" c‾at elements c‾at "</g>" }{{}^{\mathrm{l}}\mathrm{\underline{g}roup}}\ {\leftarrow}\ {\{}\ {\mathrm{attrs}}\ {\mathrm{elements}}\ {\to}\ {\text{"<g"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{elements}}\ {\mathrm{\underline{c}at}}\ {\text{"</g>"}}\ {\}}
114l:t_ranslate := { d -> "transform" l:a_ttr "translate(" c_at (f_ormat 1 s_elect d) c_at " " c_at (f_ormat 2 s_elect d) c_at ")" }{{}^{\mathrm{l}}\mathrm{\underline{t}ranslate}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}\ {\text{"transform"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"translate("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{d}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{d}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}\ {\}}lt‾ranslate ← { d → "transform" la‾ttr "translate(" c‾at (f‾ormat 1 s‾elect d) c‾at " " c‾at (f‾ormat 2 s‾elect d) c‾at ")" }{{}^{\mathrm{l}}\mathrm{\underline{t}ranslate}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}\ {\text{"transform"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"translate("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{d}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{d}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}\ {\}}
121l:r_otate := { d -> "transform" l:a_ttr "rotate(" c_at (f_ormat d) c_at ")" }{{}^{\mathrm{l}}\mathrm{\underline{r}otate}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}\ {\text{"transform"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"rotate("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{d}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}\ {\}}lr‾otate ← { d → "transform" la‾ttr "rotate(" c‾at (f‾ormat d) c‾at ")" }{{}^{\mathrm{l}}\mathrm{\underline{r}otate}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}\ {\text{"transform"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"rotate("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{d}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}\ {\}}
131l:m_atrix := { c ->{{}^{\mathrm{l}}\mathrm{\underline{m}atrix}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}lm‾atrix ← { c →{{}^{\mathrm{l}}\mathrm{\underline{m}atrix}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}
132 tl := 1 s_elect_2 c\ \ {\mathrm{tl}}\ {\leftarrow}\ {1}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}  tl ← 1 s‾elect2 c\ \ {\mathrm{tl}}\ {\leftarrow}\ {1}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}
133 tr := (2 s_elect_2 c) - tl\ \ {\mathrm{tr}}\ {\leftarrow}\ {(}{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{tl}}  tr ← (2 s‾elect2 c) − tl\ \ {\mathrm{tr}}\ {\leftarrow}\ {(}{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{tl}}
134 bl := (3 s_elect_2 c) - tl\ \ {\mathrm{bl}}\ {\leftarrow}\ {(}{3}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{tl}}  bl ← (3 s‾elect2 c) − tl\ \ {\mathrm{bl}}\ {\leftarrow}\ {(}{3}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{c}}{)}\ {-}\ {\mathrm{tl}}
135 "transform" l:a_ttr "matrix(" c_at (f_ormat tr) c_at " " c_at (f_ormat bl) c_at " " c_at (f_ormat tl) c_at ")"\ \ {\text{"transform"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"matrix("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{tr}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{bl}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{tl}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}  "transform" la‾ttr "matrix(" c‾at (f‾ormat tr) c‾at " " c‾at (f‾ormat bl) c‾at " " c‾at (f‾ormat tl) c‾at ")"\ \ {\text{"transform"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"matrix("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{tr}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{bl}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{tl}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}
136}{\}}}{\}}
142l:s_cale := { k -> "transform" l:a_ttr "scale(" c_at (f_ormat k) c_at ")" }{{}^{\mathrm{l}}\mathrm{\underline{s}cale}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\text{"transform"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"scale("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}\ {\}}ls‾cale ← { k → "transform" la‾ttr "scale(" c‾at (f‾ormat k) c‾at ")" }{{}^{\mathrm{l}}\mathrm{\underline{s}cale}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\text{"transform"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"scale("}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{f}ormat}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\text{")"}}\ {\}}
150l:c_lip := { id points -> "<clipPath" c_at ("id" l:a_ttr id) c_at ">" c_at ("" l:p_olygon points) c_at "</clipPath>" }{{}^{\mathrm{l}}\mathrm{\underline{c}lip}}\ {\leftarrow}\ {\{}\ {\mathrm{id}}\ {\mathrm{points}}\ {\to}\ {\text{"<clipPath"}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"id"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{id}}{)}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {(}{\text{""}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}olygon}}\ {\mathrm{points}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"</clipPath>"}}\ {\}}lc‾lip ← { id points → "<clipPath" c‾at ("id" la‾ttr id) c‾at ">" c‾at ("" lp‾olygon points) c‾at "</clipPath>" }{{}^{\mathrm{l}}\mathrm{\underline{c}lip}}\ {\leftarrow}\ {\{}\ {\mathrm{id}}\ {\mathrm{points}}\ {\to}\ {\text{"<clipPath"}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"id"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{id}}{)}\ {\mathrm{\underline{c}at}}\ {\text{">"}}\ {\mathrm{\underline{c}at}}\ {(}{\text{""}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}olygon}}\ {\mathrm{points}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"</clipPath>"}}\ {\}}
156l:c_lipped := { id elements -> ("clip-path" l:a_ttr "url(#" c_at id c_at ")") l:g_roup elements }{{}^{\mathrm{l}}\mathrm{\underline{c}lipped}}\ {\leftarrow}\ {\{}\ {\mathrm{id}}\ {\mathrm{elements}}\ {\to}\ {(}{\text{"clip-path"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"url(\#"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{id}}\ {\mathrm{\underline{c}at}}\ {\text{")"}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{g}roup}}\ {\mathrm{elements}}\ {\}}lc‾lipped ← { id elements → ("clip-path" la‾ttr "url(#" c‾at id c‾at ")") lg‾roup elements }{{}^{\mathrm{l}}\mathrm{\underline{c}lipped}}\ {\leftarrow}\ {\{}\ {\mathrm{id}}\ {\mathrm{elements}}\ {\to}\ {(}{\text{"clip-path"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\text{"url(\#"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{id}}\ {\mathrm{\underline{c}at}}\ {\text{")"}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{g}roup}}\ {\mathrm{elements}}\ {\}}
163l:g_radient := { id colors ->{{}^{\mathrm{l}}\mathrm{\underline{g}radient}}\ {\leftarrow}\ {\{}\ {\mathrm{id}}\ {\mathrm{colors}}\ {\to}lg‾radient ← { id colors →{{}^{\mathrm{l}}\mathrm{\underline{g}radient}}\ {\leftarrow}\ {\{}\ {\mathrm{id}}\ {\mathrm{colors}}\ {\to}
164 top := d_isclose 1 s_elect colors\ \ {\mathrm{top}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{colors}}  top ← d‾isclose 1 s‾elect colors\ \ {\mathrm{top}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{colors}}
165 bottom := d_isclose 2 s_elect colors\ \ {\mathrm{bottom}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{colors}}  bottom ← d‾isclose 2 s‾elect colors\ \ {\mathrm{bottom}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{colors}}
166 "<linearGradient" c_at ("id" l:a_ttr id) c_at " x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\"" c_at ("stop-color" l:a_ttr top) c_at "/><stop offset=\"1\"" c_at ("stop-color" l:a_ttr bottom) c_at "/></linearGradient>"\ \ {\text{"<linearGradient"}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"id"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{id}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" x1=\textbackslash{}"0\textbackslash{}" y1=\textbackslash{}"0\textbackslash{}" x2=\textbackslash{}"0\textbackslash{}" y2=\textbackslash{}"1\textbackslash{}"><stop offset=\textbackslash{}"0\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"stop-color"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{top}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"/><stop offset=\textbackslash{}"1\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"stop-color"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{bottom}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"/></linearGradient>"}}  "<linearGradient" c‾at ("id" la‾ttr id) c‾at " x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\"" c‾at ("stop-color" la‾ttr top) c‾at "/><stop offset=\"1\"" c‾at ("stop-color" la‾ttr bottom) c‾at "/></linearGradient>"\ \ {\text{"<linearGradient"}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"id"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{id}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" x1=\textbackslash{}"0\textbackslash{}" y1=\textbackslash{}"0\textbackslash{}" x2=\textbackslash{}"0\textbackslash{}" y2=\textbackslash{}"1\textbackslash{}"><stop offset=\textbackslash{}"0\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"stop-color"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{top}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"/><stop offset=\textbackslash{}"1\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"stop-color"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{bottom}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"/></linearGradient>"}}
167}{\}}}{\}}
175l:p_icture := { wh elements ->{{}^{\mathrm{l}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{wh}}\ {\mathrm{elements}}\ {\to}lp‾icture ← { wh elements →{{}^{\mathrm{l}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{wh}}\ {\mathrm{elements}}\ {\to}
176 w := f_ormat 1 s_elect wh\ \ {\mathrm{w}}\ {\leftarrow}\ {\mathrm{\underline{f}ormat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{wh}}  w ← f‾ormat 1 s‾elect wh\ \ {\mathrm{w}}\ {\leftarrow}\ {\mathrm{\underline{f}ormat}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{wh}}
177 h := f_ormat 2 s_elect wh\ \ {\mathrm{h}}\ {\leftarrow}\ {\mathrm{\underline{f}ormat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{wh}}  h ← f‾ormat 2 s‾elect wh\ \ {\mathrm{h}}\ {\leftarrow}\ {\mathrm{\underline{f}ormat}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{wh}}
178 "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 " c_at w c_at " " c_at h c_at "\"" c_at ("width" l:a_ttr w) c_at ("height" l:a_ttr h) c_at " role=\"img\">" c_at elements c_at "</svg>"\ \ {\text{"<svg xmlns=\textbackslash{}"http://www.w3.org/2000/svg\textbackslash{}" viewBox=\textbackslash{}"0 0 "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{w}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{h}}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"width"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"height"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{h}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" role=\textbackslash{}"img\textbackslash{}">"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{elements}}\ {\mathrm{\underline{c}at}}\ {\text{"</svg>"}}  "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 " c‾at w c‾at " " c‾at h c‾at "\"" c‾at ("width" la‾ttr w) c‾at ("height" la‾ttr h) c‾at " role=\"img\">" c‾at elements c‾at "</svg>"\ \ {\text{"<svg xmlns=\textbackslash{}"http://www.w3.org/2000/svg\textbackslash{}" viewBox=\textbackslash{}"0 0 "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{w}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{h}}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {(}{\text{"width"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\text{"height"}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ttr}}\ {\mathrm{h}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" role=\textbackslash{}"img\textbackslash{}">"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{elements}}\ {\mathrm{\underline{c}at}}\ {\text{"</svg>"}}
179}{\}}}{\}}
187l:p_ictureWith := { wh parts -> wh l:p_icture "<defs>" c_at (d_isclose 1 s_elect parts) c_at "</defs>" c_at d_isclose 2 s_elect parts }{{}^{\mathrm{l}}\mathrm{\underline{p}ictureWith}}\ {\leftarrow}\ {\{}\ {\mathrm{wh}}\ {\mathrm{parts}}\ {\to}\ {\mathrm{wh}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}icture}}\ {\text{"<defs>"}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{parts}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"</defs>"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{parts}}\ {\}}lp‾ictureWith ← { wh parts → wh lp‾icture "<defs>" c‾at (d‾isclose 1 s‾elect parts) c‾at "</defs>" c‾at d‾isclose 2 s‾elect parts }{{}^{\mathrm{l}}\mathrm{\underline{p}ictureWith}}\ {\leftarrow}\ {\{}\ {\mathrm{wh}}\ {\mathrm{parts}}\ {\to}\ {\mathrm{wh}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}icture}}\ {\text{"<defs>"}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{parts}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"</defs>"}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{parts}}\ {\}}
192e_sc := { c -> c = f_irst "&" ? "&amp;"; c = f_irst "<" ? "&lt;"; c = f_irst ">" ? "&gt;"; c = f_irst "\"" ? "&quot;"; c }{\mathrm{\underline{e}sc}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"\&"}}\ {?}\ {\text{"\&amp;"}}{\diamond}\ {\mathrm{c}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"<"}}\ {?}\ {\text{"\&lt;"}}{\diamond}\ {\mathrm{c}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{">"}}\ {?}\ {\text{"\&gt;"}}{\diamond}\ {\mathrm{c}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"\textbackslash{}""}}\ {?}\ {\text{"\&quot;"}}{\diamond}\ {\mathrm{c}}\ {\}}e‾sc ← { c → c = f‾irst "&" ? "&amp;"⋄ c = f‾irst "<" ? "&lt;"⋄ c = f‾irst ">" ? "&gt;"⋄ c = f‾irst "\"" ? "&quot;"⋄ c }{\mathrm{\underline{e}sc}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"\&"}}\ {?}\ {\text{"\&amp;"}}{\diamond}\ {\mathrm{c}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"<"}}\ {?}\ {\text{"\&lt;"}}{\diamond}\ {\mathrm{c}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{">"}}\ {?}\ {\text{"\&gt;"}}{\diamond}\ {\mathrm{c}}\ {=}\ {\mathrm{\underline{f}irst}}\ {\text{"\textbackslash{}""}}\ {?}\ {\text{"\&quot;"}}{\diamond}\ {\mathrm{c}}\ {\}}
195j_oin := { b ->{\mathrm{\underline{j}oin}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}j‾oin ← { b →{\mathrm{\underline{j}oin}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}
196 0 = t_ally b ? ""\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{b}}\ {?}\ {\text{""}}  0 = t‾ally b ? ""\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{b}}\ {?}\ {\text{""}}
197 d_isclose '{ x y -> e_nclose (d_isclose x) c_at d_isclose y } r_/ b\ \ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}  d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at d‾isclose y } r‾/ b\ \ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}
198}{\}}}{\}}
201p_airs := { points ->{\mathrm{\underline{p}airs}}\ {\leftarrow}\ {\{}\ {\mathrm{points}}\ {\to}p‾airs ← { points →{\mathrm{\underline{p}airs}}\ {\leftarrow}\ {\{}\ {\mathrm{points}}\ {\to}
202 xs := 'f_ormat m_ap 1 s_elect points\ \ {\mathrm{xs}}\ {\leftarrow}\ {\text{'}}{\mathrm{\underline{f}ormat}}\ {\mathrm{\underline{m}ap}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{points}}  xs ← ’f‾ormat m‾ap 1 s‾elect points\ \ {\mathrm{xs}}\ {\leftarrow}\ {\text{'}}{\mathrm{\underline{f}ormat}}\ {\mathrm{\underline{m}ap}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{points}}
203 ys := 'f_ormat m_ap 2 s_elect points\ \ {\mathrm{ys}}\ {\leftarrow}\ {\text{'}}{\mathrm{\underline{f}ormat}}\ {\mathrm{\underline{m}ap}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{points}}  ys ← ’f‾ormat m‾ap 2 s‾elect points\ \ {\mathrm{ys}}\ {\leftarrow}\ {\text{'}}{\mathrm{\underline{f}ormat}}\ {\mathrm{\underline{m}ap}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{points}}
204 ps := xs '{ x y -> e_nclose (d_isclose x) c_at "," c_at d_isclose y } e_ach ys\ \ {\mathrm{ps}}\ {\leftarrow}\ {\mathrm{xs}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{","}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{ys}}  ps ← xs ’{ x y → e‾nclose (d‾isclose x) c‾at "," c‾at d‾isclose y } e‾ach ys\ \ {\mathrm{ps}}\ {\leftarrow}\ {\mathrm{xs}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{","}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{ys}}
205 d_isclose '{ x y -> e_nclose (d_isclose x) c_at " " c_at d_isclose y } r_/ ps\ \ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{ps}}  d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at " " c‾at d‾isclose y } r‾/ ps\ \ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{ps}}
206}{\}}}{\}}

lib/TTTML.xtl

13l:s_how := { s -> 3 6 r_eshape (1 + (s + 2) '* t_able 0 1) s_elect " O.X" }{{}^{\mathrm{l}}\mathrm{\underline{s}how}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {3}\ {6}\ {\mathrm{\underline{r}eshape}}\ {(}{1}\ {+}\ {(}{\mathrm{s}}\ {+}\ {2}{)}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {0}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" O.X"}}\ {\}}ls‾how ← { s → 3 6 r‾eshape (1 + (s + 2) ’× t‾able 0 1) s‾elect " O.X" }{{}^{\mathrm{l}}\mathrm{\underline{s}how}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {3}\ {6}\ {\mathrm{\underline{r}eshape}}\ {(}{1}\ {+}\ {(}{\mathrm{s}}\ {+}\ {2}{)}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {0}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" O.X"}}\ {\}}
17l:lines := 8 9 r_eshape 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 0{{}^{\mathrm{l}}\mathrm{lines}}\ {\leftarrow}\ {8}\ {9}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {1}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {1}\ {0}\ {1}\ {0}\ {0}llines ← 8 9 r‾eshape 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 1 0 0{{}^{\mathrm{l}}\mathrm{lines}}\ {\leftarrow}\ {8}\ {9}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {1}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {1}\ {0}\ {1}\ {0}\ {1}\ {0}\ {0}
21l:o_utcome := { s ->{{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}lo‾utcome ← { s →{{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
22 l := l:lines '+ '* i_nner s\ \ {\mathrm{l}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{lines}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{s}}  l ← llines ’+ ’× i‾nner s\ \ {\mathrm{l}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{lines}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{s}}
23 3 m_ember? l ? 1; -3 m_ember? l ? -1; 0 m_ember? s ? 0; 2\ \ {3}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{l}}\ {?}\ {1}{\diamond}\ {-3}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{l}}\ {?}\ {-1}{\diamond}\ {0}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{s}}\ {?}\ {0}{\diamond}\ {2}  3 m‾ember? l ? 1⋄ −3 m‾ember? l ? −1⋄ 0 m‾ember? s ? 0⋄ 2\ \ {3}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{l}}\ {?}\ {1}{\diamond}\ {-3}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{l}}\ {?}\ {-1}{\diamond}\ {0}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{s}}\ {?}\ {0}{\diamond}\ {2}
24}{\}}}{\}}
29l:symmetries := 8 9 r_eshape 1 2 3 4 5 6 7 8 9 7 4 1 8 5 2 9 6 3 9 8 7 6 5 4 3 2 1 3 6 9 2 5 8 1 4 7 3 2 1 6 5 4 9 8 7 7 8 9 4 5 6 1 2 3 1 4 7 2 5 8 3 6 9 9 6 3 8 5 2 7 4 1{{}^{\mathrm{l}}\mathrm{symmetries}}\ {\leftarrow}\ {8}\ {9}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}\ {7}\ {8}\ {9}\ {7}\ {4}\ {1}\ {8}\ {5}\ {2}\ {9}\ {6}\ {3}\ {9}\ {8}\ {7}\ {6}\ {5}\ {4}\ {3}\ {2}\ {1}\ {3}\ {6}\ {9}\ {2}\ {5}\ {8}\ {1}\ {4}\ {7}\ {3}\ {2}\ {1}\ {6}\ {5}\ {4}\ {9}\ {8}\ {7}\ {7}\ {8}\ {9}\ {4}\ {5}\ {6}\ {1}\ {2}\ {3}\ {1}\ {4}\ {7}\ {2}\ {5}\ {8}\ {3}\ {6}\ {9}\ {9}\ {6}\ {3}\ {8}\ {5}\ {2}\ {7}\ {4}\ {1}lsymmetries ← 8 9 r‾eshape 1 2 3 4 5 6 7 8 9 7 4 1 8 5 2 9 6 3 9 8 7 6 5 4 3 2 1 3 6 9 2 5 8 1 4 7 3 2 1 6 5 4 9 8 7 7 8 9 4 5 6 1 2 3 1 4 7 2 5 8 3 6 9 9 6 3 8 5 2 7 4 1{{}^{\mathrm{l}}\mathrm{symmetries}}\ {\leftarrow}\ {8}\ {9}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}\ {7}\ {8}\ {9}\ {7}\ {4}\ {1}\ {8}\ {5}\ {2}\ {9}\ {6}\ {3}\ {9}\ {8}\ {7}\ {6}\ {5}\ {4}\ {3}\ {2}\ {1}\ {3}\ {6}\ {9}\ {2}\ {5}\ {8}\ {1}\ {4}\ {7}\ {3}\ {2}\ {1}\ {6}\ {5}\ {4}\ {9}\ {8}\ {7}\ {7}\ {8}\ {9}\ {4}\ {5}\ {6}\ {1}\ {2}\ {3}\ {1}\ {4}\ {7}\ {2}\ {5}\ {8}\ {3}\ {6}\ {9}\ {9}\ {6}\ {3}\ {8}\ {5}\ {2}\ {7}\ {4}\ {1}
30l:c_ode := { s -> 'm_in r_/ 3 d_ecode o_\ 1 + l:symmetries s_elect s }{{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}\ {3}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{\underline{o}}{\backslash}}\ {1}\ {+}\ {{}^{\mathrm{l}}\mathrm{symmetries}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}\ {\}}lc‾ode ← { s → ’m‾in r‾/ 3 d‾ecode o‾\ 1 + lsymmetries s‾elect s }{{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}\ {3}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{\underline{o}}{\backslash}}\ {1}\ {+}\ {{}^{\mathrm{l}}\mathrm{symmetries}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}\ {\}}
33l:empty := 2 0 r_eshape 0.5{{}^{\mathrm{l}}\mathrm{empty}}\ {\leftarrow}\ {2}\ {0}\ {\mathrm{\underline{r}eshape}}\ {0.5}lempty ← 2 0 r‾eshape 0.5{{}^{\mathrm{l}}\mathrm{empty}}\ {\leftarrow}\ {2}\ {0}\ {\mathrm{\underline{r}eshape}}\ {0.5}
39l:v_alues := { m c -> ((1 s_elect m) i_ndexOf c) s_elect (2 s_elect m) c_at 0.5 }{{}^{\mathrm{l}}\mathrm{\underline{v}alues}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{c}}\ {\to}\ {(}{(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{c}}{)}\ {\mathrm{\underline{s}elect}}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {0.5}\ {\}}lv‾alues ← { m c → ((1 s‾elect m) i‾ndexOf c) s‾elect (2 s‾elect m) c‾at 0.5 }{{}^{\mathrm{l}}\mathrm{\underline{v}alues}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{c}}\ {\to}\ {(}{(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{c}}{)}\ {\mathrm{\underline{s}elect}}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {0.5}\ {\}}
40l:v_alue := { m s -> m l:v_alues f_loat l:c_ode s }{{}^{\mathrm{l}}\mathrm{\underline{v}alue}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{s}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alues}}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {\mathrm{s}}\ {\}}lv‾alue ← { m s → m lv‾alues f‾loat lc‾ode s }{{}^{\mathrm{l}}\mathrm{\underline{v}alue}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{s}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alues}}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {\mathrm{s}}\ {\}}
43l:a_fter := { s a -> s + (1 - 2 * '+ r_/ s) * (r_ange 9) = a }{{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\mathrm{a}}\ {\to}\ {\mathrm{s}}\ {+}\ {(}{1}\ {-}\ {2}\ {\times}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}{)}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {9}{)}\ {=}\ {\mathrm{a}}\ {\}}la‾fter ← { s a → s + (1 − 2 × ’+ r‾/ s) × (r‾ange 9) = a }{{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\mathrm{a}}\ {\to}\ {\mathrm{s}}\ {+}\ {(}{1}\ {-}\ {2}\ {\times}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}{)}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {9}{)}\ {=}\ {\mathrm{a}}\ {\}}
46l:c_hoose := { m s ->{{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{s}}\ {\to}lc‾hoose ← { m s →{{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{s}}\ {\to}
47 p := w_here s = 0\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{s}}\ {=}\ {0}  p ← w‾here s = 0\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{s}}\ {=}\ {0}
48 v := m l:v_alues '{ a -> f_loat l:c_ode s l:a_fter a } e_ach p\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alues}}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\to}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\mathrm{a}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{p}}  v ← m lv‾alues ’{ a → f‾loat lc‾ode s la‾fter a } e‾ach p\ \ {\mathrm{v}}\ {\leftarrow}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alues}}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\to}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\mathrm{a}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{p}}
49 (v i_ndexOf 'm_ax r_/ v) s_elect p\ \ {(}{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}  (v i‾ndexOf ’m‾ax r‾/ v) s‾elect p\ \ {(}{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
50}{\}}}{\}}
55p_ick! := { m s ->{\mathrm{\underline{p}ick}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{s}}\ {\to}p‾ick! ← { m s →{\mathrm{\underline{p}ick}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{s}}\ {\to}
56 p := w_here s = 0\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{s}}\ {=}\ {0}  p ← w‾here s = 0\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{s}}\ {=}\ {0}
57 (r_oll! 10) = 1 ? (r_oll! t_ally p) s_elect p; m l:c_hoose s\ \ {(}{\mathrm{\underline{r}oll}{!}}\ {10}{)}\ {=}\ {1}\ {?}\ {(}{\mathrm{\underline{r}oll}{!}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}{\diamond}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}  (r‾oll! 10) = 1 ? (r‾oll! t‾ally p) s‾elect p⋄ m lc‾hoose s\ \ {(}{\mathrm{\underline{r}oll}{!}}\ {10}{)}\ {=}\ {1}\ {?}\ {(}{\mathrm{\underline{r}oll}{!}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}{\diamond}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}
58}{\}}}{\}}
59p_lay! := { m g ->{\mathrm{\underline{p}lay}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}p‾lay! ← { m g →{\mathrm{\underline{p}lay}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}
60 s := (t_ally g) s_elect g\ \ {\mathrm{s}}\ {\leftarrow}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  s ← (t‾ally g) s‾elect g\ \ {\mathrm{s}}\ {\leftarrow}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
61 g := g c_at 1 9 r_eshape s l:a_fter m p_ick! s\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {\mathrm{\underline{p}ick}{!}}\ {\mathrm{s}}  g ← g c‾at 1 9 r‾eshape s la‾fter m p‾ick! s\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {\mathrm{\underline{p}ick}{!}}\ {\mathrm{s}}
62 0 = l:o_utcome (t_ally g) s_elect g ? m p_lay! g; g\ \ {0}\ {=}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {?}\ {\mathrm{m}}\ {\mathrm{\underline{p}lay}{!}}\ {\mathrm{g}}{\diamond}\ {\mathrm{g}}  0 = lo‾utcome (t‾ally g) s‾elect g ? m p‾lay! g⋄ g\ \ {0}\ {=}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {?}\ {\mathrm{m}}\ {\mathrm{\underline{p}lay}{!}}\ {\mathrm{g}}{\diamond}\ {\mathrm{g}}
63}{\}}}{\}}
64l:g_ame! := { m -> m p_lay! 1 9 r_eshape 0 }{{}^{\mathrm{l}}\mathrm{\underline{g}ame}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {\mathrm{\underline{p}lay}{!}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}lg‾ame! ← { m → m p‾lay! 1 9 r‾eshape 0 }{{}^{\mathrm{l}}\mathrm{\underline{g}ame}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {\mathrm{\underline{p}lay}{!}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}
71r_esult := { g j ->{\mathrm{\underline{r}esult}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{j}}\ {\to}r‾esult ← { g j →{\mathrm{\underline{r}esult}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{j}}\ {\to}
72 w := l:o_utcome (t_ally g) s_elect g\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  w ← lo‾utcome (t‾ally g) s‾elect g\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
73 x := '+ r_/ (j + 1) s_elect g\ \ {\mathrm{x}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{j}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  x ← ’+ r‾/ (j + 1) s‾elect g\ \ {\mathrm{x}}\ {\leftarrow}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{j}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
74 (0.5 * f_loat w = 2) + f_loat w = (2 * x) - 1\ \ {(}{0.5}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{w}}\ {=}\ {2}{)}\ {+}\ {\mathrm{\underline{f}loat}}\ {\mathrm{w}}\ {=}\ {(}{2}\ {\times}\ {\mathrm{x}}{)}\ {-}\ {1}  (0.5 × f‾loat w = 2) + f‾loat w = (2 × x) − 1\ \ {(}{0.5}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{w}}\ {=}\ {2}{)}\ {+}\ {\mathrm{\underline{f}loat}}\ {\mathrm{w}}\ {=}\ {(}{2}\ {\times}\ {\mathrm{x}}{)}\ {-}\ {1}
75}{\}}}{\}}
76t_arget := { g m j ->{\mathrm{\underline{t}arget}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{m}}\ {\mathrm{j}}\ {\to}t‾arget ← { g m j →{\mathrm{\underline{t}arget}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{m}}\ {\mathrm{j}}\ {\to}
77 j >= (t_ally g) - 2 ? g r_esult j; 0.9 * m l:v_alue (j + 3) s_elect g\ \ {\mathrm{j}}\ {\geq}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {-}\ {2}\ {?}\ {\mathrm{g}}\ {\mathrm{\underline{r}esult}}\ {\mathrm{j}}{\diamond}\ {0.9}\ {\times}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alue}}\ {(}{\mathrm{j}}\ {+}\ {3}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  j ≥ (t‾ally g) − 2 ? g r‾esult j⋄ 0.9 × m lv‾alue (j + 3) s‾elect g\ \ {\mathrm{j}}\ {\geq}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {-}\ {2}\ {?}\ {\mathrm{g}}\ {\mathrm{\underline{r}esult}}\ {\mathrm{j}}{\diamond}\ {0.9}\ {\times}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alue}}\ {(}{\mathrm{j}}\ {+}\ {3}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
78}{\}}}{\}}
79b_ack := { g m j ->{\mathrm{\underline{b}ack}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{m}}\ {\mathrm{j}}\ {\to}b‾ack ← { g m j →{\mathrm{\underline{b}ack}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{m}}\ {\mathrm{j}}\ {\to}
80 k := (1 s_elect m) i_ndexOf f_loat l:c_ode (j + 1) s_elect g\ \ {\mathrm{k}}\ {\leftarrow}\ {(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {(}{\mathrm{j}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  k ← (1 s‾elect m) i‾ndexOf f‾loat lc‾ode (j + 1) s‾elect g\ \ {\mathrm{k}}\ {\leftarrow}\ {(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {(}{\mathrm{j}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
81 d := 0.2 * ((g t_arget m)_ j) - m l:v_alue (j + 1) s_elect g\ \ {\mathrm{d}}\ {\leftarrow}\ {0.2}\ {\times}\ {(}{(}{\mathrm{g}}\ {\mathrm{\underline{t}arget}}\ {\mathrm{m}}{)}{\_}\ {\mathrm{j}}{)}\ {-}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alue}}\ {(}{\mathrm{j}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  d ← 0.2 × ((g t‾arget m)_ j) − m lv‾alue (j + 1) s‾elect g\ \ {\mathrm{d}}\ {\leftarrow}\ {0.2}\ {\times}\ {(}{(}{\mathrm{g}}\ {\mathrm{\underline{t}arget}}\ {\mathrm{m}}{)}{\_}\ {\mathrm{j}}{)}\ {-}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alue}}\ {(}{\mathrm{j}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
82 m := m + (0.0 c_at d) '* t_able f_loat (r_ange t_ally 1 s_elect m) = k\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{m}}\ {+}\ {(}{0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{d}}{)}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{f}loat}}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {=}\ {\mathrm{k}}  m ← m + (0.0 c‾at d) ’× t‾able f‾loat (r‾ange t‾ally 1 s‾elect m) = k\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{m}}\ {+}\ {(}{0.0}\ {\mathrm{\underline{c}at}}\ {\mathrm{d}}{)}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{f}loat}}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {=}\ {\mathrm{k}}
83 j = 1 ? m; (g b_ack m)_ j - 1\ \ {\mathrm{j}}\ {=}\ {1}\ {?}\ {\mathrm{m}}{\diamond}\ {(}{\mathrm{g}}\ {\mathrm{\underline{b}ack}}\ {\mathrm{m}}{)}{\_}\ {\mathrm{j}}\ {-}\ {1}  j = 1 ? m⋄ (g b‾ack m)_ j − 1\ \ {\mathrm{j}}\ {=}\ {1}\ {?}\ {\mathrm{m}}{\diamond}\ {(}{\mathrm{g}}\ {\mathrm{\underline{b}ack}}\ {\mathrm{m}}{)}{\_}\ {\mathrm{j}}\ {-}\ {1}
84}{\}}}{\}}
86m_eet := { m g ->{\mathrm{\underline{m}eet}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}m‾eet ← { m g →{\mathrm{\underline{m}eet}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}
87 c := u_nique '{ j -> f_loat l:c_ode j s_elect g } e_ach 1 d_rop r_ange t_ally g\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{u}nique}}\ {\text{'}}{\{}\ {\mathrm{j}}\ {\to}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {\mathrm{j}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{g}}  c ← u‾nique ’{ j → f‾loat lc‾ode j s‾elect g } e‾ach 1 d‾rop r‾ange t‾ally g\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{u}nique}}\ {\text{'}}{\{}\ {\mathrm{j}}\ {\to}\ {\mathrm{\underline{f}loat}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ode}}\ {\mathrm{j}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{g}}
88 n := (w_here 0 = c m_ember? 1 s_elect m) s_elect c\ \ {\mathrm{n}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {0}\ {=}\ {\mathrm{c}}\ {\mathrm{\underline{m}ember}{?}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{c}}  n ← (w‾here 0 = c m‾ember? 1 s‾elect m) s‾elect c\ \ {\mathrm{n}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {0}\ {=}\ {\mathrm{c}}\ {\mathrm{\underline{m}ember}{?}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{c}}
89 k := (t_ally 1 s_elect m) + t_ally n\ \ {\mathrm{k}}\ {\leftarrow}\ {(}{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{n}}  k ← (t‾ally 1 s‾elect m) + t‾ally n\ \ {\mathrm{k}}\ {\leftarrow}\ {(}{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{n}}
90 (2 c_at k) r_eshape ((1 s_elect m) c_at n) c_at (2 s_elect m) c_at 0.5 + 0.0 * n\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {0.5}\ {+}\ {0.0}\ {\times}\ {\mathrm{n}}  (2 c‾at k) r‾eshape ((1 s‾elect m) c‾at n) c‾at (2 s‾elect m) c‾at 0.5 + 0.0 × n\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {0.5}\ {+}\ {0.0}\ {\times}\ {\mathrm{n}}
91}{\}}}{\}}
92l:l_earn := { m g -> (g b_ack m m_eet g)_ (t_ally g) - 1 }{{}^{\mathrm{l}}\mathrm{\underline{l}earn}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}\ {(}{\mathrm{g}}\ {\mathrm{\underline{b}ack}}\ {\mathrm{m}}\ {\mathrm{\underline{m}eet}}\ {\mathrm{g}}{)}{\_}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {-}\ {1}\ {\}}ll‾earn ← { m g → (g b‾ack m m‾eet g)_ (t‾ally g) − 1 }{{}^{\mathrm{l}}\mathrm{\underline{l}earn}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}\ {(}{\mathrm{g}}\ {\mathrm{\underline{b}ack}}\ {\mathrm{m}}\ {\mathrm{\underline{m}eet}}\ {\mathrm{g}}{)}{\_}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {-}\ {1}\ {\}}
100r_ound! := { m -> m l:l_earn l:g_ame! m }{\mathrm{\underline{r}ound}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{l}earn}}\ {{}^{\mathrm{l}}\mathrm{\underline{g}ame}{!}}\ {\mathrm{m}}\ {\}}r‾ound! ← { m → m ll‾earn lg‾ame! m }{\mathrm{\underline{r}ound}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{l}earn}}\ {{}^{\mathrm{l}}\mathrm{\underline{g}ame}{!}}\ {\mathrm{m}}\ {\}}
101l_oop! := { n m ->{\mathrm{\underline{l}oop}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}l‾oop! ← { n m →{\mathrm{\underline{l}oop}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}
102 k := 250 m_in n\ \ {\mathrm{k}}\ {\leftarrow}\ {250}\ {\mathrm{\underline{m}in}}\ {\mathrm{n}}  k ← 250 m‾in n\ \ {\mathrm{k}}\ {\leftarrow}\ {250}\ {\mathrm{\underline{m}in}}\ {\mathrm{n}}
103 m := k 'r_ound! p_ower m\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{r}ound}{!}}\ {\mathrm{\underline{p}ower}}\ {\mathrm{m}}  m ← k ’r‾ound! p‾ower m\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{r}ound}{!}}\ {\mathrm{\underline{p}ower}}\ {\mathrm{m}}
104 shown := p_rint! (n - k) c_at t_ally 1 s_elect m\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}  shown ← p‾rint! (n − k) c‾at t‾ally 1 s‾elect m\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
105 n = k ? m; (n - k) l_oop! m\ \ {\mathrm{n}}\ {=}\ {\mathrm{k}}\ {?}\ {\mathrm{m}}{\diamond}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{k}}{)}\ {\mathrm{\underline{l}oop}{!}}\ {\mathrm{m}}  n = k ? m⋄ (n − k) l‾oop! m\ \ {\mathrm{n}}\ {=}\ {\mathrm{k}}\ {?}\ {\mathrm{m}}{\diamond}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{k}}{)}\ {\mathrm{\underline{l}oop}{!}}\ {\mathrm{m}}
106}{\}}}{\}}
107l:t_rain! := { n m ->{{}^{\mathrm{l}}\mathrm{\underline{t}rain}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}lt‾rain! ← { n m →{{}^{\mathrm{l}}\mathrm{\underline{t}rain}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}
108 shown := p_rint! "games to go, positions known:"\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"games to go, positions known:"}}  shown ← p‾rint! "games to go, positions known:"\ \ {\mathrm{shown}}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"games to go, positions known:"}}
109 n l_oop! m\ \ {\mathrm{n}}\ {\mathrm{\underline{l}oop}{!}}\ {\mathrm{m}}  n l‾oop! m\ \ {\mathrm{n}}\ {\mathrm{\underline{l}oop}{!}}\ {\mathrm{m}}
110}{\}}}{\}}
115t_urn! := { m side s ->{\mathrm{\underline{t}urn}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{s}}\ {\to}t‾urn! ← { m side s →{\mathrm{\underline{t}urn}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{s}}\ {\to}
116 p := w_here s = 0\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{s}}\ {=}\ {0}  p ← w‾here s = 0\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {\mathrm{s}}\ {=}\ {0}
117 (1 - 2 * '+ r_/ s) = side ? m l:c_hoose s; (r_oll! t_ally p) s_elect p\ \ {(}{1}\ {-}\ {2}\ {\times}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}{)}\ {=}\ {\mathrm{side}}\ {?}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}{\diamond}\ {(}{\mathrm{\underline{r}oll}{!}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}  (1 − 2 × ’+ r‾/ s) = side ? m lc‾hoose s⋄ (r‾oll! t‾ally p) s‾elect p\ \ {(}{1}\ {-}\ {2}\ {\times}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{s}}{)}\ {=}\ {\mathrm{side}}\ {?}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}{\diamond}\ {(}{\mathrm{\underline{r}oll}{!}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
118}{\}}}{\}}
119v_ersus! := { m side s ->{\mathrm{\underline{v}ersus}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{s}}\ {\to}v‾ersus! ← { m side s →{\mathrm{\underline{v}ersus}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{s}}\ {\to}
120 s := s l:a_fter ((m t_urn! side)_ s)\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {(}{(}{\mathrm{m}}\ {\mathrm{\underline{t}urn}{!}}\ {\mathrm{side}}{)}{\_}\ {\mathrm{s}}{)}  s ← s la‾fter ((m t‾urn! side)_ s)\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {(}{(}{\mathrm{m}}\ {\mathrm{\underline{t}urn}{!}}\ {\mathrm{side}}{)}{\_}\ {\mathrm{s}}{)}
121 w := l:o_utcome s\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {\mathrm{s}}  w ← lo‾utcome s\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {\mathrm{s}}
122 w = 0 ? ((m v_ersus! side)_ s); w\ \ {\mathrm{w}}\ {=}\ {0}\ {?}\ {(}{(}{\mathrm{m}}\ {\mathrm{\underline{v}ersus}{!}}\ {\mathrm{side}}{)}{\_}\ {\mathrm{s}}{)}{\diamond}\ {\mathrm{w}}  w = 0 ? ((m v‾ersus! side)_ s)⋄ w\ \ {\mathrm{w}}\ {=}\ {0}\ {?}\ {(}{(}{\mathrm{m}}\ {\mathrm{\underline{v}ersus}{!}}\ {\mathrm{side}}{)}{\_}\ {\mathrm{s}}{)}{\diamond}\ {\mathrm{w}}
123}{\}}}{\}}
124c_ount! := { m side n ->{\mathrm{\underline{c}ount}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{n}}\ {\to}c‾ount! ← { m side n →{\mathrm{\underline{c}ount}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{n}}\ {\to}
125 w := '{ i -> ((m v_ersus! side)_ 9 r_eshape 0) } e_ach r_ange n\ \ {\mathrm{w}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{i}}\ {\to}\ {(}{(}{\mathrm{m}}\ {\mathrm{\underline{v}ersus}{!}}\ {\mathrm{side}}{)}{\_}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  w ← ’{ i → ((m v‾ersus! side)_ 9 r‾eshape 0) } e‾ach r‾ange n\ \ {\mathrm{w}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{i}}\ {\to}\ {(}{(}{\mathrm{m}}\ {\mathrm{\underline{v}ersus}{!}}\ {\mathrm{side}}{)}{\_}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
126 '+ r_/ w '= t_able side c_at (0 - side) c_at 2\ \ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{w}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{side}}\ {\mathrm{\underline{c}at}}\ {(}{0}\ {-}\ {\mathrm{side}}{)}\ {\mathrm{\underline{c}at}}\ {2}  ’+ r‾/ w ’= t‾able side c‾at (0 − side) c‾at 2\ \ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{w}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{side}}\ {\mathrm{\underline{c}at}}\ {(}{0}\ {-}\ {\mathrm{side}}{)}\ {\mathrm{\underline{c}at}}\ {2}
127}{\}}}{\}}
130l:t_rial! := { n m -> 2 3 r_eshape ((m c_ount! 1)_ n) c_at (m c_ount! -1)_ n }{{}^{\mathrm{l}}\mathrm{\underline{t}rial}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {(}{(}{\mathrm{m}}\ {\mathrm{\underline{c}ount}{!}}\ {1}{)}{\_}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{m}}\ {\mathrm{\underline{c}ount}{!}}\ {-1}{)}{\_}\ {\mathrm{n}}\ {\}}lt‾rial! ← { n m → 2 3 r‾eshape ((m c‾ount! 1)_ n) c‾at (m c‾ount! −1)_ n }{{}^{\mathrm{l}}\mathrm{\underline{t}rial}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {(}{(}{\mathrm{m}}\ {\mathrm{\underline{c}ount}{!}}\ {1}{)}{\_}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{m}}\ {\mathrm{\underline{c}ount}{!}}\ {-1}{)}{\_}\ {\mathrm{n}}\ {\}}
134g_reedy := { m g ->{\mathrm{\underline{g}reedy}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}g‾reedy ← { m g →{\mathrm{\underline{g}reedy}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}
135 s := (t_ally g) s_elect g\ \ {\mathrm{s}}\ {\leftarrow}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  s ← (t‾ally g) s‾elect g\ \ {\mathrm{s}}\ {\leftarrow}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
136 g := g c_at 1 9 r_eshape s l:a_fter m l:c_hoose s\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}  g ← g c‾at 1 9 r‾eshape s la‾fter m lc‾hoose s\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}
137 0 = l:o_utcome (t_ally g) s_elect g ? m g_reedy g; g\ \ {0}\ {=}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {?}\ {\mathrm{m}}\ {\mathrm{\underline{g}reedy}}\ {\mathrm{g}}{\diamond}\ {\mathrm{g}}  0 = lo‾utcome (t‾ally g) s‾elect g ? m g‾reedy g⋄ g\ \ {0}\ {=}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {?}\ {\mathrm{m}}\ {\mathrm{\underline{g}reedy}}\ {\mathrm{g}}{\diamond}\ {\mathrm{g}}
138}{\}}}{\}}
139l:b_est := { m -> m g_reedy 1 9 r_eshape 0 }{{}^{\mathrm{l}}\mathrm{\underline{b}est}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {\mathrm{\underline{g}reedy}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}lb‾est ← { m → m g‾reedy 1 9 r‾eshape 0 }{{}^{\mathrm{l}}\mathrm{\underline{b}est}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {\mathrm{\underline{g}reedy}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}
142l:b_oards := { g ->{{}^{\mathrm{l}}\mathrm{\underline{b}oards}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\to}lb‾oards ← { g →{{}^{\mathrm{l}}\mathrm{\underline{b}oards}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\to}
143 k := t_ally g\ \ {\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{g}}  k ← t‾ally g\ \ {\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{g}}
144 rows := (3 * (r_ange 3) - 1) '+ t_able 9 * (r_ange k) - 1\ \ {\mathrm{rows}}\ {\leftarrow}\ {(}{3}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {3}{)}\ {-}\ {1}{)}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {9}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{k}}{)}\ {-}\ {1}  rows ← (3 × (r‾ange 3) − 1) ’+ t‾able 9 × (r‾ange k) − 1\ \ {\mathrm{rows}}\ {\leftarrow}\ {(}{3}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {3}{)}\ {-}\ {1}{)}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {9}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{k}}{)}\ {-}\ {1}
145 at := (1 + 9 * k) m_in rows '+ t_able 1 2 3 99\ \ {\mathrm{at}}\ {\leftarrow}\ {(}{1}\ {+}\ {9}\ {\times}\ {\mathrm{k}}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{rows}}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}\ {99}  at ← (1 + 9 × k) m‾in rows ’+ t‾able 1 2 3 99\ \ {\mathrm{at}}\ {\leftarrow}\ {(}{1}\ {+}\ {9}\ {\times}\ {\mathrm{k}}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{rows}}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}\ {99}
146 squares := at s_elect (r_avel g) c_at 3\ \ {\mathrm{squares}}\ {\leftarrow}\ {\mathrm{at}}\ {\mathrm{\underline{s}elect}}\ {(}{\mathrm{\underline{r}avel}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{c}at}}\ {3}  squares ← at s‾elect (r‾avel g) c‾at 3\ \ {\mathrm{squares}}\ {\leftarrow}\ {\mathrm{at}}\ {\mathrm{\underline{s}elect}}\ {(}{\mathrm{\underline{r}avel}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{c}at}}\ {3}
147 (3 c_at 8 * k) r_eshape (1 + (squares + 2) '* t_able 0 1) s_elect " O.X "\ \ {(}{3}\ {\mathrm{\underline{c}at}}\ {8}\ {\times}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{1}\ {+}\ {(}{\mathrm{squares}}\ {+}\ {2}{)}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {0}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" O.X "}}  (3 c‾at 8 × k) r‾eshape (1 + (squares + 2) ’× t‾able 0 1) s‾elect " O.X "\ \ {(}{3}\ {\mathrm{\underline{c}at}}\ {8}\ {\times}\ {\mathrm{k}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{1}\ {+}\ {(}{\mathrm{squares}}\ {+}\ {2}{)}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {0}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\text{" O.X "}}
148}{\}}}{\}}
154o_pening! := { @ -> 2 9 r_eshape (9 r_eshape 0) c_at 1 * (r_ange 9) = r_oll! 9 }{\mathrm{\underline{o}pening}{!}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {2}\ {9}\ {\mathrm{\underline{r}eshape}}\ {(}{9}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {9}{)}\ {=}\ {\mathrm{\underline{r}oll}{!}}\ {9}\ {\}}o‾pening! ← { @ → 2 9 r‾eshape (9 r‾eshape 0) c‾at 1 × (r‾ange 9) = r‾oll! 9 }{\mathrm{\underline{o}pening}{!}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {2}\ {9}\ {\mathrm{\underline{r}eshape}}\ {(}{9}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {\times}\ {(}{\mathrm{\underline{r}ange}}\ {9}{)}\ {=}\ {\mathrm{\underline{r}oll}{!}}\ {9}\ {\}}
155f_inal := { g -> l:o_utcome (t_ally g) s_elect g }{\mathrm{\underline{f}inal}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\to}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {\}}f‾inal ← { g → lo‾utcome (t‾ally g) s‾elect g }{\mathrm{\underline{f}inal}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\to}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}\ {\}}
156l:s_elfTrial! := { n m ->{{}^{\mathrm{l}}\mathrm{\underline{s}elfTrial}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}ls‾elfTrial! ← { n m →{{}^{\mathrm{l}}\mathrm{\underline{s}elfTrial}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}
157 w := '{ i -> f_inal m g_reedy o_pening! @ } e_ach r_ange n\ \ {\mathrm{w}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{i}}\ {\to}\ {\mathrm{\underline{f}inal}}\ {\mathrm{m}}\ {\mathrm{\underline{g}reedy}}\ {\mathrm{\underline{o}pening}{!}}\ {@}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  w ← ’{ i → f‾inal m g‾reedy o‾pening! @ } e‾ach r‾ange n\ \ {\mathrm{w}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{i}}\ {\to}\ {\mathrm{\underline{f}inal}}\ {\mathrm{m}}\ {\mathrm{\underline{g}reedy}}\ {\mathrm{\underline{o}pening}{!}}\ {@}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
158 '+ r_/ w '= t_able 1 -1 2\ \ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{w}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {1}\ {-1}\ {2}  ’+ r‾/ w ’= t‾able 1 −1 2\ \ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{w}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {1}\ {-1}\ {2}
159}{\}}}{\}}

lib/Terminal.xtl

10l:BLACK := []C_OLOR 1{{}^{\mathrm{l}}\mathrm{BLACK}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {1}lBLACK ← □C‾OLOR 1{{}^{\mathrm{l}}\mathrm{BLACK}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {1}
11l:RED := []C_OLOR 2{{}^{\mathrm{l}}\mathrm{RED}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {2}lRED ← □C‾OLOR 2{{}^{\mathrm{l}}\mathrm{RED}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {2}
12l:GREEN := []C_OLOR 3{{}^{\mathrm{l}}\mathrm{GREEN}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {3}lGREEN ← □C‾OLOR 3{{}^{\mathrm{l}}\mathrm{GREEN}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {3}
13l:YELLOW := []C_OLOR 4{{}^{\mathrm{l}}\mathrm{YELLOW}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {4}lYELLOW ← □C‾OLOR 4{{}^{\mathrm{l}}\mathrm{YELLOW}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {4}
14l:BLUE := []C_OLOR 5{{}^{\mathrm{l}}\mathrm{BLUE}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {5}lBLUE ← □C‾OLOR 5{{}^{\mathrm{l}}\mathrm{BLUE}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {5}
15l:MAGENTA := []C_OLOR 6{{}^{\mathrm{l}}\mathrm{MAGENTA}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {6}lMAGENTA ← □C‾OLOR 6{{}^{\mathrm{l}}\mathrm{MAGENTA}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {6}
16l:CYAN := []C_OLOR 7{{}^{\mathrm{l}}\mathrm{CYAN}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {7}lCYAN ← □C‾OLOR 7{{}^{\mathrm{l}}\mathrm{CYAN}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {7}
17l:WHITE := []C_OLOR 8{{}^{\mathrm{l}}\mathrm{WHITE}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {8}lWHITE ← □C‾OLOR 8{{}^{\mathrm{l}}\mathrm{WHITE}}\ {\leftarrow}\ {\square \mathrm{\underline{C}OLOR}}\ {8}
19l:UP := []K_NAMED 1{{}^{\mathrm{l}}\mathrm{UP}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {1}lUP ← □K‾NAMED 1{{}^{\mathrm{l}}\mathrm{UP}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {1}
20l:DOWN := []K_NAMED 2{{}^{\mathrm{l}}\mathrm{DOWN}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {2}lDOWN ← □K‾NAMED 2{{}^{\mathrm{l}}\mathrm{DOWN}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {2}
21l:LEFT := []K_NAMED 3{{}^{\mathrm{l}}\mathrm{LEFT}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {3}lLEFT ← □K‾NAMED 3{{}^{\mathrm{l}}\mathrm{LEFT}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {3}
22l:RIGHT := []K_NAMED 4{{}^{\mathrm{l}}\mathrm{RIGHT}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {4}lRIGHT ← □K‾NAMED 4{{}^{\mathrm{l}}\mathrm{RIGHT}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {4}
23l:ENTER := []K_NAMED 5{{}^{\mathrm{l}}\mathrm{ENTER}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {5}lENTER ← □K‾NAMED 5{{}^{\mathrm{l}}\mathrm{ENTER}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {5}
24l:ESCAPE := []K_NAMED 6{{}^{\mathrm{l}}\mathrm{ESCAPE}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {6}lESCAPE ← □K‾NAMED 6{{}^{\mathrm{l}}\mathrm{ESCAPE}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {6}
25l:BACKSPACE := []K_NAMED 7{{}^{\mathrm{l}}\mathrm{BACKSPACE}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {7}lBACKSPACE ← □K‾NAMED 7{{}^{\mathrm{l}}\mathrm{BACKSPACE}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {7}
26l:TAB := []K_NAMED 8{{}^{\mathrm{l}}\mathrm{TAB}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {8}lTAB ← □K‾NAMED 8{{}^{\mathrm{l}}\mathrm{TAB}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {8}
27l:DELETE := []K_NAMED 9{{}^{\mathrm{l}}\mathrm{DELETE}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {9}lDELETE ← □K‾NAMED 9{{}^{\mathrm{l}}\mathrm{DELETE}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {9}
28l:HOME := []K_NAMED 10{{}^{\mathrm{l}}\mathrm{HOME}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {10}lHOME ← □K‾NAMED 10{{}^{\mathrm{l}}\mathrm{HOME}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {10}
29l:END := []K_NAMED 11{{}^{\mathrm{l}}\mathrm{END}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {11}lEND ← □K‾NAMED 11{{}^{\mathrm{l}}\mathrm{END}}\ {\leftarrow}\ {\square \mathrm{\underline{K}NAMED}}\ {11}

lib/Turtle.xtl

9r_adians := { (f_loat _r) * (p_i @) / 180 } # private{\mathrm{\underline{r}adians}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{\underline{f}loat}}\ {\_\mathrm{r}}{)}\ {\times}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {180}\ {\}}r‾adians ← { (f‾loat _r) × (p‾i @) ÷ 180 }{\mathrm{\underline{r}adians}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{\underline{f}loat}}\ {\_\mathrm{r}}{)}\ {\times}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {180}\ {\}}
14l:w_alk := { lengths turns ->{{}^{\mathrm{l}}\mathrm{\underline{w}alk}}\ {\leftarrow}\ {\{}\ {\mathrm{lengths}}\ {\mathrm{turns}}\ {\to}lw‾alk ← { lengths turns →{{}^{\mathrm{l}}\mathrm{\underline{w}alk}}\ {\leftarrow}\ {\{}\ {\mathrm{lengths}}\ {\mathrm{turns}}\ {\to}
15 h := r_adians '+ s_\ turns\ \ {\mathrm{h}}\ {\leftarrow}\ {\mathrm{\underline{r}adians}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{turns}}  h ← r‾adians ’+ s‾\ turns\ \ {\mathrm{h}}\ {\leftarrow}\ {\mathrm{\underline{r}adians}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{turns}}
16 xs := 0 c_at '+ s_\ (f_loat lengths) * c_os h\ \ {\mathrm{xs}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{lengths}}{)}\ {\times}\ {\mathrm{\underline{c}os}}\ {\mathrm{h}}  xs ← 0 c‾at ’+ s‾\ (f‾loat lengths) × c‾os h\ \ {\mathrm{xs}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{lengths}}{)}\ {\times}\ {\mathrm{\underline{c}os}}\ {\mathrm{h}}
17 ys := 0 c_at '+ s_\ (f_loat lengths) * s_in h\ \ {\mathrm{ys}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{lengths}}{)}\ {\times}\ {\mathrm{\underline{s}in}}\ {\mathrm{h}}  ys ← 0 c‾at ’+ s‾\ (f‾loat lengths) × s‾in h\ \ {\mathrm{ys}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{lengths}}{)}\ {\times}\ {\mathrm{\underline{s}in}}\ {\mathrm{h}}
18 (2 c_at t_ally xs) r_eshape xs c_at ys\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{xs}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{xs}}\ {\mathrm{\underline{c}at}}\ {\mathrm{ys}}  (2 c‾at t‾ally xs) r‾eshape xs c‾at ys\ \ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{xs}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{xs}}\ {\mathrm{\underline{c}at}}\ {\mathrm{ys}}
19}{\}}}{\}}
22l:p_oints := { turns -> 1 l:w_alk turns }{{}^{\mathrm{l}}\mathrm{\underline{p}oints}}\ {\leftarrow}\ {\{}\ {\mathrm{turns}}\ {\to}\ {1}\ {{}^{\mathrm{l}}\mathrm{\underline{w}alk}}\ {\mathrm{turns}}\ {\}}lp‾oints ← { turns → 1 lw‾alk turns }{{}^{\mathrm{l}}\mathrm{\underline{p}oints}}\ {\leftarrow}\ {\{}\ {\mathrm{turns}}\ {\to}\ {1}\ {{}^{\mathrm{l}}\mathrm{\underline{w}alk}}\ {\mathrm{turns}}\ {\}}
26l:t_urn := { t w -> (t + 1 t_ake w) c_at 1 d_rop w }{{}^{\mathrm{l}}\mathrm{\underline{t}urn}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{t}}\ {+}\ {1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{w}}\ {\}}lt‾urn ← { t w → (t + 1 t‾ake w) c‾at 1 d‾rop w }{{}^{\mathrm{l}}\mathrm{\underline{t}urn}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{t}}\ {+}\ {1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{w}}\ {\}}
29l:p_olygon := { n -> n r_eshape 360 / n }{{}^{\mathrm{l}}\mathrm{\underline{p}olygon}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\mathrm{\underline{r}eshape}}\ {360}\ {\div}\ {\mathrm{n}}\ {\}}lp‾olygon ← { n → n r‾eshape 360 ÷ n }{{}^{\mathrm{l}}\mathrm{\underline{p}olygon}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\mathrm{\underline{r}eshape}}\ {360}\ {\div}\ {\mathrm{n}}\ {\}}

userlibs/Greetings.xtl

5n_ame := { @ -> "X̲ᵉTᵃL" } # private{\mathrm{\underline{n}ame}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\text{"\underline{X}ᵉTᵃL"}}\ {\}}n‾ame ← { @ → "X‾ᵉTᵃL" }{\mathrm{\underline{n}ame}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\text{"\underline{X}ᵉTᵃL"}}\ {\}}
6l:g_reet := { g -> g c_at " " c_at n_ame @ } # monadic: the greeting{{}^{\mathrm{l}}\mathrm{\underline{g}reet}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\to}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{n}ame}}\ {@}\ {\}}lg‾reet ← { g → g c‾at " " c‾at n‾ame @ }{{}^{\mathrm{l}}\mathrm{\underline{g}reet}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\to}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{n}ame}}\ {@}\ {\}}

userlibs/Hello.xtl

7l:h_ello := { @ -> "hello X̲ᵉTᵃL" } # niladic: call it with @{{}^{\mathrm{l}}\mathrm{\underline{h}ello}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\text{"hello \underline{X}ᵉTᵃL"}}\ {\}}lh‾ello ← { @ → "hello X‾ᵉTᵃL" }{{}^{\mathrm{l}}\mathrm{\underline{h}ello}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\text{"hello \underline{X}ᵉTᵃL"}}\ {\}}

docs/literate/beginner.org

23r_ev "stressed"{\mathrm{\underline{r}ev}}\ {\text{"stressed"}}r‾ev "stressed"{\mathrm{\underline{r}ev}}\ {\text{"stressed"}}
431 2 3 + 10{1}\ {2}\ {3}\ {+}\ {10}1 2 3 + 10{1}\ {2}\ {3}\ {+}\ {10}
58m := 2 3 r_eshape r_ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}m ← 2 3 r‾eshape r‾ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
59m{\mathrm{m}}m{\mathrm{m}}
80'+ r_/ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}’+ r‾/ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}
81'+ r_/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
99u:s_quare := { _r * _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}us‾quare ← { _r × _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
100u:s_quare 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {1}\ {2}\ {3}us‾quare 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {1}\ {2}\ {3}
101'u:s_quare e_ach 4 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\mathrm{\underline{e}ach}}\ {4}\ {5}’us‾quare e‾ach 4 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\mathrm{\underline{e}ach}}\ {4}\ {5}
120'+ r_/_2 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}’+ r‾/2 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}
1211 o_-_2 m{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{m}}1 o‾−2 m{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{m}}
143u:m_ean := ['+ r_/ / t_ally]{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}um‾ean ← [’+ r‾/ ÷ t‾ally]{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}
144u:m_ean 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}\ {4}um‾ean 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}\ {4}
145[n_eg a_bs] -5{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-5}[n‾eg a‾bs] −5{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-5}
163"s:" u_se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
164s:s_d 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}ss‾d 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}

docs/literate/birds.org

28"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
291 c:K_ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}1 cK‾ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}
54u:a_b := { a b -> (10 * a) + b }{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{10}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\}}ua‾b ← { a b → (10 × a) + b }{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{10}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\}}
55u:a_bc := { a b c -> (100 * a) + (10 * b) + c }{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\to}\ {(}{100}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {(}{10}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {\mathrm{c}}\ {\}}ua‾bc ← { a b c → (100 × a) + (10 × b) + c }{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\to}\ {(}{100}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {(}{10}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {\mathrm{c}}\ {\}}
56u:i_nc := { _r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}ui‾nc ← { _r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}
57u:d_ouble := { _r * 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}ud‾ouble ← { _r × 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}
581 'u:a_b c:C_ 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {2}1 ’ua‾b cC‾ 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {2}
82'u:d_ouble 'u:i_nc c:B_ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}’ud‾ouble ’ui‾nc cB‾ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}
991 'u:a_b 'u:i_nc c:B_1 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}1}}\ {2}1 ’ua‾b ’ui‾nc cB‾1 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}1}}\ {2}
119'u:a_b c:W_ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {3}’ua‾b cW‾ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {3}
120'u:d_ouble 'u:a_b c:S_ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{S}}}\ {3}’ud‾ouble ’ua‾b cS‾ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{S}}}\ {3}
1393 c:T_ 'u:d_ouble{3}\ {{}^{\mathrm{c}}\mathrm{\underline{T}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}3 cT‾ ’ud‾ouble{3}\ {{}^{\mathrm{c}}\mathrm{\underline{T}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}
140(3 c:V_ 4)_ '+{(}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{)}{\_}\ {\text{'}}{+}(3 cV‾ 4)_ ’+{(}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{)}{\_}\ {\text{'}}{+}
141(3 c:V_ 4)_ 'u:a_b{(}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}(3 cV‾ 4)_ ’ua‾b{(}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}
163u:f_act := { ~s_elf n -> n <= 1 ? 1; n * s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uf‾act ← { ∼s‾elf n → n ≤ 1 ? 1⋄ n × s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
164'u:f_act c:Y_ 10{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {10}’uf‾act cY‾ 10{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {10}
178u:d_ouble^10 1{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{10}\ {1}ud‾ouble10 1{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{10}\ {1}
203u:M_ := { x_ -> x_ 'x_ }{{}^{\mathrm{u}}\mathrm{\underline{M}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}uM‾ ← { x‾ → x‾ ’x‾ }{{}^{\mathrm{u}}\mathrm{\underline{M}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}
204u:I_ := { x -> x }{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}uI‾ ← { x → x }{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}
205('u:I_ u:M_)_ 42{(}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {{}^{\mathrm{u}}\mathrm{\underline{M}}}{)}{\_}\ {42}(’uI‾ uM‾)_ 42{(}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {{}^{\mathrm{u}}\mathrm{\underline{M}}}{)}{\_}\ {42}
206u:Y_ := { f_ -> { x_ -> f_ x_ 'x_ } '{ x_ -> f_ x_ 'x_ } }{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\}}uY‾ ← { f‾ → { x‾ → f‾ x‾ ’x‾ } ’{ x‾ → f‾ x‾ ’x‾ } }{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\}}
207u:F_ := { ~s_elf n -> n <= 1 ? 1; n * s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uF‾ ← { ∼s‾elf n → n ≤ 1 ? 1⋄ n × s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
208(u:Y_ 'u:F_)_ 5{(}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {5}(uY‾ ’uF‾)_ 5{(}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {5}

docs/literate/classics.org

33u:n_ext := { _r + -1 o_- _r }{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {\_\mathrm{r}}\ {\}}un‾ext ← { _r + −1 o‾− _r }{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {\_\mathrm{r}}\ {\}}
34u:n_ext 1 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {1}\ {0}\ {0}\ {0}\ {0}un‾ext 1 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {1}\ {0}\ {0}\ {0}\ {0}
52u:r_ows := { n r ->{{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{r}}\ {\to}ur‾ows ← { n r →{{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{r}}\ {\to}
53 n = 1 ? (1 c_at s_hape r) r_eshape r\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{r}}  n = 1 ? (1 c‾at s‾hape r) r‾eshape r\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{r}}
54 r c_at (n - 1) u:r_ows u:n_ext r\ \ {\mathrm{r}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\mathrm{r}}  r c‾at (n − 1) ur‾ows un‾ext r\ \ {\mathrm{r}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ext}}\ {\mathrm{r}}
55}{\}}}{\}}
566 u:r_ows 6 t_ake 1{6}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {6}\ {\mathrm{\underline{t}ake}}\ {1}6 ur‾ows 6 t‾ake 1{6}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {6}\ {\mathrm{\underline{t}ake}}\ {1}
75sierpinski := []S_HOW []G_RID (32 u:r_ows 32 t_ake 1) m_od 2{\mathrm{sierpinski}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{32}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {32}\ {\mathrm{\underline{t}ake}}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {2}sierpinski ← □S‾HOW □G‾RID (32 ur‾ows 32 t‾ake 1) m‾od 2{\mathrm{sierpinski}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{32}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {32}\ {\mathrm{\underline{t}ake}}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {2}
89colors := []S_HOW []G_RID 16 u:r_ows 16 t_ake 1{\mathrm{colors}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {16}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {16}\ {\mathrm{\underline{t}ake}}\ {1}colors ← □S‾HOW □G‾RID 16 ur‾ows 16 t‾ake 1{\mathrm{colors}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {16}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ows}}\ {16}\ {\mathrm{\underline{t}ake}}\ {1}
114u:s_ieve := { v ->{{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}us‾ieve ← { v →{{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}
115 0 = t_ally v ? v\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}  0 = t‾ally v ? v\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}
116 p := f_irst v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}  p ← f‾irst v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}
117 (p * p) > 'm_ax r_/ v ? v\ \ {(}{\mathrm{p}}\ {\times}\ {\mathrm{p}}{)}\ {>}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}  (p × p) > ’m‾ax r‾/ v ? v\ \ {(}{\mathrm{p}}\ {\times}\ {\mathrm{p}}{)}\ {>}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}
118 rest := 1 d_rop v\ \ {\mathrm{rest}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}  rest ← 1 d‾rop v\ \ {\mathrm{rest}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}
119 p c_at u:s_ieve (w_here 0 != rest m_od p) s_elect rest\ \ {\mathrm{p}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {(}{\mathrm{\underline{w}here}}\ {0}\ {\neq}\ {\mathrm{rest}}\ {\mathrm{\underline{m}od}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rest}}  p c‾at us‾ieve (w‾here 0 ≠ rest m‾od p) s‾elect rest\ \ {\mathrm{p}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {(}{\mathrm{\underline{w}here}}\ {0}\ {\neq}\ {\mathrm{rest}}\ {\mathrm{\underline{m}od}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{rest}}
120}{\}}}{\}}
121u:s_ieve 1 d_rop r_ange 60{{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {60}us‾ieve 1 d‾rop r‾ange 60{{}^{\mathrm{u}}\mathrm{\underline{s}ieve}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{r}ange}}\ {60}
138a := r_ange 30{\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {30}a ← r‾ange 30{\mathrm{a}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {30}
139divides := []S_HOW []G_RID 0 = a 'm_od t_able a{\mathrm{divides}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {0}\ {=}\ {\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}divides ← □S‾HOW □G‾RID 0 = a ’m‾od t‾able a{\mathrm{divides}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {0}\ {=}\ {\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}
150(w_here 2 = '+ r_/_2 0 = a 'm_od t_able a) s_elect a{(}{\mathrm{\underline{w}here}}\ {2}\ {=}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{a}}(w‾here 2 = ’+ r‾/2 0 = a ’m‾od t‾able a) s‾elect a{(}{\mathrm{\underline{w}here}}\ {2}\ {=}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{a}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{a}}
166u:g_cd := { a b -> b = 0 ? a; b u:g_cd a m_od b }{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{b}}\ {=}\ {0}\ {?}\ {\mathrm{a}}{\diamond}\ {\mathrm{b}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{a}}\ {\mathrm{\underline{m}od}}\ {\mathrm{b}}\ {\}}ug‾cd ← { a b → b = 0 ? a⋄ b ug‾cd a m‾od b }{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{b}}\ {=}\ {0}\ {?}\ {\mathrm{a}}{\diamond}\ {\mathrm{b}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{a}}\ {\mathrm{\underline{m}od}}\ {\mathrm{b}}\ {\}}
167'u:g_cd r_/ 84 126 210{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{\underline{r}}{/}}\ {84}\ {126}\ {210}’ug‾cd r‾/ 84 126 210{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{g}cd}}\ {\mathrm{\underline{r}}{/}}\ {84}\ {126}\ {210}
183u:h_ail := { n -> 0 = n m_od 2 ? n d_iv 2; 1 + 3 * n }{{}^{\mathrm{u}}\mathrm{\underline{h}ail}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {0}\ {=}\ {\mathrm{n}}\ {\mathrm{\underline{m}od}}\ {2}\ {?}\ {\mathrm{n}}\ {\mathrm{\underline{d}iv}}\ {2}{\diamond}\ {1}\ {+}\ {3}\ {\times}\ {\mathrm{n}}\ {\}}uh‾ail ← { n → 0 = n m‾od 2 ? n d‾iv 2⋄ 1 + 3 × n }{{}^{\mathrm{u}}\mathrm{\underline{h}ail}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {0}\ {=}\ {\mathrm{n}}\ {\mathrm{\underline{m}od}}\ {2}\ {?}\ {\mathrm{n}}\ {\mathrm{\underline{d}iv}}\ {2}{\diamond}\ {1}\ {+}\ {3}\ {\times}\ {\mathrm{n}}\ {\}}
184u:c_ollatz := { n -> n = 1 ? 1 r_eshape 1; n c_at u:c_ollatz u:h_ail n }{{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {1}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}{\diamond}\ {\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}ail}}\ {\mathrm{n}}\ {\}}uc‾ollatz ← { n → n = 1 ? 1 r‾eshape 1⋄ n c‾at uc‾ollatz uh‾ail n }{{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {1}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}{\diamond}\ {\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}ail}}\ {\mathrm{n}}\ {\}}
185'{ (t_ally u:c_ollatz _r) - 1 } e_ach r_ange 30{\text{'}}{\{}\ {(}{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {\_\mathrm{r}}{)}\ {-}\ {1}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {30}’{ (t‾ally uc‾ollatz _r) − 1 } e‾ach r‾ange 30{\text{'}}{\{}\ {(}{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ollatz}}\ {\_\mathrm{r}}{)}\ {-}\ {1}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {30}
211u:q_sort := { v ->{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}uq‾sort ← { v →{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}
212 2 > t_ally v ? v\ \ {2}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}  2 > t‾ally v ? v\ \ {2}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}\ {?}\ {\mathrm{v}}
213 p := f_irst v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}  p ← f‾irst v\ \ {\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\mathrm{v}}
214 below := (w_here v < p) s_elect v\ \ {\mathrm{below}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {<}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}  below ← (w‾here v < p) s‾elect v\ \ {\mathrm{below}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {<}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
215 same := (w_here v = p) s_elect v\ \ {\mathrm{same}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {=}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}  same ← (w‾here v = p) s‾elect v\ \ {\mathrm{same}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {=}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
216 above := (w_here v > p) s_elect v\ \ {\mathrm{above}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}  above ← (w‾here v > p) s‾elect v\ \ {\mathrm{above}}\ {\leftarrow}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {\mathrm{p}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
217 (u:q_sort below) c_at same c_at u:q_sort above\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{below}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{same}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{above}}  (uq‾sort below) c‾at same c‾at uq‾sort above\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{below}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{same}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {\mathrm{above}}
218}{\}}}{\}}
219u:q_sort 3 1 4 1 5 9 2 6 5 3 5{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}uq‾sort 3 1 4 1 5 9 2 6 5 3 5{{}^{\mathrm{u}}\mathrm{\underline{q}sort}}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}\ {5}\ {3}\ {5}
240u:h_anoi := { n pegs ->{{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{pegs}}\ {\to}uh‾anoi ← { n pegs →{{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{pegs}}\ {\to}
241 n = 0 ? 0 2 r_eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}  n = 0 ? 0 2 r‾eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}
242 first := (n - 1) u:h_anoi 1 3 2 s_elect pegs\ \ {\mathrm{first}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}  first ← (n − 1) uh‾anoi 1 3 2 s‾elect pegs\ \ {\mathrm{first}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}
243 last := (n - 1) u:h_anoi 3 2 1 s_elect pegs\ \ {\mathrm{last}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {3}\ {2}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}  last ← (n − 1) uh‾anoi 3 2 1 s‾elect pegs\ \ {\mathrm{last}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {3}\ {2}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}
244 first c_at (1 2 r_eshape 2 t_ake pegs) c_at last\ \ {\mathrm{first}}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{pegs}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{last}}  first c‾at (1 2 r‾eshape 2 t‾ake pegs) c‾at last\ \ {\mathrm{first}}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{pegs}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{last}}
245}{\}}}{\}}
2463 u:h_anoi 1 3 2{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}3 uh‾anoi 1 3 2{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}
289u:m_ove := { p m ->{{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{m}}\ {\to}um‾ove ← { p m →{{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{m}}\ {\to}
290 from := 1 s_elect m\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}  from ← 1 s‾elect m\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
291 disk := p i_ndexOf from\ \ {\mathrm{disk}}\ {\leftarrow}\ {\mathrm{p}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{from}}  disk ← p i‾ndexOf from\ \ {\mathrm{disk}}\ {\leftarrow}\ {\mathrm{p}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{from}}
292 p + ((2 s_elect m) - from) * disk = r_ange t_ally p\ \ {\mathrm{p}}\ {+}\ {(}{(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {-}\ {\mathrm{from}}{)}\ {\times}\ {\mathrm{disk}}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}  p + ((2 s‾elect m) − from) × disk = r‾ange t‾ally p\ \ {\mathrm{p}}\ {+}\ {(}{(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {-}\ {\mathrm{from}}{)}\ {\times}\ {\mathrm{disk}}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}
293}{\}}}{\}}
294u:s_lots := { p ->{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}us‾lots ← { p →{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}
295 n := t_ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}  n ← t‾ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}
296 (r_ange n) '{ r j -> r s_elect (0 - n) t_ake 0 c_at w_here p = j } t_able 1 2 3\ \ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\mathrm{r}}\ {\mathrm{j}}\ {\to}\ {\mathrm{r}}\ {\mathrm{\underline{s}elect}}\ {(}{0}\ {-}\ {\mathrm{n}}{)}\ {\mathrm{\underline{t}ake}}\ {0}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{w}here}}\ {\mathrm{p}}\ {=}\ {\mathrm{j}}\ {\}}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}  (r‾ange n) ’{ r j → r s‾elect (0 − n) t‾ake 0 c‾at w‾here p = j } t‾able 1 2 3\ \ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\mathrm{r}}\ {\mathrm{j}}\ {\to}\ {\mathrm{r}}\ {\mathrm{\underline{s}elect}}\ {(}{0}\ {-}\ {\mathrm{n}}{)}\ {\mathrm{\underline{t}ake}}\ {0}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{w}here}}\ {\mathrm{p}}\ {=}\ {\mathrm{j}}\ {\}}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}
297}{\}}}{\}}
298u:p_icture := { p ->{{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}up‾icture ← { p →{{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}
299 n := t_ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}  n ← t‾ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}
300 w := 1 + 2 * n\ \ {\mathrm{w}}\ {\leftarrow}\ {1}\ {+}\ {2}\ {\times}\ {\mathrm{n}}  w ← 1 + 2 × n\ \ {\mathrm{w}}\ {\leftarrow}\ {1}\ {+}\ {2}\ {\times}\ {\mathrm{n}}
301 bars := (u:s_lots p) '{ s x -> s > a_bs x } t_able (o_ffsets w) - n\ \ {\mathrm{bars}}\ {\leftarrow}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\mathrm{p}}{)}\ {\text{'}}{\{}\ {\mathrm{s}}\ {\mathrm{x}}\ {\to}\ {\mathrm{s}}\ {>}\ {\mathrm{\underline{a}bs}}\ {\mathrm{x}}\ {\}}\ {\mathrm{\underline{t}able}}\ {(}{\mathrm{\underline{o}ffsets}}\ {\mathrm{w}}{)}\ {-}\ {\mathrm{n}}  bars ← (us‾lots p) ’{ s x → s > a‾bs x } t‾able (o‾ffsets w) − n\ \ {\mathrm{bars}}\ {\leftarrow}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\mathrm{p}}{)}\ {\text{'}}{\{}\ {\mathrm{s}}\ {\mathrm{x}}\ {\to}\ {\mathrm{s}}\ {>}\ {\mathrm{\underline{a}bs}}\ {\mathrm{x}}\ {\}}\ {\mathrm{\underline{t}able}}\ {(}{\mathrm{\underline{o}ffsets}}\ {\mathrm{w}}{)}\ {-}\ {\mathrm{n}}
302 (n c_at 3 * w) r_eshape r_avel bars\ \ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {3}\ {\times}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{bars}}  (n c‾at 3 × w) r‾eshape r‾avel bars\ \ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {3}\ {\times}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{bars}}
303}{\}}}{\}}
304u:p_lane := { m -> (1 c_at s_hape m) r_eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}up‾lane ← { m → (1 c‾at s‾hape m) r‾eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}
305u:p_lay := { p moves ->{{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{moves}}\ {\to}up‾lay ← { p moves →{{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{moves}}\ {\to}
306 frame := u:p_lane u:p_icture p\ \ {\mathrm{frame}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{p}}  frame ← up‾lane up‾icture p\ \ {\mathrm{frame}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{p}}
307 0 = t_ally moves ? frame\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{moves}}\ {?}\ {\mathrm{frame}}  0 = t‾ally moves ? frame\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{moves}}\ {?}\ {\mathrm{frame}}
308 frame c_at (p u:m_ove f_irst moves) u:p_lay 1 d_rop moves\ \ {\mathrm{frame}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{p}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{moves}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{moves}}  frame c‾at (p um‾ove f‾irst moves) up‾lay 1 d‾rop moves\ \ {\mathrm{frame}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{p}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{moves}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{moves}}
309}{\}}}{\}}
323watched := []S_HOW []G_RID (4 r_eshape 1) u:p_lay 4 u:h_anoi 1 3 2{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{4}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {4}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}watched ← □S‾HOW □G‾RID (4 r‾eshape 1) up‾lay 4 uh‾anoi 1 3 2{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{4}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {4}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}
348a := 4 4 r_eshape 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0{\mathrm{a}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ \ {0}\ {0}\ {1}\ {0}\ \ {0}\ {0}\ {0}\ {1}\ \ {0}\ {0}\ {0}\ {0}a ← 4 4 r‾eshape 0 1 0 0  0 0 1 0  0 0 0 1  0 0 0 0{\mathrm{a}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ \ {0}\ {0}\ {1}\ {0}\ \ {0}\ {0}\ {0}\ {1}\ \ {0}\ {0}\ {0}\ {0}
349u:c_losure := { r ->{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}uc‾losure ← { r →{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}
350 next := r | r '| '& i_nner r\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{r}}\ {\vee}\ {\mathrm{r}}\ {\text{'}}{\vee}\ {\text{'}}{\wedge}\ {\mathrm{\underline{i}nner}}\ {\mathrm{r}}  next ← r ∨ r ’∨ ’∧ i‾nner r\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{r}}\ {\vee}\ {\mathrm{r}}\ {\text{'}}{\vee}\ {\text{'}}{\wedge}\ {\mathrm{\underline{i}nner}}\ {\mathrm{r}}
351 (next m_atch r) ? r\ \ {(}{\mathrm{next}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{r}}{)}\ {?}\ {\mathrm{r}}  (next m‾atch r) ? r\ \ {(}{\mathrm{next}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{r}}{)}\ {?}\ {\mathrm{r}}
352 u:c_losure next\ \ {{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{next}}  uc‾losure next\ \ {{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{next}}
353}{\}}}{\}}
354u:c_losure a{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{a}}uc‾losure a{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{a}}
380u:w_arshallSteps := { r k ->{{}^{\mathrm{u}}\mathrm{\underline{w}arshallSteps}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\mathrm{k}}\ {\to}uw‾arshallSteps ← { r k →{{}^{\mathrm{u}}\mathrm{\underline{w}arshallSteps}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\mathrm{k}}\ {\to}
381 k > t_ally r ? u:p_lane r\ \ {\mathrm{k}}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{r}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{r}}  k > t‾ally r ? up‾lane r\ \ {\mathrm{k}}\ {>}\ {\mathrm{\underline{t}ally}}\ {\mathrm{r}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{r}}
382 through := (k s_elect_2 r) '& t_able k s_elect r\ \ {\mathrm{through}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{r}}{)}\ {\text{'}}{\wedge}\ {\mathrm{\underline{t}able}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}  through ← (k s‾elect2 r) ’∧ t‾able k s‾elect r\ \ {\mathrm{through}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{r}}{)}\ {\text{'}}{\wedge}\ {\mathrm{\underline{t}able}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{r}}
383 (u:p_lane r) c_at (r | through) u:w_arshallSteps k + 1\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{r}}\ {\vee}\ {\mathrm{through}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshallSteps}}\ {\mathrm{k}}\ {+}\ {1}  (up‾lane r) c‾at (r ∨ through) uw‾arshallSteps k + 1\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{r}}\ {\vee}\ {\mathrm{through}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshallSteps}}\ {\mathrm{k}}\ {+}\ {1}
384}{\}}}{\}}
385g := 8 8 r_eshape 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0{\mathrm{g}}\ {\leftarrow}\ {8}\ {8}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ \ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ \ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}g ← 8 8 r‾eshape 0 1 0 0 0 0 0 0  0 0 1 0 0 0 0 0  1 0 0 1 0 0 0 0  0 0 0 0 1 0 0 0  0 0 0 0 0 1 0 0  0 0 0 0 0 0 1 0  0 0 0 0 0 0 0 1  0 0 0 0 1 0 0 0{\mathrm{g}}\ {\leftarrow}\ {8}\ {8}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ \ {1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ \ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ \ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}
395watched := []S_HOW []G_RID g u:w_arshallSteps 1{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshallSteps}}\ {1}watched ← □S‾HOW □G‾RID g uw‾arshallSteps 1{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshallSteps}}\ {1}
416w := 4 4 r_eshape 0 3 999 7 8 0 2 999 5 999 0 1 2 999 999 0{\mathrm{w}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {3}\ {999}\ {7}\ \ {8}\ {0}\ {2}\ {999}\ \ {5}\ {999}\ {0}\ {1}\ \ {2}\ {999}\ {999}\ {0}w ← 4 4 r‾eshape 0 3 999 7  8 0 2 999  5 999 0 1  2 999 999 0{\mathrm{w}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {3}\ {999}\ {7}\ \ {8}\ {0}\ {2}\ {999}\ \ {5}\ {999}\ {0}\ {1}\ \ {2}\ {999}\ {999}\ {0}
417u:s_hortest := { d ->{{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}us‾hortest ← { d →{{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}
418 e := d 'm_in '+ i_nner d\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{d}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {\mathrm{\underline{i}nner}}\ {\mathrm{d}}  e ← d ’m‾in ’+ i‾nner d\ \ {\mathrm{e}}\ {\leftarrow}\ {\mathrm{d}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\text{'}}{+}\ {\mathrm{\underline{i}nner}}\ {\mathrm{d}}
419 (e m_atch d) ? d\ \ {(}{\mathrm{e}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{d}}{)}\ {?}\ {\mathrm{d}}  (e m‾atch d) ? d\ \ {(}{\mathrm{e}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{d}}{)}\ {?}\ {\mathrm{d}}
420 u:s_hortest e\ \ {{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\mathrm{e}}  us‾hortest e\ \ {{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\mathrm{e}}
421}{\}}}{\}}
422u:s_hortest w{{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\mathrm{w}}us‾hortest w{{}^{\mathrm{u}}\mathrm{\underline{s}hortest}}\ {\mathrm{w}}
445u:d_iff := { v -> (1 d_rop v) - -1 d_rop v }{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {-}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}\ {\}}ud‾iff ← { v → (1 d‾rop v) − −1 d‾rop v }{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}\ {\leftarrow}\ {\{}\ {\mathrm{v}}\ {\to}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {-}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}\ {\}}
446squares := (r_ange 8) ^ 2{\mathrm{squares}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ange}}\ {8}{)}\ {\mathbin{\hat{}}}\ {2}squares ← (r‾ange 8) ^ 2{\mathrm{squares}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ange}}\ {8}{)}\ {\mathbin{\hat{}}}\ {2}
447u:d_iff squares{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}\ {\mathrm{squares}}ud‾iff squares{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}\ {\mathrm{squares}}
448u:d_iff^2 squares{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}^{2}\ {\mathrm{squares}}ud‾iff2 squares{{}^{\mathrm{u}}\mathrm{\underline{d}iff}}^{2}\ {\mathrm{squares}}
474u:b_its := { rule -> (rule d_iv 2 ^ o_ffsets 8) m_od 2 }{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {\leftarrow}\ {\{}\ {\mathrm{rule}}\ {\to}\ {(}{\mathrm{rule}}\ {\mathrm{\underline{d}iv}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {8}{)}\ {\mathrm{\underline{m}od}}\ {2}\ {\}}ub‾its ← { rule → (rule d‾iv 2 ^ o‾ffsets 8) m‾od 2 }{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {\leftarrow}\ {\{}\ {\mathrm{rule}}\ {\to}\ {(}{\mathrm{rule}}\ {\mathrm{\underline{d}iv}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {8}{)}\ {\mathrm{\underline{m}od}}\ {2}\ {\}}
475u:s_tep := { bits row -> (1 + (4 * -1 o_- row) + (2 * row) + 1 o_- row) s_elect bits }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {\mathrm{bits}}\ {\mathrm{row}}\ {\to}\ {(}{1}\ {+}\ {(}{4}\ {\times}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{row}}{)}\ {+}\ {(}{2}\ {\times}\ {\mathrm{row}}{)}\ {+}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{row}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{bits}}\ {\}}us‾tep ← { bits row → (1 + (4 × −1 o‾− row) + (2 × row) + 1 o‾− row) s‾elect bits }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {\mathrm{bits}}\ {\mathrm{row}}\ {\to}\ {(}{1}\ {+}\ {(}{4}\ {\times}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{row}}{)}\ {+}\ {(}{2}\ {\times}\ {\mathrm{row}}{)}\ {+}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{row}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{bits}}\ {\}}
476u:e_volve := { bits rows ->{{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\leftarrow}\ {\{}\ {\mathrm{bits}}\ {\mathrm{rows}}\ {\to}ue‾volve ← { bits rows →{{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\leftarrow}\ {\{}\ {\mathrm{bits}}\ {\mathrm{rows}}\ {\to}
477 (t_ally rows) >= t_ally f_irst rows ? rows\ \ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{rows}}{)}\ {\geq}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{rows}}\ {?}\ {\mathrm{rows}}  (t‾ally rows) ≥ t‾ally f‾irst rows ? rows\ \ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{rows}}{)}\ {\geq}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{rows}}\ {?}\ {\mathrm{rows}}
478 next := bits u:s_tep r_avel -1 t_ake rows\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{bits}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{r}avel}}\ {-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{rows}}  next ← bits us‾tep r‾avel −1 t‾ake rows\ \ {\mathrm{next}}\ {\leftarrow}\ {\mathrm{bits}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{r}avel}}\ {-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{rows}}
479 bits u:e_volve rows c_at next\ \ {\mathrm{bits}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\mathrm{rows}}\ {\mathrm{\underline{c}at}}\ {\mathrm{next}}  bits ue‾volve rows c‾at next\ \ {\mathrm{bits}}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {\mathrm{rows}}\ {\mathrm{\underline{c}at}}\ {\mathrm{next}}
480}{\}}}{\}}
481u:s_tart := { w -> (1 c_at w) r_eshape ((w d_iv 2) r_eshape 0) c_at 1 c_at (w - 1 + w d_iv 2) r_eshape 0 }{{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{(}{\mathrm{w}}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{w}}\ {-}\ {1}\ {+}\ {\mathrm{w}}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}us‾tart ← { w → (1 c‾at w) r‾eshape ((w d‾iv 2) r‾eshape 0) c‾at 1 c‾at (w − 1 + w d‾iv 2) r‾eshape 0 }{{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {(}{(}{\mathrm{w}}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{w}}\ {-}\ {1}\ {+}\ {\mathrm{w}}\ {\mathrm{\underline{d}iv}}\ {2}{)}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}
482u:b_its 90{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {90}ub‾its 90{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {90}
493ninety := []S_HOW []G_RID 32 t_ake (u:b_its 90) u:e_volve u:s_tart 63{\mathrm{ninety}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {32}\ {\mathrm{\underline{t}ake}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {90}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {63}ninety ← □S‾HOW □G‾RID 32 t‾ake (ub‾its 90) ue‾volve us‾tart 63{\mathrm{ninety}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {32}\ {\mathrm{\underline{t}ake}}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{b}its}}\ {90}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{e}volve}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tart}}\ {63}
514text := "the quick brown fox jumps over the lazy dog and the cat"{\mathrm{text}}\ {\leftarrow}\ {\text{"the quick brown fox jumps over the lazy dog and the cat"}}text ← "the quick brown fox jumps over the lazy dog and the cat"{\mathrm{text}}\ {\leftarrow}\ {\text{"the quick brown fox jumps over the lazy dog and the cat"}}
515space := f_irst " "{\mathrm{space}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}space ← f‾irst " "{\mathrm{space}}\ {\leftarrow}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}
516letters := s_ort u_nique (w_here text != space) s_elect text{\mathrm{letters}}\ {\leftarrow}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{text}}\ {\neq}\ {\mathrm{space}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{text}}letters ← s‾ort u‾nique (w‾here text ≠ space) s‾elect text{\mathrm{letters}}\ {\leftarrow}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{u}nique}}\ {(}{\mathrm{\underline{w}here}}\ {\mathrm{text}}\ {\neq}\ {\mathrm{space}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{text}}
517n := '+ r_/_2 letters '= t_able text{\mathrm{n}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{letters}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{text}}n ← ’+ r‾/2 letters ’= t‾able text{\mathrm{n}}\ {\leftarrow}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{letters}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{text}}
518n{\mathrm{n}}n{\mathrm{n}}
530tall := (r_ev r_ange 'm_ax r_/ n) '<= t_able n{\mathrm{tall}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ange}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}{)}\ {\text{'}}{\leq}\ {\mathrm{\underline{t}able}}\ {\mathrm{n}}tall ← (r‾ev r‾ange ’m‾ax r‾/ n) ’≤ t‾able n{\mathrm{tall}}\ {\leftarrow}\ {(}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ange}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{n}}{)}\ {\text{'}}{\leq}\ {\mathrm{\underline{t}able}}\ {\mathrm{n}}
531shown := []S_HOW []G_RID tall{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{tall}}shown ← □S‾HOW □G‾RID tall{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{tall}}
549v := "aaabccddddde"{\mathrm{v}}\ {\leftarrow}\ {\text{"aaabccddddde"}}v ← "aaabccddddde"{\mathrm{v}}\ {\leftarrow}\ {\text{"aaabccddddde"}}
550p := w_here 1 c_at (1 d_rop v) != -1 d_rop v{\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {\neq}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}p ← w‾here 1 c‾at (1 d‾rop v) ≠ −1 d‾rop v{\mathrm{p}}\ {\leftarrow}\ {\mathrm{\underline{w}here}}\ {1}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}{)}\ {\neq}\ {-1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}
551p s_elect v{\mathrm{p}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}p s‾elect v{\mathrm{p}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
552((1 d_rop p) c_at 1 + t_ally v) - p{(}{(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {-}\ {\mathrm{p}}((1 d‾rop p) c‾at 1 + t‾ally v) − p{(}{(}{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{p}}{)}\ {\mathrm{\underline{c}at}}\ {1}\ {+}\ {\mathrm{\underline{t}ally}}\ {\mathrm{v}}{)}\ {-}\ {\mathrm{p}}
571u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}
588u:f_rames := { n b ->{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}uf‾rames ← { n b →{{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}
589 n = 1 ? (1 c_at s_hape b) r_eshape b\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}  n = 1 ? (1 c‾at s‾hape b) r‾eshape b\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}
590 b c_at (n - 1) u:f_rames u:l_ife b\ \ {\mathrm{b}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{b}}  b c‾at (n − 1) uf‾rames ul‾ife b\ \ {\mathrm{b}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{b}}
591}{\}}}{\}}
606glider := 10 t_ake 10 t_ake_2 3 3 r_eshape 0 1 0 0 0 1 1 1 1{\mathrm{glider}}\ {\leftarrow}\ {10}\ {\mathrm{\underline{t}ake}}\ {10}\ {{\mathrm{\underline{t}ake}}_{2}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}glider ← 10 t‾ake 10 t‾ake2 3 3 r‾eshape 0 1 0 0 0 1 1 1 1{\mathrm{glider}}\ {\leftarrow}\ {10}\ {\mathrm{\underline{t}ake}}\ {10}\ {{\mathrm{\underline{t}ake}}_{2}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}
607(u:l_ife^40 glider) m_atch glider{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{40}\ {\mathrm{glider}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{glider}}(ul‾ife40 glider) m‾atch glider{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{40}\ {\mathrm{glider}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{glider}}
620torus := []S_HOW []G_RID 40 u:f_rames glider{\mathrm{torus}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\mathrm{glider}}torus ← □S‾HOW □G‾RID 40 uf‾rames glider{\mathrm{torus}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rames}}\ {\mathrm{glider}}
643row := 0 c_at (10 r_eshape 1) c_at 0{\mathrm{row}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {(}{10}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {0}row ← 0 c‾at (10 r‾eshape 1) c‾at 0{\mathrm{row}}\ {\leftarrow}\ {0}\ {\mathrm{\underline{c}at}}\ {(}{10}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {0}
644mask := row '* t_able row{\mathrm{mask}}\ {\leftarrow}\ {\mathrm{row}}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{row}}mask ← row ’× t‾able row{\mathrm{mask}}\ {\leftarrow}\ {\mathrm{row}}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{row}}
645u:b_oxed := { mask * u:l_ife _r }{{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}\ {\leftarrow}\ {\{}\ {\mathrm{mask}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\_\mathrm{r}}\ {\}}ub‾oxed ← { mask × ul‾ife _r }{{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}\ {\leftarrow}\ {\{}\ {\mathrm{mask}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\_\mathrm{r}}\ {\}}
646u:b_oxedFrames := { n b ->{{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}ub‾oxedFrames ← { n b →{{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{b}}\ {\to}
647 n = 1 ? (1 c_at s_hape b) r_eshape b\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}  n = 1 ? (1 c‾at s‾hape b) r‾eshape b\ \ {\mathrm{n}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{b}}
648 b c_at (n - 1) u:b_oxedFrames u:b_oxed b\ \ {\mathrm{b}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}\ {\mathrm{b}}  b c‾at (n − 1) ub‾oxedFrames ub‾oxed b\ \ {\mathrm{b}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}\ {\mathrm{b}}
649}{\}}}{\}}
650start := -1 o_- -1 o_-_2 12 t_ake 12 t_ake_2 3 3 r_eshape 0 1 0 0 0 1 1 1 1{\mathrm{start}}\ {\leftarrow}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {12}\ {\mathrm{\underline{t}ake}}\ {12}\ {{\mathrm{\underline{t}ake}}_{2}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}start ← −1 o‾− −1 o‾−2 12 t‾ake 12 t‾ake2 3 3 r‾eshape 0 1 0 0 0 1 1 1 1{\mathrm{start}}\ {\leftarrow}\ {-1}\ {\mathrm{\underline{o}}{-}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {12}\ {\mathrm{\underline{t}ake}}\ {12}\ {{\mathrm{\underline{t}ake}}_{2}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {1}
651'+ r_/_12 u:b_oxed^40 start{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}^{40}\ {\mathrm{start}}’+ r‾/12 ub‾oxed40 start{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxed}}^{40}\ {\mathrm{start}}
665boxed := []S_HOW []G_RID 40 u:b_oxedFrames start{\mathrm{boxed}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {\mathrm{start}}boxed ← □S‾HOW □G‾RID 40 ub‾oxedFrames start{\mathrm{boxed}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {40}\ {{}^{\mathrm{u}}\mathrm{\underline{b}oxedFrames}}\ {\mathrm{start}}
684"t:" u_se< "Turtle"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Turtle"}}"t:" u‾se< "Turtle"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Turtle"}}
685f_loor 0.5 + t:p_oints 0 90 90 90{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {0}\ {90}\ {90}\ {90}f‾loor 0.5 + tp‾oints 0 90 90 90{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {0}\ {90}\ {90}\ {90}
707u:k_och := { n ->{{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}uk‾och ← { n →{{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
708 n = 0 ? 1 r_eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}  n = 0 ? 1 r‾eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}
709 k := u:k_och n - 1\ \ {\mathrm{k}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {\mathrm{n}}\ {-}\ {1}  k ← uk‾och n − 1\ \ {\mathrm{k}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {\mathrm{n}}\ {-}\ {1}
710 k c_at (60 t:t_urn k) c_at (-120 t:t_urn k) c_at 60 t:t_urn k\ \ {\mathrm{k}}\ {\mathrm{\underline{c}at}}\ {(}{60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {(}{-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}  k c‾at (60 tt‾urn k) c‾at (−120 tt‾urn k) c‾at 60 tt‾urn k\ \ {\mathrm{k}}\ {\mathrm{\underline{c}at}}\ {(}{60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {(}{-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{k}}
711}{\}}}{\}}
712side := u:k_och 3{\mathrm{side}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {3}side ← uk‾och 3{\mathrm{side}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{k}och}}\ {3}
713t_ally side{\mathrm{\underline{t}ally}}\ {\mathrm{side}}t‾ally side{\mathrm{\underline{t}ally}}\ {\mathrm{side}}
724snowflake := []S_HOW []P_ATH t:p_oints side c_at (-120 t:t_urn side) c_at -120 t:t_urn side{\mathrm{snowflake}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {\mathrm{side}}\ {\mathrm{\underline{c}at}}\ {(}{-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{side}}{)}\ {\mathrm{\underline{c}at}}\ {-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{side}}snowflake ← □S‾HOW □P‾ATH tp‾oints side c‾at (−120 tt‾urn side) c‾at −120 tt‾urn side{\mathrm{snowflake}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {\mathrm{side}}\ {\mathrm{\underline{c}at}}\ {(}{-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{side}}{)}\ {\mathrm{\underline{c}at}}\ {-120}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{side}}
752u:a_rrow := { n s ->{{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{s}}\ {\to}ua‾rrow ← { n s →{{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{s}}\ {\to}
753 n = 0 ? 1 r_eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}  n = 0 ? 1 r‾eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}
754 outer := (n - 1) u:a_rrow n_eg s\ \ {\mathrm{outer}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\mathrm{\underline{n}eg}}\ {\mathrm{s}}  outer ← (n − 1) ua‾rrow n‾eg s\ \ {\mathrm{outer}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\mathrm{\underline{n}eg}}\ {\mathrm{s}}
755 outer c_at ((60 * s) t:t_urn (n - 1) u:a_rrow s) c_at (60 * s) t:t_urn outer\ \ {\mathrm{outer}}\ {\mathrm{\underline{c}at}}\ {(}{(}{60}\ {\times}\ {\mathrm{s}}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {(}{60}\ {\times}\ {\mathrm{s}}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{outer}}  outer c‾at ((60 × s) tt‾urn (n − 1) ua‾rrow s) c‾at (60 × s) tt‾urn outer\ \ {\mathrm{outer}}\ {\mathrm{\underline{c}at}}\ {(}{(}{60}\ {\times}\ {\mathrm{s}}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {(}{60}\ {\times}\ {\mathrm{s}}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {\mathrm{outer}}
756}{\}}}{\}}
757arrowhead := t:p_oints 5 u:a_rrow 1{\mathrm{arrowhead}}\ {\leftarrow}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {5}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {1}arrowhead ← tp‾oints 5 ua‾rrow 1{\mathrm{arrowhead}}\ {\leftarrow}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {5}\ {{}^{\mathrm{u}}\mathrm{\underline{a}rrow}}\ {1}
758n := 1 s_elect 1 d_rop s_hape arrowhead{\mathrm{n}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{arrowhead}}n ← 1 s‾elect 1 d‾rop s‾hape arrowhead{\mathrm{n}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{arrowhead}}
759u:u_pTo := { k -> ((f_loor k * n / 24) m_in r_ange n) s_elect_2 arrowhead }{{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{f}loor}}\ {\mathrm{k}}\ {\times}\ {\mathrm{n}}\ {\div}\ {24}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{arrowhead}}\ {\}}uu‾pTo ← { k → ((f‾loor k × n ÷ 24) m‾in r‾ange n) s‾elect2 arrowhead }{{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{f}loor}}\ {\mathrm{k}}\ {\times}\ {\mathrm{n}}\ {\div}\ {24}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{arrowhead}}\ {\}}
760u:d_rawing := { k ->{{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}ud‾rawing ← { k →{{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}
761 k = 1 ? (1 c_at s_hape u:u_pTo 1) r_eshape u:u_pTo 1\ \ {\mathrm{k}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {1}{)}\ {\mathrm{\underline{r}eshape}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {1}  k = 1 ? (1 c‾at s‾hape uu‾pTo 1) r‾eshape uu‾pTo 1\ \ {\mathrm{k}}\ {=}\ {1}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {1}{)}\ {\mathrm{\underline{r}eshape}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {1}
762 (u:d_rawing k - 1) c_at u:u_pTo k\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\mathrm{k}}  (ud‾rawing k − 1) c‾at uu‾pTo k\ \ {(}{{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\mathrm{k}}
763}{\}}}{\}}
764n{\mathrm{n}}n{\mathrm{n}}
775drawing := []S_HOW []P_ATH u:d_rawing 24{\mathrm{drawing}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {24}drawing ← □S‾HOW □P‾ATH ud‾rawing 24{\mathrm{drawing}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{P}ATH}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}rawing}}\ {24}

docs/literate/duck.org

26family := 3 20 r_eshape " _ _ _ __(.)< (.)< (.)< \\___) "{\mathrm{family}}\ {\leftarrow}\ {3}\ {20}\ {\mathrm{\underline{r}eshape}}\ {\text{" \_ \_ \_ \_\_(.)< (.)< (.)< \textbackslash{}\textbackslash{}\_\_\_) "}}family ← 3 20 r‾eshape " _ _ _ __(.)< (.)< (.)< \\___) "{\mathrm{family}}\ {\leftarrow}\ {3}\ {20}\ {\mathrm{\underline{r}eshape}}\ {\text{" \_ \_ \_ \_\_(.)< (.)< (.)< \textbackslash{}\textbackslash{}\_\_\_) "}}
27family{\mathrm{family}}family{\mathrm{family}}
44pond := 32 t_ake_2 family{\mathrm{pond}}\ {\leftarrow}\ {32}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{family}}pond ← 32 t‾ake2 family{\mathrm{pond}}\ {\leftarrow}\ {32}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{family}}
45pond{\mathrm{pond}}pond{\mathrm{pond}}
65-6 o_-_2 pond{-6}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}−6 o‾−2 pond{-6}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}
66-27 o_-_2 pond{-27}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}−27 o‾−2 pond{-27}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}
89frames := (n_eg o_ffsets 32) o_-_2 pond{\mathrm{frames}}\ {\leftarrow}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{o}ffsets}}\ {32}{)}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}frames ← (n‾eg o‾ffsets 32) o‾−2 pond{\mathrm{frames}}\ {\leftarrow}\ {(}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{o}ffsets}}\ {32}{)}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}
90s_hape frames{\mathrm{\underline{s}hape}}\ {\mathrm{frames}}s‾hape frames{\mathrm{\underline{s}hape}}\ {\mathrm{frames}}
104shown := []S_HOW []G_RID frames{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{frames}}shown ← □S‾HOW □G‾RID frames{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{frames}}
123water := 32 r_eshape "~ ~~ ~ "{\mathrm{water}}\ {\leftarrow}\ {32}\ {\mathrm{\underline{r}eshape}}\ {\text{"\textasciitilde{} \textasciitilde{}\textasciitilde{} \textasciitilde{} "}}water ← 32 r‾eshape "~ ~~ ~ "{\mathrm{water}}\ {\leftarrow}\ {32}\ {\mathrm{\underline{r}eshape}}\ {\text{"\textasciitilde{} \textasciitilde{}\textasciitilde{} \textasciitilde{} "}}
124waves := (o_ffsets 32) o_- water{\mathrm{waves}}\ {\leftarrow}\ {(}{\mathrm{\underline{o}ffsets}}\ {32}{)}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{water}}waves ← (o‾ffsets 32) o‾− water{\mathrm{waves}}\ {\leftarrow}\ {(}{\mathrm{\underline{o}ffsets}}\ {32}{)}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{water}}
125s_hape waves{\mathrm{\underline{s}hape}}\ {\mathrm{waves}}s‾hape waves{\mathrm{\underline{s}hape}}\ {\mathrm{waves}}
153u:f_rame := { k -> ((n_eg k) o_-_2 pond) c_at k o_- water }{{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{n}eg}}\ {\mathrm{k}}{)}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{water}}\ {\}}uf‾rame ← { k → ((n‾eg k) o‾−2 pond) c‾at k o‾− water }{{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{n}eg}}\ {\mathrm{k}}{)}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{pond}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{water}}\ {\}}
154u:s_wim := { k ->{{}^{\mathrm{u}}\mathrm{\underline{s}wim}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}us‾wim ← { k →{{}^{\mathrm{u}}\mathrm{\underline{s}wim}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}
155 f := u:f_rame k\ \ {\mathrm{f}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\mathrm{k}}  f ← uf‾rame k\ \ {\mathrm{f}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\mathrm{k}}
156 k = 0 ? (1 c_at s_hape f) r_eshape f; (u:s_wim k - 1) c_at f\ \ {\mathrm{k}}\ {=}\ {0}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{f}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{f}}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}wim}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{f}}  k = 0 ? (1 c‾at s‾hape f) r‾eshape f⋄ (us‾wim k − 1) c‾at f\ \ {\mathrm{k}}\ {=}\ {0}\ {?}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{f}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{f}}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}wim}}\ {\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{f}}
157}{\}}}{\}}
158slow := u:s_wim 31{\mathrm{slow}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{s}wim}}\ {31}slow ← us‾wim 31{\mathrm{slow}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{s}wim}}\ {31}
159s_hape slow{\mathrm{\underline{s}hape}}\ {\mathrm{slow}}s‾hape slow{\mathrm{\underline{s}hape}}\ {\mathrm{slow}}
182swim := frames c_at_2 waves{\mathrm{swim}}\ {\leftarrow}\ {\mathrm{frames}}\ {{\mathrm{\underline{c}at}}_{2}}\ {\mathrm{waves}}swim ← frames c‾at2 waves{\mathrm{swim}}\ {\leftarrow}\ {\mathrm{frames}}\ {{\mathrm{\underline{c}at}}_{2}}\ {\mathrm{waves}}
183s_hape swim{\mathrm{\underline{s}hape}}\ {\mathrm{swim}}s‾hape swim{\mathrm{\underline{s}hape}}\ {\mathrm{swim}}
1847 s_elect swim{7}\ {\mathrm{\underline{s}elect}}\ {\mathrm{swim}}7 s‾elect swim{7}\ {\mathrm{\underline{s}elect}}\ {\mathrm{swim}}
201swim m_atch slow{\mathrm{swim}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{slow}}swim m‾atch slow{\mathrm{swim}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{slow}}
212shown := []S_HOW []G_RID swim{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{swim}}shown ← □S‾HOW □G‾RID swim{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{swim}}

docs/literate/finnapl-idioms.org

40v := 3 1 4 1 5 9 2 6{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}v ← 3 1 4 1 5 9 2 6{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}
41b := 0 1 1 0 1 0{\mathrm{b}}\ {\leftarrow}\ {0}\ {1}\ {1}\ {0}\ {1}\ {0}b ← 0 1 1 0 1 0{\mathrm{b}}\ {\leftarrow}\ {0}\ {1}\ {1}\ {0}\ {1}\ {0}
42m := 2 3 r_eshape 1 2 3 4 5 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}m ← 2 3 r‾eshape 1 2 3 4 5 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}
63'+ r_/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’+ r‾/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
87'm_ax r_/ v{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’m‾ax r‾/ v{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
88'm_in r_/ v{\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’m‾in r‾/ v{\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
111'+ s_\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}’+ s‾\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}
135s_ort v{\mathrm{\underline{s}ort}}\ {\mathrm{v}}s‾ort v{\mathrm{\underline{s}ort}}\ {\mathrm{v}}
149g_rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}g‾rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}
150(g_rade v) s_elect v{(}{\mathrm{\underline{g}rade}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}(g‾rade v) s‾elect v{(}{\mathrm{\underline{g}rade}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
175r_ev s_ort v{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}ort}}\ {\mathrm{v}}r‾ev s‾ort v{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}ort}}\ {\mathrm{v}}
199w_here b{\mathrm{\underline{w}here}}\ {\mathrm{b}}w‾here b{\mathrm{\underline{w}here}}\ {\mathrm{b}}
220u_nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}u‾nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}
244(r_ange 5) '* t_able r_ange 5{(}{\mathrm{\underline{r}ange}}\ {5}{)}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {5}(r‾ange 5) ’× t‾able r‾ange 5{(}{\mathrm{\underline{r}ange}}\ {5}{)}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {5}
270(r_ange 5) '= t_able r_ange 5{(}{\mathrm{\underline{r}ange}}\ {5}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {5}(r‾ange 5) ’= t‾able r‾ange 5{(}{\mathrm{\underline{r}ange}}\ {5}{)}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\mathrm{\underline{r}ange}}\ {5}
2981 2 3 '+ '* i_nner 4 5 6{1}\ {2}\ {3}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {4}\ {5}\ {6}1 2 3 ’+ ’× i‾nner 4 5 6{1}\ {2}\ {3}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {4}\ {5}\ {6}
322m '+ '* i_nner o_\ m{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}m ’+ ’× i‾nner o‾\ m{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}
346v '+ '* i_nner v{\mathrm{v}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{v}}v ’+ ’× i‾nner v{\mathrm{v}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{v}}
373u:m_ean := ['+ r_/ / t_ally]{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}um‾ean ← [’+ r‾/ ÷ t‾ally]{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}
374u:m_ean v{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\mathrm{v}}um‾ean v{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\mathrm{v}}
4001 2 3 m_atch 1 2 3{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}1 2 3 m‾atch 1 2 3{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}
4011 2 3 m_atch 1 2 4{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {4}1 2 3 m‾atch 1 2 4{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {4}
425'& r_/ b{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}’∧ r‾/ b{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}
426'| r_/ b{\text{'}}{\vee}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}’∨ r‾/ b{\text{'}}{\vee}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{b}}
4500 = v m_od 2{0}\ {=}\ {\mathrm{v}}\ {\mathrm{\underline{m}od}}\ {2}0 = v m‾od 2{0}\ {=}\ {\mathrm{v}}\ {\mathrm{\underline{m}od}}\ {2}
464(w_here 0 = v m_od 2) s_elect v{(}{\mathrm{\underline{w}here}}\ {0}\ {=}\ {\mathrm{v}}\ {\mathrm{\underline{m}od}}\ {2}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}(w‾here 0 = v m‾od 2) s‾elect v{(}{\mathrm{\underline{w}here}}\ {0}\ {=}\ {\mathrm{v}}\ {\mathrm{\underline{m}od}}\ {2}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
488r_ev v{\mathrm{\underline{r}ev}}\ {\mathrm{v}}r‾ev v{\mathrm{\underline{r}ev}}\ {\mathrm{v}}
489-1 o_- v{-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}−1 o‾− v{-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}
4901 o_- v{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}1 o‾− v{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}
516o_\ m{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}o‾\ m{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}
543r_ange 8{\mathrm{\underline{r}ange}}\ {8}r‾ange 8{\mathrm{\underline{r}ange}}\ {8}
566t_ally r_avel m{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{m}}t‾ally r‾avel m{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{m}}
567s_hape m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}s‾hape m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}
5930 * m{0}\ {\times}\ {\mathrm{m}}0 × m{0}\ {\times}\ {\mathrm{m}}
617(w_here b) s_elect 10 20 30 40 50 60{(}{\mathrm{\underline{w}here}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{s}elect}}\ {10}\ {20}\ {30}\ {40}\ {50}\ {60}(w‾here b) s‾elect 10 20 30 40 50 60{(}{\mathrm{\underline{w}here}}\ {\mathrm{b}}{)}\ {\mathrm{\underline{s}elect}}\ {10}\ {20}\ {30}\ {40}\ {50}\ {60}

docs/literate/hanoi.org

38u:h_anoi := { n pegs ->{{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{pegs}}\ {\to}uh‾anoi ← { n pegs →{{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{pegs}}\ {\to}
39 n = 0 ? 0 2 r_eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}  n = 0 ? 0 2 r‾eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}
40 first := (n - 1) u:h_anoi 1 3 2 s_elect pegs\ \ {\mathrm{first}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}  first ← (n − 1) uh‾anoi 1 3 2 s‾elect pegs\ \ {\mathrm{first}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}
41 last := (n - 1) u:h_anoi 3 2 1 s_elect pegs\ \ {\mathrm{last}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {3}\ {2}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}  last ← (n − 1) uh‾anoi 3 2 1 s‾elect pegs\ \ {\mathrm{last}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {3}\ {2}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{pegs}}
42 first c_at (1 2 r_eshape 2 t_ake pegs) c_at last\ \ {\mathrm{first}}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{pegs}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{last}}  first c‾at (1 2 r‾eshape 2 t‾ake pegs) c‾at last\ \ {\mathrm{first}}\ {\mathrm{\underline{c}at}}\ {(}{1}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{pegs}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{last}}
43}{\}}}{\}}
443 u:h_anoi 1 3 2{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}3 uh‾anoi 1 3 2{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}
79'{ t_ally _r u:h_anoi 1 3 2 } e_ach r_ange 10{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {10}’{ t‾ally _r uh‾anoi 1 3 2 } e‾ach r‾ange 10{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {10}
105u:m_v := { from to -> 1 2 r_eshape from c_at to }{{}^{\mathrm{u}}\mathrm{\underline{m}v}}\ {\leftarrow}\ {\{}\ {\mathrm{from}}\ {\mathrm{to}}\ {\to}\ {1}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{from}}\ {\mathrm{\underline{c}at}}\ {\mathrm{to}}\ {\}}um‾v ← { from to → 1 2 r‾eshape from c‾at to }{{}^{\mathrm{u}}\mathrm{\underline{m}v}}\ {\leftarrow}\ {\{}\ {\mathrm{from}}\ {\mathrm{to}}\ {\to}\ {1}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{from}}\ {\mathrm{\underline{c}at}}\ {\mathrm{to}}\ {\}}
106u:h_ := { n from to via ->{{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{from}}\ {\mathrm{to}}\ {\mathrm{via}}\ {\to}uh‾ ← { n from to via →{{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{from}}\ {\mathrm{to}}\ {\mathrm{via}}\ {\to}
107 n = 0 ? 0 2 r_eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}  n = 0 ? 0 2 r‾eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}
108 a := (((n - 1) u:h_ from)_ via)_ to\ \ {\mathrm{a}}\ {\leftarrow}\ {(}{(}{(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\mathrm{from}}{)}{\_}\ {\mathrm{via}}{)}{\_}\ {\mathrm{to}}  a ← (((n − 1) uh‾ from)_ via)_ to\ \ {\mathrm{a}}\ {\leftarrow}\ {(}{(}{(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\mathrm{from}}{)}{\_}\ {\mathrm{via}}{)}{\_}\ {\mathrm{to}}
109 b := (((n - 1) u:h_ via)_ to)_ from\ \ {\mathrm{b}}\ {\leftarrow}\ {(}{(}{(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\mathrm{via}}{)}{\_}\ {\mathrm{to}}{)}{\_}\ {\mathrm{from}}  b ← (((n − 1) uh‾ via)_ to)_ from\ \ {\mathrm{b}}\ {\leftarrow}\ {(}{(}{(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\mathrm{via}}{)}{\_}\ {\mathrm{to}}{)}{\_}\ {\mathrm{from}}
110 a c_at (from u:m_v to) c_at b\ \ {\mathrm{a}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{from}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}v}}\ {\mathrm{to}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{b}}  a c‾at (from um‾v to) c‾at b\ \ {\mathrm{a}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{from}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}v}}\ {\mathrm{to}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{b}}
111}{\}}}{\}}
112((3 u:h_ 1)_ 3)_ 2{(}{(}{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {1}{)}{\_}\ {3}{)}{\_}\ {2}((3 uh‾ 1)_ 3)_ 2{(}{(}{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {1}{)}{\_}\ {3}{)}{\_}\ {2}
141"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
142u:h_c := { n from to via ->{{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{from}}\ {\mathrm{to}}\ {\mathrm{via}}\ {\to}uh‾c ← { n from to via →{{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{from}}\ {\mathrm{to}}\ {\mathrm{via}}\ {\to}
143 n = 0 ? 0 2 r_eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}  n = 0 ? 0 2 r‾eshape 0\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}
144 m_ove := (n - 1) u:h_c from\ \ {\mathrm{\underline{m}ove}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {\mathrm{from}}  m‾ove ← (n − 1) uh‾c from\ \ {\mathrm{\underline{m}ove}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {\mathrm{from}}
145 b_ack := (n - 1) u:h_c via\ \ {\mathrm{\underline{b}ack}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {\mathrm{via}}  b‾ack ← (n − 1) uh‾c via\ \ {\mathrm{\underline{b}ack}}\ {\leftarrow}\ {(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {\mathrm{via}}
146 (to 'm_ove c:C_ via) c_at (from u:m_v to) c_at to b_ack from\ \ {(}{\mathrm{to}}\ {\text{'}}{\mathrm{\underline{m}ove}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {\mathrm{via}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{from}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}v}}\ {\mathrm{to}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{to}}\ {\mathrm{\underline{b}ack}}\ {\mathrm{from}}  (to ’m‾ove cC‾ via) c‾at (from um‾v to) c‾at to b‾ack from\ \ {(}{\mathrm{to}}\ {\text{'}}{\mathrm{\underline{m}ove}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {\mathrm{via}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{from}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}v}}\ {\mathrm{to}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{to}}\ {\mathrm{\underline{b}ack}}\ {\mathrm{from}}
147}{\}}}{\}}
148(((6 u:h_c 1)_ 3)_ 2) m_atch 6 u:h_anoi 1 3 2{(}{(}{(}{6}\ {{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {1}{)}{\_}\ {3}{)}{\_}\ {2}{)}\ {\mathrm{\underline{m}atch}}\ {6}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}(((6 uh‾c 1)_ 3)_ 2) m‾atch 6 uh‾anoi 1 3 2{(}{(}{(}{6}\ {{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {1}{)}{\_}\ {3}{)}{\_}\ {2}{)}\ {\mathrm{\underline{m}atch}}\ {6}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}
182k := r_ange 7{\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {7}k ← r‾ange 7{\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {7}
1830 = k 'm_od t_able 2 ^ r_ange 3{0}\ {=}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ange}}\ {3}0 = k ’m‾od t‾able 2 ^ r‾ange 3{0}\ {=}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ange}}\ {3}
184'+ r_/_2 0 = k 'm_od t_able 2 ^ r_ange 3{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ange}}\ {3}’+ r‾/2 0 = k ’m‾od t‾able 2 ^ r‾ange 3{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ange}}\ {3}
222u:m_oves := { n ->{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}um‾oves ← { n →{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
223 k := r_ange (2 ^ n) - 1\ \ {\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {(}{2}\ {\mathbin{\hat{}}}\ {\mathrm{n}}{)}\ {-}\ {1}  k ← r‾ange (2 ^ n) − 1\ \ {\mathrm{k}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {(}{2}\ {\mathbin{\hat{}}}\ {\mathrm{n}}{)}\ {-}\ {1}
224 d := 1 + '+ r_/_2 0 = k 'm_od t_able 2 ^ r_ange n\ \ {\mathrm{d}}\ {\leftarrow}\ {1}\ {+}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  d ← 1 + ’+ r‾/2 0 = k ’m‾od t‾able 2 ^ r‾ange n\ \ {\mathrm{d}}\ {\leftarrow}\ {1}\ {+}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {0}\ {=}\ {\mathrm{k}}\ {\text{'}}{\mathrm{\underline{m}od}}\ {\mathrm{\underline{t}able}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
225 m := k d_iv 2 ^ d\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{k}}\ {\mathrm{\underline{d}iv}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{d}}  m ← k d‾iv 2 ^ d\ \ {\mathrm{m}}\ {\leftarrow}\ {\mathrm{k}}\ {\mathrm{\underline{d}iv}}\ {2}\ {\mathbin{\hat{}}}\ {\mathrm{d}}
226 s := 1 + 0 = (n - d) m_od 2\ \ {\mathrm{s}}\ {\leftarrow}\ {1}\ {+}\ {0}\ {=}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{d}}{)}\ {\mathrm{\underline{m}od}}\ {2}  s ← 1 + 0 = (n − d) m‾od 2\ \ {\mathrm{s}}\ {\leftarrow}\ {1}\ {+}\ {0}\ {=}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{d}}{)}\ {\mathrm{\underline{m}od}}\ {2}
227 from := 1 + (s * m) m_od 3\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{s}}\ {\times}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}od}}\ {3}  from ← 1 + (s × m) m‾od 3\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{s}}\ {\times}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}od}}\ {3}
228 to := 1 + (s * m + 1) m_od 3\ \ {\mathrm{to}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{s}}\ {\times}\ {\mathrm{m}}\ {+}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {3}  to ← 1 + (s × m + 1) m‾od 3\ \ {\mathrm{to}}\ {\leftarrow}\ {1}\ {+}\ {(}{\mathrm{s}}\ {\times}\ {\mathrm{m}}\ {+}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {3}
229 o_\ (2 c_at t_ally from) r_eshape from c_at to\ \ {\mathrm{\underline{o}}{\backslash}}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{from}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{from}}\ {\mathrm{\underline{c}at}}\ {\mathrm{to}}  o‾\ (2 c‾at t‾ally from) r‾eshape from c‾at to\ \ {\mathrm{\underline{o}}{\backslash}}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{from}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{from}}\ {\mathrm{\underline{c}at}}\ {\mathrm{to}}
230}{\}}}{\}}
231u:m_oves 3{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {3}um‾oves 3{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {3}
251'{ (u:m_oves _r) m_atch _r u:h_anoi 1 3 2 } e_ach r_ange 10{\text{'}}{\{}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {\_\mathrm{r}}{)}\ {\mathrm{\underline{m}atch}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {10}’{ (um‾oves _r) m‾atch _r uh‾anoi 1 3 2 } e‾ach r‾ange 10{\text{'}}{\{}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {\_\mathrm{r}}{)}\ {\mathrm{\underline{m}atch}}\ {\_\mathrm{r}}\ {{}^{\mathrm{u}}\mathrm{\underline{h}anoi}}\ {1}\ {3}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {10}
291u:m_ove := { p m ->{{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{m}}\ {\to}um‾ove ← { p m →{{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{m}}\ {\to}
292 from := 1 s_elect m\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}  from ← 1 s‾elect m\ \ {\mathrm{from}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
293 disk := p i_ndexOf from\ \ {\mathrm{disk}}\ {\leftarrow}\ {\mathrm{p}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{from}}  disk ← p i‾ndexOf from\ \ {\mathrm{disk}}\ {\leftarrow}\ {\mathrm{p}}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{from}}
294 p + ((2 s_elect m) - from) * disk = r_ange t_ally p\ \ {\mathrm{p}}\ {+}\ {(}{(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {-}\ {\mathrm{from}}{)}\ {\times}\ {\mathrm{disk}}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}  p + ((2 s‾elect m) − from) × disk = r‾ange t‾ally p\ \ {\mathrm{p}}\ {+}\ {(}{(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}{)}\ {-}\ {\mathrm{from}}{)}\ {\times}\ {\mathrm{disk}}\ {=}\ {\mathrm{\underline{r}ange}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}
295}{\}}}{\}}
296u:s_lots := { p ->{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}us‾lots ← { p →{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}
297 n := t_ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}  n ← t‾ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}
298 (r_ange n) '{ r j -> r s_elect (0 - n) t_ake 0 c_at w_here p = j } t_able 1 2 3\ \ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\mathrm{r}}\ {\mathrm{j}}\ {\to}\ {\mathrm{r}}\ {\mathrm{\underline{s}elect}}\ {(}{0}\ {-}\ {\mathrm{n}}{)}\ {\mathrm{\underline{t}ake}}\ {0}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{w}here}}\ {\mathrm{p}}\ {=}\ {\mathrm{j}}\ {\}}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}  (r‾ange n) ’{ r j → r s‾elect (0 − n) t‾ake 0 c‾at w‾here p = j } t‾able 1 2 3\ \ {(}{\mathrm{\underline{r}ange}}\ {\mathrm{n}}{)}\ {\text{'}}{\{}\ {\mathrm{r}}\ {\mathrm{j}}\ {\to}\ {\mathrm{r}}\ {\mathrm{\underline{s}elect}}\ {(}{0}\ {-}\ {\mathrm{n}}{)}\ {\mathrm{\underline{t}ake}}\ {0}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{w}here}}\ {\mathrm{p}}\ {=}\ {\mathrm{j}}\ {\}}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}
299}{\}}}{\}}
300u:p_icture := { p ->{{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}up‾icture ← { p →{{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\to}
301 n := t_ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}  n ← t‾ally p\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{\underline{t}ally}}\ {\mathrm{p}}
302 w := 1 + 2 * n\ \ {\mathrm{w}}\ {\leftarrow}\ {1}\ {+}\ {2}\ {\times}\ {\mathrm{n}}  w ← 1 + 2 × n\ \ {\mathrm{w}}\ {\leftarrow}\ {1}\ {+}\ {2}\ {\times}\ {\mathrm{n}}
303 bars := (u:s_lots p) '{ s x -> s > a_bs x } t_able (o_ffsets w) - n\ \ {\mathrm{bars}}\ {\leftarrow}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\mathrm{p}}{)}\ {\text{'}}{\{}\ {\mathrm{s}}\ {\mathrm{x}}\ {\to}\ {\mathrm{s}}\ {>}\ {\mathrm{\underline{a}bs}}\ {\mathrm{x}}\ {\}}\ {\mathrm{\underline{t}able}}\ {(}{\mathrm{\underline{o}ffsets}}\ {\mathrm{w}}{)}\ {-}\ {\mathrm{n}}  bars ← (us‾lots p) ’{ s x → s > a‾bs x } t‾able (o‾ffsets w) − n\ \ {\mathrm{bars}}\ {\leftarrow}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}lots}}\ {\mathrm{p}}{)}\ {\text{'}}{\{}\ {\mathrm{s}}\ {\mathrm{x}}\ {\to}\ {\mathrm{s}}\ {>}\ {\mathrm{\underline{a}bs}}\ {\mathrm{x}}\ {\}}\ {\mathrm{\underline{t}able}}\ {(}{\mathrm{\underline{o}ffsets}}\ {\mathrm{w}}{)}\ {-}\ {\mathrm{n}}
304 (n c_at 3 * w) r_eshape r_avel bars\ \ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {3}\ {\times}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{bars}}  (n c‾at 3 × w) r‾eshape r‾avel bars\ \ {(}{\mathrm{n}}\ {\mathrm{\underline{c}at}}\ {3}\ {\times}\ {\mathrm{w}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}avel}}\ {\mathrm{bars}}
305}{\}}}{\}}
306u:p_lane := { m -> (1 c_at s_hape m) r_eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}up‾lane ← { m → (1 c‾at s‾hape m) r‾eshape m }{{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {(}{1}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{m}}\ {\}}
307u:p_lay := { p moves ->{{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{moves}}\ {\to}up‾lay ← { p moves →{{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{p}}\ {\mathrm{moves}}\ {\to}
308 frame := u:p_lane u:p_icture p\ \ {\mathrm{frame}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{p}}  frame ← up‾lane up‾icture p\ \ {\mathrm{frame}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lane}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{p}}
309 0 = t_ally moves ? frame\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{moves}}\ {?}\ {\mathrm{frame}}  0 = t‾ally moves ? frame\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{moves}}\ {?}\ {\mathrm{frame}}
310 frame c_at (p u:m_ove f_irst moves) u:p_lay 1 d_rop moves\ \ {\mathrm{frame}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{p}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{moves}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{moves}}  frame c‾at (p um‾ove f‾irst moves) up‾lay 1 d‾rop moves\ \ {\mathrm{frame}}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{p}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{moves}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{moves}}
311}{\}}}{\}}
321watched := []S_HOW []G_RID (4 r_eshape 1) u:p_lay u:m_oves 4{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{4}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {4}watched ← □S‾HOW □G‾RID (4 r‾eshape 1) up‾lay um‾oves 4{\mathrm{watched}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {(}{4}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{p}lay}}\ {{}^{\mathrm{u}}\mathrm{\underline{m}oves}}\ {4}

docs/literate/hello.org

46"h:" u_se< "Hello"{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}"h:" u‾se< "Hello"{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}
47h:h_ello @{{}^{\mathrm{h}}\mathrm{\underline{h}ello}}\ {@}hh‾ello @{{}^{\mathrm{h}}\mathrm{\underline{h}ello}}\ {@}
117"g:" u_se< "Greetings"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Greetings"}}"g:" u‾se< "Greetings"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Greetings"}}
118g:g_reet "hi"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"hi"}}gg‾reet "hi"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"hi"}}
119g:g_reet "welcome to"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"welcome to"}}gg‾reet "welcome to"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"welcome to"}}

docs/literate/libraries.org

32"s:" u_se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
33s:m_ean 1 2 3 4{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}\ {4}sm‾ean 1 2 3 4{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}\ {4}
49s:v_ariance 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{v}ariance}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}sv‾ariance 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{v}ariance}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}
50s:s_d 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}ss‾d 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}
51s:r_ange 3 9 1 7{{}^{\mathrm{s}}\mathrm{\underline{r}ange}}\ {3}\ {9}\ {1}\ {7}sr‾ange 3 9 1 7{{}^{\mathrm{s}}\mathrm{\underline{r}ange}}\ {3}\ {9}\ {1}\ {7}
75"m:" u_se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}"m:" u‾se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}
76u:d_iv := { a b -> b = 0 ? 'm:n_othing; m:j_ust a / b }{{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{b}}\ {=}\ {0}\ {?}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}{\diamond}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\mathrm{a}}\ {\div}\ {\mathrm{b}}\ {\}}ud‾iv ← { a b → b = 0 ? ’mn‾othing⋄ mj‾ust a ÷ b }{{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{b}}\ {=}\ {0}\ {?}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}{\diamond}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\mathrm{a}}\ {\div}\ {\mathrm{b}}\ {\}}
77-1 m:o_r 100 u:d_iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}−1 mo‾r 100 ud‾iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}
78-1 m:o_r 100 u:d_iv 0{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}−1 mo‾r 100 ud‾iv 0{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}
95u:h_alf := { m:j_ust _r / 2 }{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\_\mathrm{r}}\ {\div}\ {2}\ {\}}uh‾alf ← { mj‾ust _r ÷ 2 }{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\_\mathrm{r}}\ {\div}\ {2}\ {\}}
96-1 m:o_r 'u:h_alf m:b_ind 100 u:d_iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}−1 mo‾r ’uh‾alf mb‾ind 100 ud‾iv 4{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {4}
97-1 m:o_r 'u:h_alf m:b_ind 100 u:d_iv 0{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}−1 mo‾r ’uh‾alf mb‾ind 100 ud‾iv 0{-1}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {100}\ {{}^{\mathrm{u}}\mathrm{\underline{d}iv}}\ {0}
119"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
1201 c:K_ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}1 cK‾ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}
12110 '- c:C_ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}10 ’− cC‾ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}
122'n_eg 'r_ev c:B_ 1 2 3{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {1}\ {2}\ {3}’n‾eg ’r‾ev cB‾ 1 2 3{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {1}\ {2}\ {3}
150"t:" u_se< "Turtle"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Turtle"}}"t:" u‾se< "Turtle"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Turtle"}}
151t:p_olygon 4{{}^{\mathrm{t}}\mathrm{\underline{p}olygon}}\ {4}tp‾olygon 4{{}^{\mathrm{t}}\mathrm{\underline{p}olygon}}\ {4}
152f_loor 0.5 + t:p_oints t:p_olygon 4{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {{}^{\mathrm{t}}\mathrm{\underline{p}olygon}}\ {4}f‾loor 0.5 + tp‾oints tp‾olygon 4{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {{}^{\mathrm{t}}\mathrm{\underline{p}olygon}}\ {4}

docs/literate/life.org

27blinker := 5 5 r_eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{\mathrm{blinker}}\ {\leftarrow}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}blinker ← 5 5 r‾eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{\mathrm{blinker}}\ {\leftarrow}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
28blinker{\mathrm{blinker}}blinker{\mathrm{blinker}}
50s_hape -1 0 1 o_-_12 blinker{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{blinker}}s‾hape −1 0 1 o‾−12 blinker{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{blinker}}
66'+ r_/_12 -1 0 1 o_-_12 blinker{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{blinker}}’+ r‾/12 −1 0 1 o‾−12 blinker{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{blinker}}
90u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}
91u:l_ife blinker{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{blinker}}ul‾ife blinker{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{blinker}}
110(u:l_ife^2 blinker) m_atch blinker{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{2}\ {\mathrm{blinker}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{blinker}}(ul‾ife2 blinker) m‾atch blinker{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{2}\ {\mathrm{blinker}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{blinker}}
126glider := 6 6 r_eshape 0 1 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0{\mathrm{glider}}\ {\leftarrow}\ {6}\ {6}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}glider ← 6 6 r‾eshape 0 1 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0{\mathrm{glider}}\ {\leftarrow}\ {6}\ {6}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {1}\ {1}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
127u:l_ife^4 glider{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{4}\ {\mathrm{glider}}ul‾ife4 glider{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{4}\ {\mathrm{glider}}
146(u:l_ife^4 glider) m_atch -1 o_-_2 -1 o_-_1 glider{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{4}\ {\mathrm{glider}}{)}\ {\mathrm{\underline{m}atch}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{glider}}(ul‾ife4 glider) m‾atch −1 o‾−2 −1 o‾−1 glider{(}{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}^{4}\ {\mathrm{glider}}{)}\ {\mathrm{\underline{m}atch}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {-1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{glider}}

docs/literate/macros.org

37x := -3{\mathrm{x}}\ {\leftarrow}\ {-3}x ← −3{\mathrm{x}}\ {\leftarrow}\ {-3}
38"x > 0" i_f< "1; -1"{\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}"x > 0" i‾f< "1; -1"{\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}
3910 * "x > 0" i_f< "1; -1"{10}\ {\times}\ {\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}10 × "x > 0" i‾f< "1; -1"{10}\ {\times}\ {\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}
40"x < 0" i_f< "0; 1 / 0"{\text{"x < 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"0; 1 / 0"}}"x < 0" i‾f< "0; 1 / 0"{\text{"x < 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"0; 1 / 0"}}
75n := 4{\mathrm{n}}\ {\leftarrow}\ {4}n ← 4{\mathrm{n}}\ {\leftarrow}\ {4}
76"n = 0" u_nless< "p_rint! 100 / n"{\text{"n = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / n"}}"n = 0" u‾nless< "p_rint! 100 / n"{\text{"n = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / n"}}
99"m_ax m_in" e_ach< "u:$w/ := { '$w r_/ _r }"{\text{"m\_ax m\_in"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"u:\$w/ := \{ '\$w r\_/ \_r \}"}}"m_ax m_in" e‾ach< "u:$w/ := { ’$w r_/ _r }"{\text{"m\_ax m\_in"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"u:\$w/ := \{ '\$w r\_/ \_r \}"}}
100u:m_ax/ 3 1 4 1 5{{}^{\mathrm{u}}\mathrm{\underline{m}ax}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}um‾ax/ 3 1 4 1 5{{}^{\mathrm{u}}\mathrm{\underline{m}ax}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}
101u:m_in/ 3 1 4 1 5{{}^{\mathrm{u}}\mathrm{\underline{m}in}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}um‾in/ 3 1 4 1 5{{}^{\mathrm{u}}\mathrm{\underline{m}in}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}
124v := 3 1 2{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {2}v ← 3 1 2{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {2}
125@ f_ormat< "v = {v}, its sum {'+ r_/ v}, sorted? {v m_atch s_ort v}, {{braces}}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"v = \{v\}, its sum \{'+ r\_/ v\}, sorted? \{v m\_atch s\_ort v\}, \{\{braces\}\}"}}@ f‾ormat< "v = {v}, its sum {’+ r_/ v}, sorted? {v m_atch s_ort v}, {{braces}}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"v = \{v\}, its sum \{'+ r\_/ v\}, sorted? \{v m\_atch s\_ort v\}, \{\{braces\}\}"}}
189@ c_fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}@ c‾fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}
190@ c_fg< "web"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"web"}}@ c‾fg< "web"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"web"}}
223"m:" u_se< "Macros"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"m:" u‾se< "Macros"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
224"s_quare" m:d_ef< "_r * _r"{\text{"s\_quare"}}\ {{}^{\mathrm{m}}\mathrm{\underline{d}ef}{<}}\ {\text{"\_r * \_r"}}"s_quare" md‾ef< "_r * _r"{\text{"s\_quare"}}\ {{}^{\mathrm{m}}\mathrm{\underline{d}ef}{<}}\ {\text{"\_r * \_r"}}
225u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}
226"4 = 2 + 2" m:c_heck< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{c}heck}{<}}\ {\text{"addition"}}"4 = 2 + 2" mc‾heck< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{c}heck}{<}}\ {\text{"addition"}}
227"5 = 2 * 2" m:c_heck< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{c}heck}{<}}\ {\text{"doubling"}}"5 = 2 * 2" mc‾heck< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{c}heck}{<}}\ {\text{"doubling"}}

docs/literate/rosetta.org

42"st:" u_se< "Stone"{\text{"st:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stone"}}"st:" u‾se< "Stone"{\text{"st:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stone"}}
43"v:" u_se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}"v:" u‾se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}
44"g:" u_se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}"g:" u‾se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}
45s_hape 1 st:r_ing 0.0 0.0{\mathrm{\underline{s}hape}}\ {1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}s‾hape 1 str‾ing 0.0 0.0{\mathrm{\underline{s}hape}}\ {1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}
46s_hape (1 st:r_ing 0.0 0.0) c_at -1 st:r_ing 0.0 0.0{\mathrm{\underline{s}hape}}\ {(}{1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}s‾hape (1 str‾ing 0.0 0.0) c‾at −1 str‾ing 0.0 0.0{\mathrm{\underline{s}hape}}\ {(}{1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}
63f_loor 0.5 + st:s_creen 1 s_elect 1 st:r_ing 0.0 0.0{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{st}}\mathrm{\underline{s}creen}}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}f‾loor 0.5 + sts‾creen 1 s‾elect 1 str‾ing 0.0 0.0{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{st}}\mathrm{\underline{s}creen}}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}
97u:f_ace := { title code -> (e_nclose "#fdfcfa") c_at (e_nclose v:e_scape title) c_at e_nclose "#1d4ed8" v:s_pan code }{{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {\leftarrow}\ {\{}\ {\mathrm{title}}\ {\mathrm{code}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"\#fdfcfa"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {{}^{\mathrm{v}}\mathrm{\underline{e}scape}}\ {\mathrm{title}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"\#1d4ed8"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}pan}}\ {\mathrm{code}}\ {\}}uf‾ace ← { title code → (e‾nclose "#fdfcfa") c‾at (e‾nclose ve‾scape title) c‾at e‾nclose "#1d4ed8" vs‾pan code }{{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {\leftarrow}\ {\{}\ {\mathrm{title}}\ {\mathrm{code}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"\#fdfcfa"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {{}^{\mathrm{v}}\mathrm{\underline{e}scape}}\ {\mathrm{title}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"\#1d4ed8"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}pan}}\ {\mathrm{code}}\ {\}}
98names := (e_nclose "front") c_at (e_nclose "right") c_at (e_nclose "back") c_at (e_nclose "left") c_at (e_nclose "lid") c_at e_nclose "floor"{\mathrm{names}}\ {\leftarrow}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"front"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"right"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"back"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"left"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"lid"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"floor"}}names ← (e‾nclose "front") c‾at (e‾nclose "right") c‾at (e‾nclose "back") c‾at (e‾nclose "left") c‾at (e‾nclose "lid") c‾at e‾nclose "floor"{\mathrm{names}}\ {\leftarrow}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"front"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"right"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"back"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"left"}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"lid"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"floor"}}
99u:o_ne := { k halves ->{{}^{\mathrm{u}}\mathrm{\underline{o}ne}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{halves}}\ {\to}uo‾ne ← { k halves →{{}^{\mathrm{u}}\mathrm{\underline{o}ne}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\mathrm{halves}}\ {\to}
100 half := "k <= 6" i_f< "\"top\"; \"bottom\""\ \ {\mathrm{half}}\ {\leftarrow}\ {\text{"k <= 6"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"top\textbackslash{}"; \textbackslash{}"bottom\textbackslash{}""}}  half ← "k <= 6" i‾f< "\"top\"; \"bottom\""\ \ {\mathrm{half}}\ {\leftarrow}\ {\text{"k <= 6"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"\textbackslash{}"top\textbackslash{}"; \textbackslash{}"bottom\textbackslash{}""}}
101 side := d_isclose (1 + (k - 1) m_od 6) s_elect names\ \ {\mathrm{side}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{1}\ {+}\ {(}{\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {6}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{names}}  side ← d‾isclose (1 + (k − 1) m‾od 6) s‾elect names\ \ {\mathrm{side}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{1}\ {+}\ {(}{\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{m}od}}\ {6}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{names}}
102 (half u:f_ace side) st:p_anel k s_elect halves\ \ {(}{\mathrm{half}}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {\mathrm{side}}{)}\ {{}^{\mathrm{st}}\mathrm{\underline{p}anel}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{halves}}  (half uf‾ace side) stp‾anel k s‾elect halves\ \ {(}{\mathrm{half}}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ace}}\ {\mathrm{side}}{)}\ {{}^{\mathrm{st}}\mathrm{\underline{p}anel}}\ {\mathrm{k}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{halves}}
103}{\}}}{\}}
104u:p_anels := { halves -> d_isclose '{ x y -> e_nclose (d_isclose x) c_at d_isclose y } r_/ '{ k -> k u:o_ne halves } m_ap st:p_ainting halves }{{}^{\mathrm{u}}\mathrm{\underline{p}anels}}\ {\leftarrow}\ {\{}\ {\mathrm{halves}}\ {\to}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}ne}}\ {\mathrm{halves}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {{}^{\mathrm{st}}\mathrm{\underline{p}ainting}}\ {\mathrm{halves}}\ {\}}up‾anels ← { halves → d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at d‾isclose y } r‾/ ’{ k → k uo‾ne halves } m‾ap stp‾ainting halves }{{}^{\mathrm{u}}\mathrm{\underline{p}anels}}\ {\leftarrow}\ {\{}\ {\mathrm{halves}}\ {\to}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}ne}}\ {\mathrm{halves}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {{}^{\mathrm{st}}\mathrm{\underline{p}ainting}}\ {\mathrm{halves}}\ {\}}
105u:p_icture := { halves -> (st:size c_at st:size) v:p_icture u:p_anels halves }{{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{halves}}\ {\to}\ {(}{{}^{\mathrm{st}}\mathrm{size}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{st}}\mathrm{size}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}icture}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}anels}}\ {\mathrm{halves}}\ {\}}up‾icture ← { halves → (stsize c‾at stsize) vp‾icture up‾anels halves }{{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\leftarrow}\ {\{}\ {\mathrm{halves}}\ {\to}\ {(}{{}^{\mathrm{st}}\mathrm{size}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{st}}\mathrm{size}}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}icture}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}anels}}\ {\mathrm{halves}}\ {\}}
106rest := (1 st:r_ing 0.0 0.0) c_at -1 st:r_ing 0.0 0.0{\mathrm{rest}}\ {\leftarrow}\ {(}{1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}rest ← (1 str‾ing 0.0 0.0) c‾at −1 str‾ing 0.0 0.0{\mathrm{rest}}\ {\leftarrow}\ {(}{1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}
107t_ally u:p_icture rest{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{rest}}t‾ally up‾icture rest{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{rest}}
118shown := []S_HOW u:p_icture rest{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{rest}}shown ← □S‾HOW up‾icture rest{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{rest}}
143turned := (1 st:r_ing 45.0 0.0) c_at -1 st:r_ing 0.0 0.0{\mathrm{turned}}\ {\leftarrow}\ {(}{1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {45.0}\ {0.0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}turned ← (1 str‾ing 45.0 0.0) c‾at −1 str‾ing 0.0 0.0{\mathrm{turned}}\ {\leftarrow}\ {(}{1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {45.0}\ {0.0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {0.0}
144shown := []S_HOW u:p_icture turned{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{turned}}shown ← □S‾HOW up‾icture turned{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{turned}}
160rolled := (1 st:r_ing 0.0 45.0) c_at -1 st:r_ing 0.0 45.0{\mathrm{rolled}}\ {\leftarrow}\ {(}{1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {45.0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {45.0}rolled ← (1 str‾ing 0.0 45.0) c‾at −1 str‾ing 0.0 45.0{\mathrm{rolled}}\ {\leftarrow}\ {(}{1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {45.0}{)}\ {\mathrm{\underline{c}at}}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {0.0}\ {45.0}
161shown := []S_HOW u:p_icture rolled{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{rolled}}shown ← □S‾HOW up‾icture rolled{\mathrm{shown}}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{rolled}}
185angles := 0.0 30.0 89.0 90.0 135.0 180.0 -45.0{\mathrm{angles}}\ {\leftarrow}\ {0.0}\ {30.0}\ {89.0}\ {90.0}\ {135.0}\ {180.0}\ {-45.0}angles ← 0.0 30.0 89.0 90.0 135.0 180.0 −45.0{\mathrm{angles}}\ {\leftarrow}\ {0.0}\ {30.0}\ {89.0}\ {90.0}\ {135.0}\ {180.0}\ {-45.0}
186'st:p_art e_ach angles{\text{'}}{{}^{\mathrm{st}}\mathrm{\underline{p}art}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}’stp‾art e‾ach angles{\text{'}}{{}^{\mathrm{st}}\mathrm{\underline{p}art}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}
187'st:b_ase e_ach angles{\text{'}}{{}^{\mathrm{st}}\mathrm{\underline{b}ase}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}’stb‾ase e‾ach angles{\text{'}}{{}^{\mathrm{st}}\mathrm{\underline{b}ase}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}
212"cm:" u_se< "Comparison"{\text{"cm:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Comparison"}}"cm:" u‾se< "Comparison"{\text{"cm:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Comparison"}}
213s0 := 31 cm:s_tart 7{\mathrm{s0}}\ {\leftarrow}\ {31}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tart}}\ {7}s0 ← 31 cms‾tart 7{\mathrm{s0}}\ {\leftarrow}\ {31}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tart}}\ {7}
214s0{\mathrm{s0}}s0{\mathrm{s0}}
240chosen := (cm:TOP c_at 7.0) cm:c_hoose s0{\mathrm{chosen}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {7.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s0}}chosen ← (cmTOP c‾at 7.0) cmc‾hoose s0{\mathrm{chosen}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {7.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s0}}
241cm:TOP cm:c_urrent chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{chosen}}cmTOP cmc‾urrent chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{chosen}}
242(cm:TOP c_at cm:STEPS) cm:a_t chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{STEPS}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{chosen}}(cmTOP c‾at cmSTEPS) cma‾t chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{STEPS}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{chosen}}
243(cm:TOP c_at cm:ANGLE) cm:a_t chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{chosen}}(cmTOP c‾at cmANGLE) cma‾t chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {\mathrm{chosen}}
244(cm:TOP c_at cm:ANGLE) cm:a_t 0.1 cm:t_ick chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{chosen}}(cmTOP c‾at cmANGLE) cma‾t 0.1 cmt‾ick chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{chosen}}
245(cm:TOP c_at cm:ANGLE) cm:a_t 0.1 cm:t_ick 0.1 cm:t_ick chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{chosen}}(cmTOP c‾at cmANGLE) cma‾t 0.1 cmt‾ick 0.1 cmt‾ick chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{chosen}}
246(cm:TOP c_at cm:ANGLE) cm:a_t cm:s_ettle chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}ettle}}\ {\mathrm{chosen}}(cmTOP c‾at cmANGLE) cma‾t cms‾ettle chosen{(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{ANGLE}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}t}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}ettle}}\ {\mathrm{chosen}}
274stepped := (cm:BOTTOM c_at 1.0) cm:s_tep (cm:TOP c_at 2.0) cm:c_hoose s0{\mathrm{stepped}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tep}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {2.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s0}}stepped ← (cmBOTTOM c‾at 1.0) cms‾tep (cmTOP c‾at 2.0) cmc‾hoose s0{\mathrm{stepped}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {1.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tep}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {\mathrm{\underline{c}at}}\ {2.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s0}}
275cm:BOTTOM cm:c_urrent stepped{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{stepped}}cmBOTTOM cmc‾urrent stepped{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{stepped}}
276cm:BOTTOM cm:c_urrent (cm:BOTTOM c_at 2.0) cm:c_hoose stepped{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {2.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{stepped}}cmBOTTOM cmc‾urrent (cmBOTTOM c‾at 2.0) cmc‾hoose stepped{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {\mathrm{\underline{c}at}}\ {2.0}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{stepped}}
304u:f_acing := { s -> (cm:IDIOM cm:c_urrent s) c_at (cm:TOP cm:c_urrent s) c_at cm:BOTTOM cm:c_urrent s }{{}^{\mathrm{u}}\mathrm{\underline{f}acing}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{s}}\ {\}}uf‾acing ← { s → (cmIDIOM cmc‾urrent s) c‾at (cmTOP cmc‾urrent s) c‾at cmBOTTOM cmc‾urrent s }{{}^{\mathrm{u}}\mathrm{\underline{f}acing}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {\mathrm{s}}\ {\}}
305u:d_well := { s -> cm:dwell cm:t_ick s }{{}^{\mathrm{u}}\mathrm{\underline{d}well}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {{}^{\mathrm{cm}}\mathrm{dwell}}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{s}}\ {\}}ud‾well ← { s → cmdwell cmt‾ick s }{{}^{\mathrm{u}}\mathrm{\underline{d}well}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {{}^{\mathrm{cm}}\mathrm{dwell}}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{s}}\ {\}}
306u:t_our := { n -> u:f_acing cm:s_ettle n 'u:d_well p_ower cm:r_esume s0 }{{}^{\mathrm{u}}\mathrm{\underline{t}our}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{f}acing}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}ettle}}\ {\mathrm{n}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}well}}\ {\mathrm{\underline{p}ower}}\ {{}^{\mathrm{cm}}\mathrm{\underline{r}esume}}\ {\mathrm{s0}}\ {\}}ut‾our ← { n → uf‾acing cms‾ettle n ’ud‾well p‾ower cmr‾esume s0 }{{}^{\mathrm{u}}\mathrm{\underline{t}our}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{f}acing}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}ettle}}\ {\mathrm{n}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}well}}\ {\mathrm{\underline{p}ower}}\ {{}^{\mathrm{cm}}\mathrm{\underline{r}esume}}\ {\mathrm{s0}}\ {\}}
3078 3 r_eshape d_isclose '{ x y -> e_nclose (d_isclose x) c_at d_isclose y } r_/ 'u:t_our m_ap r_ange 8{8}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{t}our}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {8}8 3 r‾eshape d‾isclose ’{ x y → e‾nclose (d‾isclose x) c‾at d‾isclose y } r‾/ ’ut‾our m‾ap r‾ange 8{8}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{d}isclose}}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{\underline{e}nclose}}\ {(}{\mathrm{\underline{d}isclose}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{t}our}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {8}

docs/literate/tour.org

3642 # an Int{42}42{42}
47-3 2.5 # a negative literal; a strand has one type (Float){-3}\ {2.5}−3 2.5{-3}\ {2.5}
59x := 3 # `:=` binds; `=` is always equality{\mathrm{x}}\ {\leftarrow}\ {3}x ← 3{\mathrm{x}}\ {\leftarrow}\ {3}
60x^2 # a literal exponent touches its value: superscript{\mathrm{x}}^{2}x2{\mathrm{x}}^{2}
714^-1 # a negative exponent gives a Float (a literal base){4}^{-1}4−1{4}^{-1}
822 ^ 10 # spaced `^` is the power function (computed exponents){2}\ {\mathbin{\hat{}}}\ {10}2 ^ 10{2}\ {\mathbin{\hat{}}}\ {10}
937 / 2 # `/` always gives a Float{7}\ {\div}\ {2}7 ÷ 2{7}\ {\div}\ {2}
1047 d_iv 2; 7 m_od 3 # integer quotient and remainder; `;` separates statements{7}\ {\mathrm{\underline{d}iv}}\ {2}{\diamond}\ {7}\ {\mathrm{\underline{m}od}}\ {3}7 d‾iv 2⋄ 7 m‾od 3{7}\ {\mathrm{\underline{d}iv}}\ {2}{\diamond}\ {7}\ {\mathrm{\underline{m}od}}\ {3}
116(0.1 + 0.2) = 0.3 # `=` is exact: 0 (false){(}{0.1}\ {+}\ {0.2}{)}\ {=}\ {0.3}(0.1 + 0.2) = 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {=}\ {0.3}
127(0.1 + 0.2) e_q~ 0.3 # tolerant equality: 1{(}{0.1}\ {+}\ {0.2}{)}\ {\mathrm{\underline{e}q}{\sim}}\ {0.3}(0.1 + 0.2) e‾q∼ 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {\mathrm{\underline{e}q}{\sim}}\ {0.3}
138(3 < 4) & 2 != 2 # Bool (`& | !=`); no precedence: parenthesize the left{(}{3}\ {<}\ {4}{)}\ {\wedge}\ {2}\ {\neq}\ {2}(3 < 4) ∧ 2 ≠ 2{(}{3}\ {<}\ {4}{)}\ {\wedge}\ {2}\ {\neq}\ {2}
149f_loat 3 # Int to Float{\mathrm{\underline{f}loat}}\ {3}f‾loat 3{\mathrm{\underline{f}loat}}\ {3}
163s_in (p_i @) / 2 # trigonometry in radians; `p_i @` is pi (niladic){\mathrm{\underline{s}in}}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {2}s‾in (p‾i @) ÷ 2{\mathrm{\underline{s}in}}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {2}
174a_tan 1 # and c_os{\mathrm{\underline{a}tan}}\ {1}a‾tan 1{\mathrm{\underline{a}tan}}\ {1}
193count! := 0 # only names ending in ! (like `count!`) may be reassigned{\mathrm{count}!}\ {\leftarrow}\ {0}count! ← 0{\mathrm{count}!}\ {\leftarrow}\ {0}
194count! := count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}count! ← count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}
195count!{\mathrm{count}!}count!{\mathrm{count}!}
211"hello"{\text{"hello"}}"hello"{\text{"hello"}}
222"abc" = "abd" # item by item{\text{"abc"}}\ {=}\ {\text{"abd"}}"abc" = "abd"{\text{"abc"}}\ {=}\ {\text{"abd"}}
2333 t_ake "hello"{3}\ {\mathrm{\underline{t}ake}}\ {\text{"hello"}}3 t‾ake "hello"{3}\ {\mathrm{\underline{t}ake}}\ {\text{"hello"}}
247"hello X̲ᵉTᵃL" # strings and comments may hold any Unicode (code may not){\text{"hello \underline{X}ᵉTᵃL"}}"hello X‾ᵉTᵃL"{\text{"hello \underline{X}ᵉTᵃL"}}
266m := 2 3 r_eshape r_ange 6 # 1-origin: `r_ange 6` is 1 2 3 4 5 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}m ← 2 3 r‾eshape r‾ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
267m{\mathrm{m}}m{\mathrm{m}}
279s_hape m; t_ally m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}{\diamond}\ {\mathrm{\underline{t}ally}}\ {\mathrm{m}}s‾hape m⋄ t‾ally m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}{\diamond}\ {\mathrm{\underline{t}ally}}\ {\mathrm{m}}
291m * 10 # a scalar extends to every item{\mathrm{m}}\ {\times}\ {10}m × 10{\mathrm{m}}\ {\times}\ {10}
3032 s_elect m # the 2nd major cell (row){2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}2 s‾elect m{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
314-1 t_ake m; 1 d_rop m # take and drop count from the end when negative{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{m}}{\diamond}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}−1 t‾ake m⋄ 1 d‾rop m{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{m}}{\diamond}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{m}}
326(f_irst m) c_at 7 8 9 # join along the leading axis{(}{\mathrm{\underline{f}irst}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {7}\ {8}\ {9}(f‾irst m) c‾at 7 8 9{(}{\mathrm{\underline{f}irst}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{c}at}}\ {7}\ {8}\ {9}
337r_avel m{\mathrm{\underline{r}avel}}\ {\mathrm{m}}r‾avel m{\mathrm{\underline{r}avel}}\ {\mathrm{m}}
34810 ^ r_ev o_ffsets 3 # `o_ffsets` counts from 0: place values 100 10 1{10}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{o}ffsets}}\ {3}10 ^ r‾ev o‾ffsets 3{10}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{o}ffsets}}\ {3}
362m c_at_2 0 9 # ... or along axis 2: a column on the right{\mathrm{m}}\ {{\mathrm{\underline{c}at}}_{2}}\ {0}\ {9}m c‾at2 0 9{\mathrm{m}}\ {{\mathrm{\underline{c}at}}_{2}}\ {0}\ {9}
3741 0 2 r_eplicate 7 8 9 # replicate: each item, as many times as its count{1}\ {0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {7}\ {8}\ {9}1 0 2 r‾eplicate 7 8 9{1}\ {0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {7}\ {8}\ {9}
38510 10 10 e_ncode 123 # encode: the digits, in the radices on the left{10}\ {10}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}10 10 10 e‾ncode 123{10}\ {10}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}
39624 60 60 d_ecode 1 2 5 # decode: 1 hour 2 minutes 5 seconds, in seconds{24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {5}24 60 60 d‾ecode 1 2 5{24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {5}
416u:s_quare := { _r * _r } # `_r` is the right argument{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}us‾quare ← { _r × _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
417u:s_quare 1 2 3 # scalar functions work on arrays unchanged{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {1}\ {2}\ {3}us‾quare 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {1}\ {2}\ {3}
429u:s_ub := { _l - _r } # `_l` is the left argument{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}us‾ub ← { _l − _r }{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}
43010 u:s_ub 3 # dyadic use is currying: `(u:s_ub 10) 3`{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}10 us‾ub 3{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}
442u:h_yp := { a b -> ((a * a) + b * b) ^ 0.5 } # named parameters before `->`{{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{(}{\mathrm{a}}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\times}\ {\mathrm{b}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}uh‾yp ← { a b → ((a × a) + b × b) ^ 0.5 }{{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{(}{\mathrm{a}}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\times}\ {\mathrm{b}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}
4433 u:h_yp 4{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {4}3 uh‾yp 4{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {4}
458u:s_ign := { x -> x < 0 ? -1; x = 0 ? 0; 1 } # guards: condition `?` result{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}us‾ign ← { x → x < 0 ? −1⋄ x = 0 ? 0⋄ 1 }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}
459u:f_act := { n ->{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}uf‾act ← { n →{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
460 n <= 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}  n ≤ 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}
461 n * u:f_act n - 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}  n × uf‾act n − 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}
462}{\}}}{\}}
472u:f_act 10 # recursion{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}uf‾act 10{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}
484u:t_wo := { @ -> 2 } # a niladic function takes `@`{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {2}\ {\}}ut‾wo ← { @ → 2 }{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {2}\ {\}}
485u:t_wo @{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {@}ut‾wo @{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {@}
497u:k_eep := { a ~b -> a } # `~b` is a lazy parameter: evaluated{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\sim}{\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\}}uk‾eep ← { a ∼b → a }{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\sim}{\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\}}
4987 u:k_eep 1 / 0 # only if used, so no division by zero{7}\ {{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {1}\ {\div}\ {0}7 uk‾eep 1 ÷ 0{7}\ {{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {1}\ {\div}\ {0}
509(u:s_ub 100)_ 1 # `(expr)_` applies a function value{(}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {100}{)}{\_}\ {1}(us‾ub 100)_ 1{(}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {100}{)}{\_}\ {1}
521u:t_wice := { f_ x -> f_ f_ x } # apply a function parameter two times{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}ut‾wice ← { f‾ x → f‾ f‾ x }{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}
522'{ _r + 10 } u:t_wice 3 # 3 + 10 + 10{\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {10}\ {\}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {3}’{ _r + 10 } ut‾wice 3{\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {10}\ {\}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {3}
533'u:s_quare u:t_wice 3 # square (square 3) = 9 squared{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {3}’us‾quare ut‾wice 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {3}
552'+ r_/ 1 2 3 4 # a quoted function is the operand of `r_/` (reduce){\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}’+ r‾/ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}
563'- r_/ 1 2 3 # reduce folds from the right: 1 - (2 - 3){\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’− r‾/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
574'+ s_\ 1 2 3 4 # scan: the prefix reductions{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}\ {4}’+ s‾\ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}\ {4}
585'+ r_/ m # the leading axis: column sums{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
596'u:s_ign e_ach -5 0 5 # each: apply to every item{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {-5}\ {0}\ {5}’us‾ign e‾ach −5 0 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {-5}\ {0}\ {5}
6071 2 3 '= e_ach 1 5 3 # dyadic each is currying{1}\ {2}\ {3}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {1}\ {5}\ {3}1 2 3 ’= e‾ach 1 5 3{1}\ {2}\ {3}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {1}\ {5}\ {3}
6181 2 3 '* t_able 1 2 3 # table: the outer product{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}1 2 3 ’× t‾able 1 2 3{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}
631m '+ '* i_nner 1 1 1 # inner product: the nearest operand pairs{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}m ’+ ’× i‾nner 1 1 1{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}
642'n_eg 'a_bs c_ompose -4 # compose: the nearest operand applies first{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-4}’n‾eg ’a‾bs c‾ompose −4{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-4}
6532 '/ s_wap 1 # swap the arguments: 1 / 2{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}2 ’÷ s‾wap 1{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}
664'{ _l + _r } r_/ 1 2 3 # a quoted lambda is an operand too{\text{'}}{\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’{ _l + _r } r‾/ 1 2 3{\text{'}}{\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
685u:a_vg := ['+ r_/ / t_ally] # fork: `('+ r_/ x) / t_ally x`{{}^{\mathrm{u}}\mathrm{\underline{a}vg}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}ua‾vg ← [’+ r‾/ ÷ t‾ally]{{}^{\mathrm{u}}\mathrm{\underline{a}vg}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}
686u:a_vg 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{a}vg}}\ {1}\ {2}\ {3}\ {4}ua‾vg 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{a}vg}}\ {1}\ {2}\ {3}\ {4}
687{ x -> ('+ r_/ x) / t_ally x } 1 2 3 4 # the same, spelled out{\{}\ {\mathrm{x}}\ {\to}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{x}}{)}\ {\div}\ {\mathrm{\underline{t}ally}}\ {\mathrm{x}}\ {\}}\ {1}\ {2}\ {3}\ {4}{ x → (’+ r‾/ x) ÷ t‾ally x } 1 2 3 4{\{}\ {\mathrm{x}}\ {\to}\ {(}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{x}}{)}\ {\div}\ {\mathrm{\underline{t}ally}}\ {\mathrm{x}}\ {\}}\ {1}\ {2}\ {3}\ {4}
699[n_eg a_bs] -5 # atop: `n_eg a_bs x`{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-5}[n‾eg a‾bs] −5{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-5}
7103 [l_eft + r_ight] 4 # dyadic fork: `(x l_eft y) + (x r_ight y)`, so `x + y`{3}\ {[}{\mathrm{\underline{l}eft}}\ {+}\ {\mathrm{\underline{r}ight}}{]}\ {4}3 [l‾eft + r‾ight] 4{3}\ {[}{\mathrm{\underline{l}eft}}\ {+}\ {\mathrm{\underline{r}ight}}{]}\ {4}
721[i_d - n_eg] 5 # hook: `x - n_eg x`{[}{\mathrm{\underline{i}d}}\ {-}\ {\mathrm{\underline{n}eg}}{]}\ {5}[i‾d − n‾eg] 5{[}{\mathrm{\underline{i}d}}\ {-}\ {\mathrm{\underline{n}eg}}{]}\ {5}
7361 2 [+ * -] 3 4 # dyadic fork: `(x + y) * (x - y)`{1}\ {2}\ {[}{+}\ {\times}\ {-}{]}\ {3}\ {4}1 2 [+ × −] 3 4{1}\ {2}\ {[}{+}\ {\times}\ {-}{]}\ {3}\ {4}
747[f_irst c_at 'm_ax r_/ c_at 'm_in r_/] 3 1 4 1 5 # `(f_irst x) c_at ('m_ax r_/ x) c_at 'm_in r_/ x`{[}{\mathrm{\underline{f}irst}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}\ {3}\ {1}\ {4}\ {1}\ {5}[f‾irst c‾at ’m‾ax r‾/ c‾at ’m‾in r‾/] 3 1 4 1 5{[}{\mathrm{\underline{f}irst}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{c}at}}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}\ {3}\ {1}\ {4}\ {1}\ {5}
758'[t_ally d_isclose] e_ach "ab" "cde" "f" # each item i: `t_ally d_isclose i`{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\text{"ab"}}\ {\text{"cde"}}\ {\text{"f"}}’[t‾ally d‾isclose] e‾ach "ab" "cde" "f"{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\text{"ab"}}\ {\text{"cde"}}\ {\text{"f"}}
7761 o_- 1 2 3 4 # rotate toward the front{1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}\ {4}1 o‾− 1 2 3 4{1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}\ {4}
787r_ev "stressed"{\mathrm{\underline{r}ev}}\ {\text{"stressed"}}r‾ev "stressed"{\mathrm{\underline{r}ev}}\ {\text{"stressed"}}
820'+ r_/ m # implicit: axis 1, so column sums{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
831'+ r_/_1 m # the same, explicit{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{m}}’+ r‾/1 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{m}}
842'+ r_/_2 m # axis 2: row sums{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}’+ r‾/2 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}
853'+ s_\_2 m # running sums along each row{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{m}}’+ s‾\2 m{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{m}}
8651 o_- m # rotate the rows (axis 1){1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{m}}1 o‾− m{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{m}}
8771 o_-_1 m # the same, explicit{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{m}}1 o‾−1 m{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{m}}
8891 o_-_2 m # rotate within each row (axis 2){1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{m}}1 o‾−2 m{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{m}}
901r_ev_2 m # reverse each row{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{m}}r‾ev2 m{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{m}}
913'+ r_/_12 m # two axes in turn: the total{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{m}}’+ r‾/12 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{m}}
924-1 0 1 o_- 1 2 3 # a list of amounts gives every rotation{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}−1 0 1 o‾− 1 2 3{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}
937s_hape -1 0 1 o_-_12 m # every combination along both axes: 3 3 2 3{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{m}}s‾hape −1 0 1 o‾−12 m{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{m}}
952o_\ m # transpose: rows become columns{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}o‾\ m{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}
968a := 2 3 4 r_eshape r_ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}a ← 2 3 4 r‾eshape r‾ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}
969s_hape o_\ a # every axis reversed: 4 3 2{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}s‾hape o‾\ a{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}
970s_hape o_\_23 a # axes 2 and 3 swapped: 2 4 3{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}s‾hape o‾\23 a{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}
971s_hape 3 1 2 t_ranspose a # axis 1 to 3, 2 to 1, 3 to 2: 3 4 2{\mathrm{\underline{s}hape}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}s‾hape 3 1 2 t‾ranspose a{\mathrm{\underline{s}hape}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}
991v := 3 1 4 1 5 9 2 6{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}v ← 3 1 4 1 5 9 2 6{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}\ {9}\ {2}\ {6}
992s_ort v; g_rade v # sort, and the indices that sort{\mathrm{\underline{s}ort}}\ {\mathrm{v}}{\diamond}\ {\mathrm{\underline{g}rade}}\ {\mathrm{v}}s‾ort v⋄ g‾rade v{\mathrm{\underline{s}ort}}\ {\mathrm{v}}{\diamond}\ {\mathrm{\underline{g}rade}}\ {\mathrm{v}}
1004u_nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}u‾nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}
1015v i_ndexOf 5 7 # 7 is absent: tally + 1{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {5}\ {7}v i‾ndexOf 5 7{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {5}\ {7}
10262 7 m_ember? v{2}\ {7}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{v}}2 7 m‾ember? v{2}\ {7}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{v}}
1037w_here v > 4 # indices of the 1s{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {4}w‾here v > 4{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {4}
1055n := "ab" "cde" # a strand of strings: a vector of 2 boxes{\mathrm{n}}\ {\leftarrow}\ {\text{"ab"}}\ {\text{"cde"}}n ← "ab" "cde"{\mathrm{n}}\ {\leftarrow}\ {\text{"ab"}}\ {\text{"cde"}}
1056n # nested values print framed (APL2's DISPLAY){\mathrm{n}}n{\mathrm{n}}
1071t_ally n{\mathrm{\underline{t}ally}}\ {\mathrm{n}}t‾ally n{\mathrm{\underline{t}ally}}\ {\mathrm{n}}
1082d_isclose 2 s_elect n # open the 2nd box{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}d‾isclose 2 s‾elect n{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{n}}
1098s := "to be or not"{\mathrm{s}}\ {\leftarrow}\ {\text{"to be or not"}}s ← "to be or not"{\mathrm{s}}\ {\leftarrow}\ {\text{"to be or not"}}
1099(s != f_irst " ") p_artition s # cut where the mask is 0: the words, boxed{(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}(s ≠ f‾irst " ") p‾artition s{(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}
1114'r_ange m_ap 1 2 3 # map: each result boxed, so it may be an array{\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}’r‾ange m‾ap 1 2 3{\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}
1132d_isplay m # any value framed, as a character matrix (xetal --box prints all so){\mathrm{\underline{d}isplay}}\ {\mathrm{m}}d‾isplay m{\mathrm{\underline{d}isplay}}\ {\mathrm{m}}
1151r_oll! 6 6 6 # three dice: random 1..6 each, so every run differs{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}r‾oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}
1162r_oll! 6 6 6 # (and each line rolls again){\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}r‾oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}
1173r_oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}r‾oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}
1184p_rint! "printed, then returned" # `p_rint!` prints and returns its argument{\mathrm{\underline{p}rint}{!}}\ {\text{"printed, then returned"}}p‾rint! "printed, then returned"{\mathrm{\underline{p}rint}{!}}\ {\text{"printed, then returned"}}
120315 t_ake []G_RID 2 2 r_eshape 1 0 0 1{15}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{\underline{G}RID}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {0}\ {0}\ {1}15 t‾ake □G‾RID 2 2 r‾eshape 1 0 0 1{15}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{\underline{G}RID}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {0}\ {0}\ {1}
1222"s:" u_se< "Stats" # import a library under an alias of your choosing{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
1223s:m_ean 2 4 4 4 5 5 7 9 # its exported names, used through the alias{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}sm‾ean 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}
1234s:s_d 2 4 4 4 5 5 7 9 # the standard deviation{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}ss‾d 2 4 4 4 5 5 7 9{{}^{\mathrm{s}}\mathrm{\underline{s}d}}\ {2}\ {4}\ {4}\ {4}\ {5}\ {5}\ {7}\ {9}
1245s:r_ange 3 1 4 1 5 # largest minus smallest{{}^{\mathrm{s}}\mathrm{\underline{r}ange}}\ {3}\ {1}\ {4}\ {1}\ {5}sr‾ange 3 1 4 1 5{{}^{\mathrm{s}}\mathrm{\underline{r}ange}}\ {3}\ {1}\ {4}\ {1}\ {5}
1259"h:" u_se< "Hello" # a library of your own, found in userlibs/{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}"h:" u‾se< "Hello"{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}
1260h:h_ello @ # niladic: called with Unit{{}^{\mathrm{h}}\mathrm{\underline{h}ello}}\ {@}hh‾ello @{{}^{\mathrm{h}}\mathrm{\underline{h}ello}}\ {@}
1281"c:" u_se< "Combinators" # Smullyan's birds, a standard library{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
12821 c:K_ 2 # K keeps its first argument{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}1 cK‾ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}
129310 '- c:C_ 3 # C swaps the arguments: 3 - 10{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}10 ’− cC‾ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}
1304'n_eg 'a_bs c:B_ -5 # B composes, the nearest operand last: a_bs n_eg -5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {-5}’n‾eg ’a‾bs cB‾ −5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {-5}
1315'* c:W_ 4 # W uses its argument twice: 4 * 4{\text{'}}{\times}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {4}’× cW‾ 4{\text{'}}{\times}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {4}
1330u:t_riangle := { ~s_elf n -> n <= 1 ? 1; n + s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {+}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}ut‾riangle ← { ∼s‾elf n → n ≤ 1 ? 1⋄ n + s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {+}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
1331'u:t_riangle c:Y_ 5 # Y: recursion, from a function handed itself: 1+2+3+4+5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {5}’ut‾riangle cY‾ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{t}riangle}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {5}
1345n_eg^3 5 # a superscript repeats a function: n_eg three times{\mathrm{\underline{n}eg}}^{3}\ {5}n‾eg3 5{\mathrm{\underline{n}eg}}^{3}\ {5}
1364u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}
1365u:l_ife 5 5 r_eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}ul‾ife 5 5 r‾eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}

docs/literate/trains.org

35"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
36u:a_b := { a b -> (10 * a) + b }{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{10}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\}}ua‾b ← { a b → (10 × a) + b }{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{10}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\}}
37u:i_nc := { _r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}ui‾nc ← { _r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}
38u:d_ouble := { _r * 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}ud‾ouble ← { _r × 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}
39u:s_quare := { _r * _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}us‾quare ← { _r × _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
57[u:i_nc u:d_ouble] 5{[}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}{]}\ {5}[ui‾nc ud‾ouble] 5{[}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}{]}\ {5}
58'u:d_ouble 'u:i_nc c:B_ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}’ud‾ouble ’ui‾nc cB‾ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}
72([u:i_nc u:d_ouble] 1 2 3) m_atch 'u:d_ouble 'u:i_nc c:B_ 1 2 3{(}{[}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}{]}\ {1}\ {2}\ {3}{)}\ {\mathrm{\underline{m}atch}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {1}\ {2}\ {3}([ui‾nc ud‾ouble] 1 2 3) m‾atch ’ud‾ouble ’ui‾nc cB‾ 1 2 3{(}{[}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}{]}\ {1}\ {2}\ {3}{)}\ {\mathrm{\underline{m}atch}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {1}\ {2}\ {3}
881 [u:i_nc u:a_b] 2{1}\ {[}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}b}}{]}\ {2}1 [ui‾nc ua‾b] 2{1}\ {[}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}b}}{]}\ {2}
891 'u:a_b 'u:i_nc c:B_1 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}1}}\ {2}1 ’ua‾b ’ui‾nc cB‾1 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}1}}\ {2}
109[i_d u:a_b u:d_ouble] 3{[}{\mathrm{\underline{i}d}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}{]}\ {3}[i‾d ua‾b ud‾ouble] 3{[}{\mathrm{\underline{i}d}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}{]}\ {3}
110'u:d_ouble 'u:a_b c:S_ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{S}}}\ {3}’ud‾ouble ’ua‾b cS‾ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{S}}}\ {3}
126[i_d u:a_b i_d] 3{[}{\mathrm{\underline{i}d}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\mathrm{\underline{i}d}}{]}\ {3}[i‾d ua‾b i‾d] 3{[}{\mathrm{\underline{i}d}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\mathrm{\underline{i}d}}{]}\ {3}
127'u:a_b c:W_ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {3}’ua‾b cW‾ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {3}
147u:P_hi := { c_ f_ g_ x -> (f_ x) c_ g_ x }{{}^{\mathrm{u}}\mathrm{\underline{P}hi}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{\underline{f}}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\}}uP‾hi ← { c‾ f‾ g‾ x → (f‾ x) c‾ g‾ x }{{}^{\mathrm{u}}\mathrm{\underline{P}hi}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{\underline{f}}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\}}
148[n_eg + u:s_quare] 1 2 3{[}{\mathrm{\underline{n}eg}}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}{]}\ {1}\ {2}\ {3}[n‾eg + us‾quare] 1 2 3{[}{\mathrm{\underline{n}eg}}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}{]}\ {1}\ {2}\ {3}
149'u:s_quare 'n_eg '+ u:P_hi 1 2 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{+}\ {{}^{\mathrm{u}}\mathrm{\underline{P}hi}}\ {1}\ {2}\ {3}’us‾quare ’n‾eg ’+ uP‾hi 1 2 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{+}\ {{}^{\mathrm{u}}\mathrm{\underline{P}hi}}\ {1}\ {2}\ {3}
164['+ r_/ / t_ally] 1 2 3 4{[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}\ {1}\ {2}\ {3}\ {4}[’+ r‾/ ÷ t‾ally] 1 2 3 4{[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}\ {1}\ {2}\ {3}\ {4}
181(c:I_ 7) = i_d 7{(}{{}^{\mathrm{c}}\mathrm{\underline{I}}}\ {7}{)}\ {=}\ {\mathrm{\underline{i}d}}\ {7}(cI‾ 7) = i‾d 7{(}{{}^{\mathrm{c}}\mathrm{\underline{I}}}\ {7}{)}\ {=}\ {\mathrm{\underline{i}d}}\ {7}
182(1 c:K_ 2) = 1 l_eft 2{(}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}{)}\ {=}\ {1}\ {\mathrm{\underline{l}eft}}\ {2}(1 cK‾ 2) = 1 l‾eft 2{(}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}{)}\ {=}\ {1}\ {\mathrm{\underline{l}eft}}\ {2}
200u:t_wice := 'u:d_ouble 'u:d_ouble c:B_{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}ut‾wice ← ’ud‾ouble ’ud‾ouble cB‾{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}
201u:t_wice 5{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {5}ut‾wice 5{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {5}
216'[t_ally d_isclose] e_ach "ab" "cde" "f"{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\text{"ab"}}\ {\text{"cde"}}\ {\text{"f"}}’[t‾ally d‾isclose] e‾ach "ab" "cde" "f"{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\text{"ab"}}\ {\text{"cde"}}\ {\text{"f"}}
217'[u:i_nc u:d_ouble] 'n_eg c:B_ 5{\text{'}}{[}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}{]}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}’[ui‾nc ud‾ouble] ’n‾eg cB‾ 5{\text{'}}{[}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}{]}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}
249[r_ev [n_eg a_bs]] -1 2 -3{[}{\mathrm{\underline{r}ev}}\ {[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}{]}\ {-1}\ {2}\ {-3}[r‾ev [n‾eg a‾bs]] −1 2 −3{[}{\mathrm{\underline{r}ev}}\ {[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}{]}\ {-1}\ {2}\ {-3}
264[[f_loat '+ r_/] / [f_loat t_ally]] 1.5 2.5{[}{[}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}{]}\ {\div}\ {[}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{t}ally}}{]}{]}\ {1.5}\ {2.5}[[f‾loat ’+ r‾/] ÷ [f‾loat t‾ally]] 1.5 2.5{[}{[}{\mathrm{\underline{f}loat}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}{]}\ {\div}\ {[}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{t}ally}}{]}{]}\ {1.5}\ {2.5}

docs/literate/tttml.org

32"t:" u_se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}"t:" u‾se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}
33t:s_how 1 -1 0 0 1 0 0 0 -1{{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {1}\ {-1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {-1}ts‾how 1 −1 0 0 1 0 0 0 −1{{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {1}\ {-1}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {-1}
53t:lines '+ '* i_nner 1 1 1 -1 -1 0 0 0 0{{}^{\mathrm{t}}\mathrm{lines}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}\ {-1}\ {-1}\ {0}\ {0}\ {0}\ {0}tlines ’+ ’× i‾nner 1 1 1 −1 −1 0 0 0 0{{}^{\mathrm{t}}\mathrm{lines}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}\ {-1}\ {-1}\ {0}\ {0}\ {0}\ {0}
70t:o_utcome 1 1 1 -1 -1 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {1}\ {1}\ {-1}\ {-1}\ {0}\ {0}\ {0}\ {0}to‾utcome 1 1 1 −1 −1 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {1}\ {1}\ {-1}\ {-1}\ {0}\ {0}\ {0}\ {0}
71t:o_utcome 1 -1 1 1 -1 -1 -1 1 1{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {-1}\ {1}\ {1}to‾utcome 1 −1 1 1 −1 −1 −1 1 1{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {-1}\ {1}\ {1}\ {-1}\ {-1}\ {-1}\ {1}\ {1}
72t:o_utcome 1 -1 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {-1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}to‾utcome 1 −1 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {1}\ {-1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
92t:b_oards t:symmetries s_elect 1 -1 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{b}oards}}\ {{}^{\mathrm{t}}\mathrm{symmetries}}\ {\mathrm{\underline{s}elect}}\ {1}\ {-1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}tb‾oards tsymmetries s‾elect 1 −1 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{b}oards}}\ {{}^{\mathrm{t}}\mathrm{symmetries}}\ {\mathrm{\underline{s}elect}}\ {1}\ {-1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
113t:c_ode 1 0 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}tc‾ode 1 0 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
114t:c_ode 0 0 1 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}tc‾ode 0 0 1 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
115t:c_ode 0 1 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}tc‾ode 0 1 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{\underline{c}ode}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
136s_hape t:empty{\mathrm{\underline{s}hape}}\ {{}^{\mathrm{t}}\mathrm{empty}}s‾hape tempty{\mathrm{\underline{s}hape}}\ {{}^{\mathrm{t}}\mathrm{empty}}
151t:empty t:v_alue 1 0 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{empty}}\ {{}^{\mathrm{t}}\mathrm{\underline{v}alue}}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}tempty tv‾alue 1 0 0 0 0 0 0 0 0{{}^{\mathrm{t}}\mathrm{empty}}\ {{}^{\mathrm{t}}\mathrm{\underline{v}alue}}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
170(9 r_eshape 0) t:a_fter 5{(}{9}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {5}(9 r‾eshape 0) ta‾fter 5{(}{9}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {5}
171t:empty t:c_hoose 9 r_eshape 0{{}^{\mathrm{t}}\mathrm{empty}}\ {{}^{\mathrm{t}}\mathrm{\underline{c}hoose}}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}tempty tc‾hoose 9 r‾eshape 0{{}^{\mathrm{t}}\mathrm{empty}}\ {{}^{\mathrm{t}}\mathrm{\underline{c}hoose}}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}
190t:b_oards t:g_ame! t:empty{{}^{\mathrm{t}}\mathrm{\underline{b}oards}}\ {{}^{\mathrm{t}}\mathrm{\underline{g}ame}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}tb‾oards tg‾ame! tempty{{}^{\mathrm{t}}\mathrm{\underline{b}oards}}\ {{}^{\mathrm{t}}\mathrm{\underline{g}ame}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}
216t:empty t:l_earn t:g_ame! t:empty{{}^{\mathrm{t}}\mathrm{empty}}\ {{}^{\mathrm{t}}\mathrm{\underline{l}earn}}\ {{}^{\mathrm{t}}\mathrm{\underline{g}ame}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}tempty tl‾earn tg‾ame! tempty{{}^{\mathrm{t}}\mathrm{empty}}\ {{}^{\mathrm{t}}\mathrm{\underline{l}earn}}\ {{}^{\mathrm{t}}\mathrm{\underline{g}ame}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}
251m := 2000 t:t_rain! t:empty{\mathrm{m}}\ {\leftarrow}\ {2000}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rain}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}m ← 2000 tt‾rain! tempty{\mathrm{m}}\ {\leftarrow}\ {2000}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rain}{!}}\ {{}^{\mathrm{t}}\mathrm{empty}}
252t_ally 1 s_elect m{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}t‾ally 1 s‾elect m{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
253m t:v_alue 1 0 0 0 0 0 0 0 0{\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{v}alue}}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}m tv‾alue 1 0 0 0 0 0 0 0 0{\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{v}alue}}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
254m t:v_alue 0 1 0 0 0 0 0 0 0{\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{v}alue}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}m tv‾alue 0 1 0 0 0 0 0 0 0{\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{v}alue}}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}
255m t:v_alue 0 0 0 0 1 0 0 0 0{\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{v}alue}}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}m tv‾alue 0 0 0 0 1 0 0 0 0{\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{v}alue}}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}
256m t:c_hoose 9 r_eshape 0{\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{c}hoose}}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}m tc‾hoose 9 r‾eshape 0{\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{c}hoose}}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}
25750 t:t_rial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rial}{!}}\ {\mathrm{m}}50 tt‾rial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{t}rial}{!}}\ {\mathrm{m}}
25850 t:s_elfTrial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{s}elfTrial}{!}}\ {\mathrm{m}}50 ts‾elfTrial! m{50}\ {{}^{\mathrm{t}}\mathrm{\underline{s}elfTrial}{!}}\ {\mathrm{m}}
259t:b_oards t:b_est m{{}^{\mathrm{t}}\mathrm{\underline{b}oards}}\ {{}^{\mathrm{t}}\mathrm{\underline{b}est}}\ {\mathrm{m}}tb‾oards tb‾est m{{}^{\mathrm{t}}\mathrm{\underline{b}oards}}\ {{}^{\mathrm{t}}\mathrm{\underline{b}est}}\ {\mathrm{m}}

docs/reference.md

11v := 3 1 2{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {2}v ← 3 1 2{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {2}
12M := 2 3 r_eshape r_ange 6{\mathrm{M}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}M ← 2 3 r‾eshape r‾ange 6{\mathrm{M}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
13N := 2 3 r_eshape 3 1 2 6 4 5{\mathrm{N}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {3}\ {1}\ {2}\ {6}\ {4}\ {5}N ← 2 3 r‾eshape 3 1 2 6 4 5{\mathrm{N}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {3}\ {1}\ {2}\ {6}\ {4}\ {5}
451 + 2{1}\ {+}\ {2}1 + 2{1}\ {+}\ {2}
471 2 3 + 10{1}\ {2}\ {3}\ {+}\ {10}1 2 3 + 10{1}\ {2}\ {3}\ {+}\ {10}
49M + 100{\mathrm{M}}\ {+}\ {100}M + 100{\mathrm{M}}\ {+}\ {100}
6210 - 3{10}\ {-}\ {3}10 − 3{10}\ {-}\ {3}
64v - 1{\mathrm{v}}\ {-}\ {1}v − 1{\mathrm{v}}\ {-}\ {1}
756 * 7{6}\ {\times}\ {7}6 × 7{6}\ {\times}\ {7}
77v * v{\mathrm{v}}\ {\times}\ {\mathrm{v}}v × v{\mathrm{v}}\ {\times}\ {\mathrm{v}}
887 / 2{7}\ {\div}\ {2}7 ÷ 2{7}\ {\div}\ {2}
901 2 3 / 2{1}\ {2}\ {3}\ {\div}\ {2}1 2 3 ÷ 2{1}\ {2}\ {3}\ {\div}\ {2}
1032 ^ 10{2}\ {\mathbin{\hat{}}}\ {10}2 ^ 10{2}\ {\mathbin{\hat{}}}\ {10}
105v ^ 2{\mathrm{v}}\ {\mathbin{\hat{}}}\ {2}v ^ 2{\mathrm{v}}\ {\mathbin{\hat{}}}\ {2}
1163 m_ax 5{3}\ {\mathrm{\underline{m}ax}}\ {5}3 m‾ax 5{3}\ {\mathrm{\underline{m}ax}}\ {5}
118'm_ax r_/ v{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’m‾ax r‾/ v{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
1293 m_in 5{3}\ {\mathrm{\underline{m}in}}\ {5}3 m‾in 5{3}\ {\mathrm{\underline{m}in}}\ {5}
1312 m_in v{2}\ {\mathrm{\underline{m}in}}\ {\mathrm{v}}2 m‾in v{2}\ {\mathrm{\underline{m}in}}\ {\mathrm{v}}
1427 d_iv 2{7}\ {\mathrm{\underline{d}iv}}\ {2}7 d‾iv 2{7}\ {\mathrm{\underline{d}iv}}\ {2}
1547 m_od 3{7}\ {\mathrm{\underline{m}od}}\ {3}7 m‾od 3{7}\ {\mathrm{\underline{m}od}}\ {3}
156(r_ange 6) m_od 2{(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\mathrm{\underline{m}od}}\ {2}(r‾ange 6) m‾od 2{(}{\mathrm{\underline{r}ange}}\ {6}{)}\ {\mathrm{\underline{m}od}}\ {2}
167n_eg v{\mathrm{\underline{n}eg}}\ {\mathrm{v}}n‾eg v{\mathrm{\underline{n}eg}}\ {\mathrm{v}}
178a_bs -3 4 -5{\mathrm{\underline{a}bs}}\ {-3}\ {4}\ {-5}a‾bs −3 4 −5{\mathrm{\underline{a}bs}}\ {-3}\ {4}\ {-5}
189f_loor 2.5 -2.5{\mathrm{\underline{f}loor}}\ {2.5}\ {-2.5}f‾loor 2.5 −2.5{\mathrm{\underline{f}loor}}\ {2.5}\ {-2.5}
200c_eiling 2.5 -2.5{\mathrm{\underline{c}eiling}}\ {2.5}\ {-2.5}c‾eiling 2.5 −2.5{\mathrm{\underline{c}eiling}}\ {2.5}\ {-2.5}
211e_xp 1{\mathrm{\underline{e}xp}}\ {1}e‾xp 1{\mathrm{\underline{e}xp}}\ {1}
222l_og e_xp 2{\mathrm{\underline{l}og}}\ {\mathrm{\underline{e}xp}}\ {2}l‾og e‾xp 2{\mathrm{\underline{l}og}}\ {\mathrm{\underline{e}xp}}\ {2}
233f_loat 3{\mathrm{\underline{f}loat}}\ {3}f‾loat 3{\mathrm{\underline{f}loat}}\ {3}
249s_in 0 1{\mathrm{\underline{s}in}}\ {0}\ {1}s‾in 0 1{\mathrm{\underline{s}in}}\ {0}\ {1}
260c_os p_i @{\mathrm{\underline{c}os}}\ {\mathrm{\underline{p}i}}\ {@}c‾os p‾i @{\mathrm{\underline{c}os}}\ {\mathrm{\underline{p}i}}\ {@}
2714 * a_tan 1{4}\ {\times}\ {\mathrm{\underline{a}tan}}\ {1}4 × a‾tan 1{4}\ {\times}\ {\mathrm{\underline{a}tan}}\ {1}
282p_i @{\mathrm{\underline{p}i}}\ {@}p‾i @{\mathrm{\underline{p}i}}\ {@}
2842 * p_i @{2}\ {\times}\ {\mathrm{\underline{p}i}}\ {@}2 × p‾i @{2}\ {\times}\ {\mathrm{\underline{p}i}}\ {@}
3013 = 3{3}\ {=}\ {3}3 = 3{3}\ {=}\ {3}
303v = 1{\mathrm{v}}\ {=}\ {1}v = 1{\mathrm{v}}\ {=}\ {1}
314v != 1{\mathrm{v}}\ {\neq}\ {1}v ≠ 1{\mathrm{v}}\ {\neq}\ {1}
325v < 2{\mathrm{v}}\ {<}\ {2}v < 2{\mathrm{v}}\ {<}\ {2}
336v > 2{\mathrm{v}}\ {>}\ {2}v > 2{\mathrm{v}}\ {>}\ {2}
347v <= 2{\mathrm{v}}\ {\leq}\ {2}v ≤ 2{\mathrm{v}}\ {\leq}\ {2}
358v >= 2{\mathrm{v}}\ {\geq}\ {2}v ≥ 2{\mathrm{v}}\ {\geq}\ {2}
369(0.1 + 0.2) e_q~ 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {\mathrm{\underline{e}q}{\sim}}\ {0.3}(0.1 + 0.2) e‾q∼ 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {\mathrm{\underline{e}q}{\sim}}\ {0.3}
3801 1 0 & 1 0 0{1}\ {1}\ {0}\ {\wedge}\ {1}\ {0}\ {0}1 1 0 ∧ 1 0 0{1}\ {1}\ {0}\ {\wedge}\ {1}\ {0}\ {0}
3911 1 0 | 1 0 0{1}\ {1}\ {0}\ {\vee}\ {1}\ {0}\ {0}1 1 0 ∨ 1 0 0{1}\ {1}\ {0}\ {\vee}\ {1}\ {0}\ {0}
402n_ot 1 0{\mathrm{\underline{n}ot}}\ {1}\ {0}n‾ot 1 0{\mathrm{\underline{n}ot}}\ {1}\ {0}
421s_hape v{\mathrm{\underline{s}hape}}\ {\mathrm{v}}s‾hape v{\mathrm{\underline{s}hape}}\ {\mathrm{v}}
423s_hape M{\mathrm{\underline{s}hape}}\ {\mathrm{M}}s‾hape M{\mathrm{\underline{s}hape}}\ {\mathrm{M}}
436t_ally v{\mathrm{\underline{t}ally}}\ {\mathrm{v}}t‾ally v{\mathrm{\underline{t}ally}}\ {\mathrm{v}}
438t_ally M{\mathrm{\underline{t}ally}}\ {\mathrm{M}}t‾ally M{\mathrm{\underline{t}ally}}\ {\mathrm{M}}
440t_ally_1 M{{\mathrm{\underline{t}ally}}_{1}}\ {\mathrm{M}}t‾ally1 M{{\mathrm{\underline{t}ally}}_{1}}\ {\mathrm{M}}
442t_ally_2 M{{\mathrm{\underline{t}ally}}_{2}}\ {\mathrm{M}}t‾ally2 M{{\mathrm{\underline{t}ally}}_{2}}\ {\mathrm{M}}
453r_ange 5{\mathrm{\underline{r}ange}}\ {5}r‾ange 5{\mathrm{\underline{r}ange}}\ {5}
464o_ffsets 5{\mathrm{\underline{o}ffsets}}\ {5}o‾ffsets 5{\mathrm{\underline{o}ffsets}}\ {5}
4762 3 r_eshape r_ange 6{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}2 3 r‾eshape r‾ange 6{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
4792 2 r_eshape 7{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {7}2 2 r‾eshape 7{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {7}
492r_avel M{\mathrm{\underline{r}avel}}\ {\mathrm{M}}r‾avel M{\mathrm{\underline{r}avel}}\ {\mathrm{M}}
494r_avel_2 M{{\mathrm{\underline{r}avel}}_{2}}\ {\mathrm{M}}r‾avel2 M{{\mathrm{\underline{r}avel}}_{2}}\ {\mathrm{M}}
506f_irst v{\mathrm{\underline{f}irst}}\ {\mathrm{v}}f‾irst v{\mathrm{\underline{f}irst}}\ {\mathrm{v}}
508f_irst M{\mathrm{\underline{f}irst}}\ {\mathrm{M}}f‾irst M{\mathrm{\underline{f}irst}}\ {\mathrm{M}}
510f_irst_1 M{{\mathrm{\underline{f}irst}}_{1}}\ {\mathrm{M}}f‾irst1 M{{\mathrm{\underline{f}irst}}_{1}}\ {\mathrm{M}}
512f_irst_2 M{{\mathrm{\underline{f}irst}}_{2}}\ {\mathrm{M}}f‾irst2 M{{\mathrm{\underline{f}irst}}_{2}}\ {\mathrm{M}}
5242 t_ake v{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}2 t‾ake v{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}
526-2 t_ake v{-2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}−2 t‾ake v{-2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}
5281 t_ake M{1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{M}}1 t‾ake M{1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{M}}
5301 t_ake_1 M{1}\ {{\mathrm{\underline{t}ake}}_{1}}\ {\mathrm{M}}1 t‾ake1 M{1}\ {{\mathrm{\underline{t}ake}}_{1}}\ {\mathrm{M}}
5321 t_ake_2 M{1}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{M}}1 t‾ake2 M{1}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{M}}
5451 d_rop v{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}1 d‾rop v{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}
5471 d_rop M{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{M}}1 d‾rop M{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{M}}
5491 d_rop_1 M{1}\ {{\mathrm{\underline{d}rop}}_{1}}\ {\mathrm{M}}1 d‾rop1 M{1}\ {{\mathrm{\underline{d}rop}}_{1}}\ {\mathrm{M}}
5511 d_rop_2 M{1}\ {{\mathrm{\underline{d}rop}}_{2}}\ {\mathrm{M}}1 d‾rop2 M{1}\ {{\mathrm{\underline{d}rop}}_{2}}\ {\mathrm{M}}
5643 1 s_elect v{3}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}3 1 s‾elect v{3}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
5662 s_elect M{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{M}}2 s‾elect M{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{M}}
5682 s_elect_1 M{2}\ {{\mathrm{\underline{s}elect}}_{1}}\ {\mathrm{M}}2 s‾elect1 M{2}\ {{\mathrm{\underline{s}elect}}_{1}}\ {\mathrm{M}}
5702 s_elect_2 M{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{M}}2 s‾elect2 M{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{M}}
5841 0 2 r_eplicate "abc"{1}\ {0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {\text{"abc"}}1 0 2 r‾eplicate "abc"{1}\ {0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {\text{"abc"}}
586(v > 1) r_eplicate v{(}{\mathrm{v}}\ {>}\ {1}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{v}}(v > 1) r‾eplicate v{(}{\mathrm{v}}\ {>}\ {1}{)}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{v}}
5882 r_eplicate v{2}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{v}}2 r‾eplicate v{2}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{v}}
5900 2 r_eplicate M{0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{M}}0 2 r‾eplicate M{0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{M}}
5931 0 2 r_eplicate_2 M{1}\ {0}\ {2}\ {{\mathrm{\underline{r}eplicate}}_{2}}\ {\mathrm{M}}1 0 2 r‾eplicate2 M{1}\ {0}\ {2}\ {{\mathrm{\underline{r}eplicate}}_{2}}\ {\mathrm{M}}
5961 -1 2 r_eplicate v{1}\ {-1}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{v}}1 −1 2 r‾eplicate v{1}\ {-1}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{v}}
6112 2 2 2 e_ncode 11{2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {11}2 2 2 2 e‾ncode 11{2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {11}
61324 60 60 e_ncode 3725{24}\ {60}\ {60}\ {\mathrm{\underline{e}ncode}}\ {3725}24 60 60 e‾ncode 3725{24}\ {60}\ {60}\ {\mathrm{\underline{e}ncode}}\ {3725}
6150 10 e_ncode 123{0}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}0 10 e‾ncode 123{0}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}
6172 2 2 e_ncode 0 1 2 3{2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {0}\ {1}\ {2}\ {3}2 2 2 e‾ncode 0 1 2 3{2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {0}\ {1}\ {2}\ {3}
6212 2 e_ncode M{2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{M}}2 2 e‾ncode M{2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{M}}
6362 d_ecode 1 0 1 1{2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {0}\ {1}\ {1}2 d‾ecode 1 0 1 1{2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {0}\ {1}\ {1}
63810 d_ecode 1 2 3{10}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {3}10 d‾ecode 1 2 3{10}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {3}
64024 60 60 d_ecode 1 2 5{24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {5}24 60 60 d‾ecode 1 2 5{24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {5}
6422 d_ecode 2 2 2 e_ncode 0 1 2 3{2}\ {\mathrm{\underline{d}ecode}}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {0}\ {1}\ {2}\ {3}2 d‾ecode 2 2 2 e‾ncode 0 1 2 3{2}\ {\mathrm{\underline{d}ecode}}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {0}\ {1}\ {2}\ {3}
6442.0 d_ecode 3.0 -2.0 1.0{2.0}\ {\mathrm{\underline{d}ecode}}\ {3.0}\ {-2.0}\ {1.0}2.0 d‾ecode 3.0 −2.0 1.0{2.0}\ {\mathrm{\underline{d}ecode}}\ {3.0}\ {-2.0}\ {1.0}
6460.5 d_ecode r_ev 1.0 -2.0 3.0{0.5}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{\underline{r}ev}}\ {1.0}\ {-2.0}\ {3.0}0.5 d‾ecode r‾ev 1.0 −2.0 3.0{0.5}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{\underline{r}ev}}\ {1.0}\ {-2.0}\ {3.0}
6482 2 d_ecode 1 0 1{2}\ {2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {0}\ {1}2 2 d‾ecode 1 0 1{2}\ {2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {0}\ {1}
664e_nclose "abc"{\mathrm{\underline{e}nclose}}\ {\text{"abc"}}e‾nclose "abc"{\mathrm{\underline{e}nclose}}\ {\text{"abc"}}
670"ab" "cde"{\text{"ab"}}\ {\text{"cde"}}"ab" "cde"{\text{"ab"}}\ {\text{"cde"}}
676(e_nclose v) c_at e_nclose 1 2{(}{\mathrm{\underline{e}nclose}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {1}\ {2}(e‾nclose v) c‾at e‾nclose 1 2{(}{\mathrm{\underline{e}nclose}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {1}\ {2}
682t_ally "ab" "cde"{\mathrm{\underline{t}ally}}\ {\text{"ab"}}\ {\text{"cde"}}t‾ally "ab" "cde"{\mathrm{\underline{t}ally}}\ {\text{"ab"}}\ {\text{"cde"}}
693d_isclose e_nclose "abc"{\mathrm{\underline{d}isclose}}\ {\mathrm{\underline{e}nclose}}\ {\text{"abc"}}d‾isclose e‾nclose "abc"{\mathrm{\underline{d}isclose}}\ {\mathrm{\underline{e}nclose}}\ {\text{"abc"}}
695d_isclose 2 s_elect "ab" "cde"{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\text{"ab"}}\ {\text{"cde"}}d‾isclose 2 s‾elect "ab" "cde"{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\text{"ab"}}\ {\text{"cde"}}
697d_isclose "ab" "cde"{\mathrm{\underline{d}isclose}}\ {\text{"ab"}}\ {\text{"cde"}}d‾isclose "ab" "cde"{\mathrm{\underline{d}isclose}}\ {\text{"ab"}}\ {\text{"cde"}}
713d_isplay M{\mathrm{\underline{d}isplay}}\ {\mathrm{M}}d‾isplay M{\mathrm{\underline{d}isplay}}\ {\mathrm{M}}
718d_isplay "abc"{\mathrm{\underline{d}isplay}}\ {\text{"abc"}}d‾isplay "abc"{\mathrm{\underline{d}isplay}}\ {\text{"abc"}}
722d_isplay "ab" "cde"{\mathrm{\underline{d}isplay}}\ {\text{"ab"}}\ {\text{"cde"}}d‾isplay "ab" "cde"{\mathrm{\underline{d}isplay}}\ {\text{"ab"}}\ {\text{"cde"}}
728s_hape d_isplay v{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{d}isplay}}\ {\mathrm{v}}s‾hape d‾isplay v{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{d}isplay}}\ {\mathrm{v}}
730d_isplay 5{\mathrm{\underline{d}isplay}}\ {5}d‾isplay 5{\mathrm{\underline{d}isplay}}\ {5}
744t_ally (1 1 0 1 1 1 0 1) p_artition "ab cde f"{\mathrm{\underline{t}ally}}\ {(}{1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"ab cde f"}}t‾ally (1 1 0 1 1 1 0 1) p‾artition "ab cde f"{\mathrm{\underline{t}ally}}\ {(}{1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"ab cde f"}}
746d_isclose 2 s_elect (1 1 0 1 1 1 0 1) p_artition "ab cde f"{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {(}{1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"ab cde f"}}d‾isclose 2 s‾elect (1 1 0 1 1 1 0 1) p‾artition "ab cde f"{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {(}{1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"ab cde f"}}
748'[t_ally d_isclose] e_ach ("a bb ccc" != f_irst " ") p_artition "a bb ccc"{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {(}{\text{"a bb ccc"}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"a bb ccc"}}’[t‾ally d‾isclose] e‾ach ("a bb ccc" ≠ f‾irst " ") p‾artition "a bb ccc"{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {(}{\text{"a bb ccc"}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"a bb ccc"}}
7501 1 p_artition 1 2 3{1}\ {1}\ {\mathrm{\underline{p}artition}}\ {1}\ {2}\ {3}1 1 p‾artition 1 2 3{1}\ {1}\ {\mathrm{\underline{p}artition}}\ {1}\ {2}\ {3}
7641 2 c_at 3 4{1}\ {2}\ {\mathrm{\underline{c}at}}\ {3}\ {4}1 2 c‾at 3 4{1}\ {2}\ {\mathrm{\underline{c}at}}\ {3}\ {4}
766M c_at M{\mathrm{M}}\ {\mathrm{\underline{c}at}}\ {\mathrm{M}}M c‾at M{\mathrm{M}}\ {\mathrm{\underline{c}at}}\ {\mathrm{M}}
771M c_at_2 M{\mathrm{M}}\ {{\mathrm{\underline{c}at}}_{2}}\ {\mathrm{M}}M c‾at2 M{\mathrm{M}}\ {{\mathrm{\underline{c}at}}_{2}}\ {\mathrm{M}}
774M c_at_2 0 9{\mathrm{M}}\ {{\mathrm{\underline{c}at}}_{2}}\ {0}\ {9}M c‾at2 0 9{\mathrm{M}}\ {{\mathrm{\underline{c}at}}_{2}}\ {0}\ {9}
777M c_at_2 1 2 3{\mathrm{M}}\ {{\mathrm{\underline{c}at}}_{2}}\ {1}\ {2}\ {3}M c‾at2 1 2 3{\mathrm{M}}\ {{\mathrm{\underline{c}at}}_{2}}\ {1}\ {2}\ {3}
795'+ r_/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’+ r‾/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
797'- r_/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’− r‾/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
799'+ r_/ M{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{M}}’+ r‾/ M{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{M}}
801'+ r_/_1 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{M}}’+ r‾/1 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{M}}
803'+ r_/_2 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}’+ r‾/2 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}
805'+ r_/_12 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{M}}’+ r‾/12 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{M}}
807'm_ax r_/_2 M{\text{'}}{\mathrm{\underline{m}ax}}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}’m‾ax r‾/2 M{\text{'}}{\mathrm{\underline{m}ax}}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}
819'+ s_\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}’+ s‾\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}
821'+ s_\ M{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{M}}’+ s‾\ M{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{M}}
824'+ s_\_1 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{1}}\ {\mathrm{M}}’+ s‾\1 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{1}}\ {\mathrm{M}}
827'+ s_\_2 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{M}}’+ s‾\2 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{M}}
840'n_eg e_ach v{\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{v}}’n‾eg e‾ach v{\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{v}}
842'{ _r * 10 } e_ach v{\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {10}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{v}}’{ _r × 10 } e‾ach v{\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {10}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{v}}
8441 2 3 '+ e_ach 10 20 30{1}\ {2}\ {3}\ {\text{'}}{+}\ {\mathrm{\underline{e}ach}}\ {10}\ {20}\ {30}1 2 3 ’+ e‾ach 10 20 30{1}\ {2}\ {3}\ {\text{'}}{+}\ {\mathrm{\underline{e}ach}}\ {10}\ {20}\ {30}
856t_ally 'r_ange m_ap 1 2 3{\mathrm{\underline{t}ally}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}t‾ally ’r‾ange m‾ap 1 2 3{\mathrm{\underline{t}ally}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}
858d_isclose 3 s_elect 'r_ange m_ap 1 2 3{\mathrm{\underline{d}isclose}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}d‾isclose 3 s‾elect ’r‾ange m‾ap 1 2 3{\mathrm{\underline{d}isclose}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}
860'[t_ally d_isclose] e_ach 'r_ange m_ap 1 2 3{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}’[t‾ally d‾isclose] e‾ach ’r‾ange m‾ap 1 2 3{\text{'}}{[}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}{]}\ {\mathrm{\underline{e}ach}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}
8721 2 3 '* t_able 1 2 3{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}1 2 3 ’× t‾able 1 2 3{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}
886(2 2 r_eshape 1 2 3 4) '+ '* i_nner 2 2 r_eshape 1 2 3 4{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}(2 2 r‾eshape 1 2 3 4) ’+ ’× i‾nner 2 2 r‾eshape 1 2 3 4{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}
899'n_eg 'a_bs c_ompose -5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-5}’n‾eg ’a‾bs c‾ompose −5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-5}
901[n_eg a_bs] -5{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-5}[n‾eg a‾bs] −5{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-5}
91210 '- s_wap 3{10}\ {\text{'}}{-}\ {\mathrm{\underline{s}wap}}\ {3}10 ’− s‾wap 3{10}\ {\text{'}}{-}\ {\mathrm{\underline{s}wap}}\ {3}
9243 'n_eg p_ower 5{3}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{p}ower}}\ {5}3 ’n‾eg p‾ower 5{3}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{p}ower}}\ {5}
926n_eg^3 5{\mathrm{\underline{n}eg}}^{3}\ {5}n‾eg3 5{\mathrm{\underline{n}eg}}^{3}\ {5}
9425 6 7 i_ndexOf 7 9{5}\ {6}\ {7}\ {\mathrm{\underline{i}ndexOf}}\ {7}\ {9}5 6 7 i‾ndexOf 7 9{5}\ {6}\ {7}\ {\mathrm{\underline{i}ndexOf}}\ {7}\ {9}
944M i_ndexOf 4 5 6{\mathrm{M}}\ {\mathrm{\underline{i}ndexOf}}\ {4}\ {5}\ {6}M i‾ndexOf 4 5 6{\mathrm{M}}\ {\mathrm{\underline{i}ndexOf}}\ {4}\ {5}\ {6}
9552 9 m_ember? 1 2 3{2}\ {9}\ {\mathrm{\underline{m}ember}{?}}\ {1}\ {2}\ {3}2 9 m‾ember? 1 2 3{2}\ {9}\ {\mathrm{\underline{m}ember}{?}}\ {1}\ {2}\ {3}
9681 2 3 m_atch 1 2 3{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}1 2 3 m‾atch 1 2 3{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}
9701 2 3 m_atch 1 2 4{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {4}1 2 3 m‾atch 1 2 4{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {4}
972M m_atch M{\mathrm{M}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{M}}M m‾atch M{\mathrm{M}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{M}}
974M m_atch 1 2 3 4 5 6{\mathrm{M}}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}M m‾atch 1 2 3 4 5 6{\mathrm{M}}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}
9761 m_atch 1 s_elect 1 2 3{1}\ {\mathrm{\underline{m}atch}}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {2}\ {3}1 m‾atch 1 s‾elect 1 2 3{1}\ {\mathrm{\underline{m}atch}}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {2}\ {3}
987u_nique 3 1 3 2 1{\mathrm{\underline{u}nique}}\ {3}\ {1}\ {3}\ {2}\ {1}u‾nique 3 1 3 2 1{\mathrm{\underline{u}nique}}\ {3}\ {1}\ {3}\ {2}\ {1}
999s_ort 3 1 2{\mathrm{\underline{s}ort}}\ {3}\ {1}\ {2}s‾ort 3 1 2{\mathrm{\underline{s}ort}}\ {3}\ {1}\ {2}
1001s_ort N{\mathrm{\underline{s}ort}}\ {\mathrm{N}}s‾ort N{\mathrm{\underline{s}ort}}\ {\mathrm{N}}
1004s_ort_2 N{{\mathrm{\underline{s}ort}}_{2}}\ {\mathrm{N}}s‾ort2 N{{\mathrm{\underline{s}ort}}_{2}}\ {\mathrm{N}}
1017g_rade 3 1 2{\mathrm{\underline{g}rade}}\ {3}\ {1}\ {2}g‾rade 3 1 2{\mathrm{\underline{g}rade}}\ {3}\ {1}\ {2}
1019g_rade_2 N{{\mathrm{\underline{g}rade}}_{2}}\ {\mathrm{N}}g‾rade2 N{{\mathrm{\underline{g}rade}}_{2}}\ {\mathrm{N}}
1030w_here 0 1 1 0{\mathrm{\underline{w}here}}\ {0}\ {1}\ {1}\ {0}w‾here 0 1 1 0{\mathrm{\underline{w}here}}\ {0}\ {1}\ {1}\ {0}
1032w_here_2 M{{\mathrm{\underline{w}here}}_{2}}\ {\mathrm{M}}w‾here2 M{{\mathrm{\underline{w}here}}_{2}}\ {\mathrm{M}}
10481 o_- v{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}1 o‾− v{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}
1050-1 o_- v{-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}−1 o‾− v{-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}
10521 o_- M{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{M}}1 o‾− M{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{M}}
10551 o_-_1 M{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{M}}1 o‾−1 M{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{M}}
10581 o_-_2 M{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{M}}1 o‾−2 M{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{M}}
1061-1 0 1 o_- v{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}−1 0 1 o‾− v{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}
1075r_ev v{\mathrm{\underline{r}ev}}\ {\mathrm{v}}r‾ev v{\mathrm{\underline{r}ev}}\ {\mathrm{v}}
1077r_ev M{\mathrm{\underline{r}ev}}\ {\mathrm{M}}r‾ev M{\mathrm{\underline{r}ev}}\ {\mathrm{M}}
1080r_ev_1 M{{\mathrm{\underline{r}ev}}_{1}}\ {\mathrm{M}}r‾ev1 M{{\mathrm{\underline{r}ev}}_{1}}\ {\mathrm{M}}
1083r_ev_2 M{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{M}}r‾ev2 M{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{M}}
1097o_\ M{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{M}}o‾\ M{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{M}}
1101s_hape o_\ 2 3 4 r_eshape 0{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{o}}{\backslash}}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}s‾hape o‾\ 2 3 4 r‾eshape 0{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{o}}{\backslash}}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}
1103s_hape o_\_23 2 3 4 r_eshape 0{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}s‾hape o‾\23 2 3 4 r‾eshape 0{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}
1105o_\_2 M{{\mathrm{\underline{o}}{\backslash}}_{2}}\ {\mathrm{M}}o‾\2 M{{\mathrm{\underline{o}}{\backslash}}_{2}}\ {\mathrm{M}}
11192 1 t_ranspose M{2}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{M}}2 1 t‾ranspose M{2}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{M}}
1123s_hape 3 1 2 t_ranspose 2 3 4 r_eshape 0{\mathrm{\underline{s}hape}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}s‾hape 3 1 2 t‾ranspose 2 3 4 r‾eshape 0{\mathrm{\underline{s}hape}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}
11251 1 t_ranspose M{1}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{M}}1 1 t‾ranspose M{1}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{M}}
1139[]A{\square \mathrm{A}}□A{\square \mathrm{A}}
11413 t_ake []A{3}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{A}}3 t‾ake □A{3}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{A}}
1152[]D{\square \mathrm{D}}□D{\square \mathrm{D}}
1164t_ally []AV{\mathrm{\underline{t}ally}}\ {\square \mathrm{AV}}t‾ally □AV{\mathrm{\underline{t}ally}}\ {\square \mathrm{AV}}
116666 s_elect []AV{66}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{AV}}66 s‾elect □AV{66}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{AV}}
1177[]IO{\square \mathrm{IO}}□IO{\square \mathrm{IO}}
1189[]U_CS "Hi"{\square \mathrm{\underline{U}CS}}\ {\text{"Hi"}}□U‾CS "Hi"{\square \mathrm{\underline{U}CS}}\ {\text{"Hi"}}
1191([]U_CS "a") - []U_CS "A"{(}{\square \mathrm{\underline{U}CS}}\ {\text{"a"}}{)}\ {-}\ {\square \mathrm{\underline{U}CS}}\ {\text{"A"}}(□U‾CS "a") − □U‾CS "A"{(}{\square \mathrm{\underline{U}CS}}\ {\text{"a"}}{)}\ {-}\ {\square \mathrm{\underline{U}CS}}\ {\text{"A"}}
1202[]U_CHAR 72 105{\square \mathrm{\underline{U}CHAR}}\ {72}\ {105}□U‾CHAR 72 105{\square \mathrm{\underline{U}CHAR}}\ {72}\ {105}
1204[]U_CHAR 1 + []U_CS "HAL"{\square \mathrm{\underline{U}CHAR}}\ {1}\ {+}\ {\square \mathrm{\underline{U}CS}}\ {\text{"HAL"}}□U‾CHAR 1 + □U‾CS "HAL"{\square \mathrm{\underline{U}CHAR}}\ {1}\ {+}\ {\square \mathrm{\underline{U}CS}}\ {\text{"HAL"}}
1206[]U_CHAR 200{\square \mathrm{\underline{U}CHAR}}\ {200}□U‾CHAR 200{\square \mathrm{\underline{U}CHAR}}\ {200}
1219s_hape []TS{\mathrm{\underline{s}hape}}\ {\square \mathrm{TS}}s‾hape □TS{\mathrm{\underline{s}hape}}\ {\square \mathrm{TS}}
12212026 <= 1 s_elect []TS{2026}\ {\leq}\ {1}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{TS}}2026 ≤ 1 s‾elect □TS{2026}\ {\leq}\ {1}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{TS}}
1234([]D_L 0.01) >= 0.01{(}{\square \mathrm{\underline{D}L}}\ {0.01}{)}\ {\geq}\ {0.01}(□D‾L 0.01) ≥ 0.01{(}{\square \mathrm{\underline{D}L}}\ {0.01}{)}\ {\geq}\ {0.01}
1236[]D_L -1{\square \mathrm{\underline{D}L}}\ {-1}□D‾L −1{\square \mathrm{\underline{D}L}}\ {-1}
1249p_rint! v{\mathrm{\underline{p}rint}{!}}\ {\mathrm{v}}p‾rint! v{\mathrm{\underline{p}rint}{!}}\ {\mathrm{v}}
1262r_oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}r‾oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}
1275i_d v{\mathrm{\underline{i}d}}\ {\mathrm{v}}i‾d v{\mathrm{\underline{i}d}}\ {\mathrm{v}}
1277[i_d - n_eg] 5{[}{\mathrm{\underline{i}d}}\ {-}\ {\mathrm{\underline{n}eg}}{]}\ {5}[i‾d − n‾eg] 5{[}{\mathrm{\underline{i}d}}\ {-}\ {\mathrm{\underline{n}eg}}{]}\ {5}
12891 l_eft 2{1}\ {\mathrm{\underline{l}eft}}\ {2}1 l‾eft 2{1}\ {\mathrm{\underline{l}eft}}\ {2}
12913 [l_eft - r_ight] 4{3}\ {[}{\mathrm{\underline{l}eft}}\ {-}\ {\mathrm{\underline{r}ight}}{]}\ {4}3 [l‾eft − r‾ight] 4{3}\ {[}{\mathrm{\underline{l}eft}}\ {-}\ {\mathrm{\underline{r}ight}}{]}\ {4}
13021 r_ight 2{1}\ {\mathrm{\underline{r}ight}}\ {2}1 r‾ight 2{1}\ {\mathrm{\underline{r}ight}}\ {2}
13041 2 [r_ight c_at l_eft] 3{1}\ {2}\ {[}{\mathrm{\underline{r}ight}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{l}eft}}{]}\ {3}1 2 [r‾ight c‾at l‾eft] 3{1}\ {2}\ {[}{\mathrm{\underline{r}ight}}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{l}eft}}{]}\ {3}
1315f_ormat 3.5{\mathrm{\underline{f}ormat}}\ {3.5}f‾ormat 3.5{\mathrm{\underline{f}ormat}}\ {3.5}
1317t_ally f_ormat 1 2 3{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{f}ormat}}\ {1}\ {2}\ {3}t‾ally f‾ormat 1 2 3{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{f}ormat}}\ {1}\ {2}\ {3}
1328n_umbers "1 2.5 -3"{\mathrm{\underline{n}umbers}}\ {\text{"1 2.5 -3"}}n‾umbers "1 2.5 -3"{\mathrm{\underline{n}umbers}}\ {\text{"1 2.5 -3"}}
1340"hello" []N_PUT "work/reference.txt"{\text{"hello"}}\ {\square \mathrm{\underline{N}PUT}}\ {\text{"work/reference.txt"}}"hello" □N‾PUT "work/reference.txt"{\text{"hello"}}\ {\square \mathrm{\underline{N}PUT}}\ {\text{"work/reference.txt"}}
1351[]N_GET "work/reference.txt"{\square \mathrm{\underline{N}GET}}\ {\text{"work/reference.txt"}}□N‾GET "work/reference.txt"{\square \mathrm{\underline{N}GET}}\ {\text{"work/reference.txt"}}
1362[]R_EAD @{\square \mathrm{\underline{R}EAD}}\ {@}□R‾EAD @{\square \mathrm{\underline{R}EAD}}\ {@}
1376[]K_EY @{\square \mathrm{\underline{K}EY}}\ {@}□K‾EY @{\square \mathrm{\underline{K}EY}}\ {@}
1387[]K_CHAR []K_EY @{\square \mathrm{\underline{K}CHAR}}\ {\square \mathrm{\underline{K}EY}}\ {@}□K‾CHAR □K‾EY @{\square \mathrm{\underline{K}CHAR}}\ {\square \mathrm{\underline{K}EY}}\ {@}
1399[]K_NAMED 1{\square \mathrm{\underline{K}NAMED}}\ {1}□K‾NAMED 1{\square \mathrm{\underline{K}NAMED}}\ {1}
1416[]V_IEW "1 + r_ange n"{\square \mathrm{\underline{V}IEW}}\ {\text{"1 + r\_ange n"}}□V‾IEW "1 + r_ange n"{\square \mathrm{\underline{V}IEW}}\ {\text{"1 + r\_ange n"}}
1452"reg/fixtures/table.toml" []L_IST "cols"{\text{"reg/fixtures/table.toml"}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"cols"}}"reg/fixtures/table.toml" □L‾IST "cols"{\text{"reg/fixtures/table.toml"}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"cols"}}
1458"reg/fixtures/table.toml" []L_IST "count"{\text{"reg/fixtures/table.toml"}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"count"}}"reg/fixtures/table.toml" □L‾IST "count"{\text{"reg/fixtures/table.toml"}}\ {\square \mathrm{\underline{L}IST}}\ {\text{"count"}}
1473s_hape ("reg/fixtures/table.toml" "cells") []T_ABLE ("rows" "cols"){\mathrm{\underline{s}hape}}\ {(}{\text{"reg/fixtures/table.toml"}}\ {\text{"cells"}}{)}\ {\square \mathrm{\underline{T}ABLE}}\ {(}{\text{"rows"}}\ {\text{"cols"}}{)}s‾hape ("reg/fixtures/table.toml" "cells") □T‾ABLE ("rows" "cols"){\mathrm{\underline{s}hape}}\ {(}{\text{"reg/fixtures/table.toml"}}\ {\text{"cells"}}{)}\ {\square \mathrm{\underline{T}ABLE}}\ {(}{\text{"rows"}}\ {\text{"cols"}}{)}
14751 s_elect ("reg/fixtures/table.toml" "cells") []T_ABLE ("rows" "cols"){1}\ {\mathrm{\underline{s}elect}}\ {(}{\text{"reg/fixtures/table.toml"}}\ {\text{"cells"}}{)}\ {\square \mathrm{\underline{T}ABLE}}\ {(}{\text{"rows"}}\ {\text{"cols"}}{)}1 s‾elect ("reg/fixtures/table.toml" "cells") □T‾ABLE ("rows" "cols"){1}\ {\mathrm{\underline{s}elect}}\ {(}{\text{"reg/fixtures/table.toml"}}\ {\text{"cells"}}{)}\ {\square \mathrm{\underline{T}ABLE}}\ {(}{\text{"rows"}}\ {\text{"cols"}}{)}
1496[]E_VENT @{\square \mathrm{\underline{E}VENT}}\ {@}□E‾VENT @{\square \mathrm{\underline{E}VENT}}\ {@}
1509[]E_KIND []E_VENT @{\square \mathrm{\underline{E}KIND}}\ {\square \mathrm{\underline{E}VENT}}\ {@}□E‾KIND □E‾VENT @{\square \mathrm{\underline{E}KIND}}\ {\square \mathrm{\underline{E}VENT}}\ {@}
1522[]E_AT []E_VENT @{\square \mathrm{\underline{E}AT}}\ {\square \mathrm{\underline{E}VENT}}\ {@}□E‾AT □E‾VENT @{\square \mathrm{\underline{E}AT}}\ {\square \mathrm{\underline{E}VENT}}\ {@}
1534e := []E_VENT @; []K_CHAR []E_KEY []E_VENT @{\mathrm{e}}\ {\leftarrow}\ {\square \mathrm{\underline{E}VENT}}\ {@}{\diamond}\ {\square \mathrm{\underline{K}CHAR}}\ {\square \mathrm{\underline{E}KEY}}\ {\square \mathrm{\underline{E}VENT}}\ {@}e ← □E‾VENT @⋄ □K‾CHAR □E‾KEY □E‾VENT @{\mathrm{e}}\ {\leftarrow}\ {\square \mathrm{\underline{E}VENT}}\ {@}{\diamond}\ {\square \mathrm{\underline{K}CHAR}}\ {\square \mathrm{\underline{E}KEY}}\ {\square \mathrm{\underline{E}VENT}}\ {@}
1536[]E_KEY []E_VENT @{\square \mathrm{\underline{E}KEY}}\ {\square \mathrm{\underline{E}VENT}}\ {@}□E‾KEY □E‾VENT @{\square \mathrm{\underline{E}KEY}}\ {\square \mathrm{\underline{E}VENT}}\ {@}
1548[]C_OLOR 2{\square \mathrm{\underline{C}OLOR}}\ {2}□C‾OLOR 2{\square \mathrm{\underline{C}OLOR}}\ {2}
1561t_ally ([]C_OLOR 2) []F_G "hi"{\mathrm{\underline{t}ally}}\ {(}{\square \mathrm{\underline{C}OLOR}}\ {2}{)}\ {\square \mathrm{\underline{F}G}}\ {\text{"hi"}}t‾ally (□C‾OLOR 2) □F‾G "hi"{\mathrm{\underline{t}ally}}\ {(}{\square \mathrm{\underline{C}OLOR}}\ {2}{)}\ {\square \mathrm{\underline{F}G}}\ {\text{"hi"}}
1572t_ally ([]C_OLOR 5) []B_G "hi"{\mathrm{\underline{t}ally}}\ {(}{\square \mathrm{\underline{C}OLOR}}\ {5}{)}\ {\square \mathrm{\underline{B}G}}\ {\text{"hi"}}t‾ally (□C‾OLOR 5) □B‾G "hi"{\mathrm{\underline{t}ally}}\ {(}{\square \mathrm{\underline{C}OLOR}}\ {5}{)}\ {\square \mathrm{\underline{B}G}}\ {\text{"hi"}}
1583t_ally []B_OLD "hi"{\mathrm{\underline{t}ally}}\ {\square \mathrm{\underline{B}OLD}}\ {\text{"hi"}}t‾ally □B‾OLD "hi"{\mathrm{\underline{t}ally}}\ {\square \mathrm{\underline{B}OLD}}\ {\text{"hi"}}
1595t_ally 2 5 []A_T "hi"{\mathrm{\underline{t}ally}}\ {2}\ {5}\ {\square \mathrm{\underline{A}T}}\ {\text{"hi"}}t‾ally 2 5 □A‾T "hi"{\mathrm{\underline{t}ally}}\ {2}\ {5}\ {\square \mathrm{\underline{A}T}}\ {\text{"hi"}}
1606t_ally []C_LS @{\mathrm{\underline{t}ally}}\ {\square \mathrm{\underline{C}LS}}\ {@}t‾ally □C‾LS @{\mathrm{\underline{t}ally}}\ {\square \mathrm{\underline{C}LS}}\ {@}
1618[]T_E @{\square \mathrm{\underline{T}E}}\ {@}□T‾E @{\square \mathrm{\underline{T}E}}\ {@}
1630t_ally []E_RR "careful"{\mathrm{\underline{t}ally}}\ {\square \mathrm{\underline{E}RR}}\ {\text{"careful"}}t‾ally □E‾RR "careful"{\mathrm{\underline{t}ally}}\ {\square \mathrm{\underline{E}RR}}\ {\text{"careful"}}
16431 + []P_ANIC "stop here"{1}\ {+}\ {\square \mathrm{\underline{P}ANIC}}\ {\text{"stop here"}}1 + □P‾ANIC "stop here"{1}\ {+}\ {\square \mathrm{\underline{P}ANIC}}\ {\text{"stop here"}}
1657"too-wide" []S_IGNAL "the grid is at most 9 wide"{\text{"too-wide"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"the grid is at most 9 wide"}}"too-wide" □S‾IGNAL "the grid is at most 9 wide"{\text{"too-wide"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"the grid is at most 9 wide"}}
1659"Bad Code" []S_IGNAL "not a code"{\text{"Bad Code"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"not a code"}}"Bad Code" □S‾IGNAL "not a code"{\text{"Bad Code"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"not a code"}}
1683'{ @ -> []N_GET "no/such/file" } []T_RAP '{ e -> []R_ECOVER "" }{\text{'}}{\{}\ {@}\ {\to}\ {\square \mathrm{\underline{N}GET}}\ {\text{"no/such/file"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\text{""}}\ {\}}’{ @ → □N‾GET "no/such/file" } □T‾RAP ’{ e → □R‾ECOVER "" }{\text{'}}{\{}\ {@}\ {\to}\ {\square \mathrm{\underline{N}GET}}\ {\text{"no/such/file"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\text{""}}\ {\}}
1685'{ @ -> "mine" []S_IGNAL "oops" } []T_RAP '{ e -> []R_ECOVER []E_CODE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}\ {\}}’{ @ → "mine" □S‾IGNAL "oops" } □T‾RAP ’{ e → □R‾ECOVER □E‾CODE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}\ {\}}
1687'{ @ -> 1 + 2 } []T_RAP '{ e -> []R_ECOVER 0 }{\text{'}}{\{}\ {@}\ {\to}\ {1}\ {+}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {0}\ {\}}’{ @ → 1 + 2 } □T‾RAP ’{ e → □R‾ECOVER 0 }{\text{'}}{\{}\ {@}\ {\to}\ {1}\ {+}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {0}\ {\}}
1698'{ @ -> f_irst 0 t_ake 1 2 } []T_RAP '{ e -> []R_ECOVER -1 }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{f}irst}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {-1}\ {\}}’{ @ → f‾irst 0 t‾ake 1 2 } □T‾RAP ’{ e → □R‾ECOVER −1 }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{f}irst}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {-1}\ {\}}
1710'{ @ -> "a" []S_IGNAL "b" } []T_RAP '{ e -> ([]E_CODE e) m_atch "io" ? []R_ECOVER 1; []H_ALT e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {(}{\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"io"}}\ {?}\ {\square \mathrm{\underline{R}ECOVER}}\ {1}{\diamond}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}’{ @ → "a" □S‾IGNAL "b" } □T‾RAP ’{ e → (□E‾CODE e) m‾atch "io" ? □R‾ECOVER 1⋄ □H‾ALT e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {(}{\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"io"}}\ {?}\ {\square \mathrm{\underline{R}ECOVER}}\ {1}{\diamond}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}
1722n! := 0; '{ @ -> n! := n! + 1; n! < 3 ? "again" []S_IGNAL "not yet"; n! } []T_RAP '{ e -> []R_ETRY e }{\mathrm{n}!}\ {\leftarrow}\ {0}{\diamond}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{n}!}\ {\leftarrow}\ {\mathrm{n}!}\ {+}\ {1}{\diamond}\ {\mathrm{n}!}\ {<}\ {3}\ {?}\ {\text{"again"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"not yet"}}{\diamond}\ {\mathrm{n}!}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ETRY}}\ {\mathrm{e}}\ {\}}n! ← 0⋄ ’{ @ → n! ← n! + 1⋄ n! < 3 ? "again" □S‾IGNAL "not yet"⋄ n! } □T‾RAP ’{ e → □R‾ETRY e }{\mathrm{n}!}\ {\leftarrow}\ {0}{\diamond}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{n}!}\ {\leftarrow}\ {\mathrm{n}!}\ {+}\ {1}{\diamond}\ {\mathrm{n}!}\ {<}\ {3}\ {?}\ {\text{"again"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"not yet"}}{\diamond}\ {\mathrm{n}!}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ETRY}}\ {\mathrm{e}}\ {\}}
1724'{ @ -> "a" []S_IGNAL "b" } []T_RAP '{ e -> []R_ETRY e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ETRY}}\ {\mathrm{e}}\ {\}}’{ @ → "a" □S‾IGNAL "b" } □T‾RAP ’{ e → □R‾ETRY e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ETRY}}\ {\mathrm{e}}\ {\}}
1735'{ @ -> "mine" []S_IGNAL "oops" } []T_RAP '{ e -> []R_ECOVER []E_CODE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}\ {\}}’{ @ → "mine" □S‾IGNAL "oops" } □T‾RAP ’{ e → □R‾ECOVER □E‾CODE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}\ {\}}
1746'{ @ -> "mine" []S_IGNAL "oops" } []T_RAP '{ e -> []R_ECOVER []E_MESSAGE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}MESSAGE}}\ {\mathrm{e}}\ {\}}’{ @ → "mine" □S‾IGNAL "oops" } □T‾RAP ’{ e → □R‾ECOVER □E‾MESSAGE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}MESSAGE}}\ {\mathrm{e}}\ {\}}
1758'{ @ -> "mine" []S_IGNAL "oops" } []T_RAP '{ e -> []R_ECOVER []E_WHERE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}WHERE}}\ {\mathrm{e}}\ {\}}’{ @ → "mine" □S‾IGNAL "oops" } □T‾RAP ’{ e → □R‾ECOVER □E‾WHERE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}WHERE}}\ {\mathrm{e}}\ {\}}
1774'{ @ -> 10 + (0 []W_ARN "empty" "nothing to add") } []T_RAP '{ e -> []C_ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}’{ @ → 10 + (0 □W‾ARN "empty" "nothing to add") } □T‾RAP ’{ e → □C‾ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}
1776'{ @ -> 10 + (0 []W_ARN "empty" "nothing to add") } []T_RAP '{ e -> []R_ECOVER 99 }{\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {99}\ {\}}’{ @ → 10 + (0 □W‾ARN "empty" "nothing to add") } □T‾RAP ’{ e → □R‾ECOVER 99 }{\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {99}\ {\}}
177810 + (0 []W_ARN "empty" "nothing to add"){10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}10 + (0 □W‾ARN "empty" "nothing to add"){10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}
1793'{ @ -> '{ @ -> 10 + (0 []W_ARN "empty" "nothing") } []T_RAP '{ e -> []H_ALT e } } []T_RAP '{ e -> []C_ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}’{ @ → ’{ @ → 10 + (0 □W‾ARN "empty" "nothing") } □T‾RAP ’{ e → □H‾ALT e } } □T‾RAP ’{ e → □C‾ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}
1795'{ @ -> "a" []S_IGNAL "b" } []T_RAP '{ e -> []C_ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}’{ @ → "a" □S‾IGNAL "b" } □T‾RAP ’{ e → □C‾ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}
1808'{ @ -> p_rint! 1; 2 } []E_NSURE '{ @ -> p_rint! "cleaned" }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {1}{\diamond}\ {2}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}’{ @ → p‾rint! 1⋄ 2 } □E‾NSURE ’{ @ → p‾rint! "cleaned" }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {1}{\diamond}\ {2}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}
1812'{ @ -> "x" []S_IGNAL "y" } []E_NSURE '{ @ -> p_rint! "cleaned" }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"x"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"y"}}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}’{ @ → "x" □S‾IGNAL "y" } □E‾NSURE ’{ @ → p‾rint! "cleaned" }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"x"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"y"}}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}
1830"bad-macro-argument right" []R_EJECT "no"{\text{"bad-macro-argument right"}}\ {\square \mathrm{\underline{R}EJECT}}\ {\text{"no"}}"bad-macro-argument right" □R‾EJECT "no"{\text{"bad-macro-argument right"}}\ {\square \mathrm{\underline{R}EJECT}}\ {\text{"no"}}
1841[]S_TATEMENT @{\square \mathrm{\underline{S}TATEMENT}}\ {@}□S‾TATEMENT @{\square \mathrm{\underline{S}TATEMENT}}\ {@}
1852[]F_ILE @{\square \mathrm{\underline{F}ILE}}\ {@}□F‾ILE @{\square \mathrm{\underline{F}ILE}}\ {@}
1863[]L_INE @{\square \mathrm{\underline{L}INE}}\ {@}□L‾INE @{\square \mathrm{\underline{L}INE}}\ {@}
1875[]I_NCLUDE "data.txt"{\square \mathrm{\underline{I}NCLUDE}}\ {\text{"data.txt"}}□I‾NCLUDE "data.txt"{\square \mathrm{\underline{I}NCLUDE}}\ {\text{"data.txt"}}
1887[]C_FG "cli"{\square \mathrm{\underline{C}FG}}\ {\text{"cli"}}□C‾FG "cli"{\square \mathrm{\underline{C}FG}}\ {\text{"cli"}}
1908[]G_RID 1 0{\square \mathrm{\underline{G}RID}}\ {1}\ {0}□G‾RID 1 0{\square \mathrm{\underline{G}RID}}\ {1}\ {0}
1925[]P_ATH 2 3 r_eshape 0 1 2 0 1 0{\square \mathrm{\underline{P}ATH}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {2}\ {0}\ {1}\ {0}□P‾ATH 2 3 r‾eshape 0 1 2 0 1 0{\square \mathrm{\underline{P}ATH}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {2}\ {0}\ {1}\ {0}
19419 t_ake []S_HOW []G_RID 1 0{9}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {1}\ {0}9 t‾ake □S‾HOW □G‾RID 1 0{9}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {1}\ {0}

spec/ambiguity/adjacent-names.case

3a b{\mathrm{a}}\ {\mathrm{b}}a b{\mathrm{a}}\ {\mathrm{b}}

spec/ambiguity/function-exponent.case

3(r_ev)^2{(}{\mathrm{\underline{r}ev}}{)}^{2}(r‾ev)2{(}{\mathrm{\underline{r}ev}}{)}^{2}

spec/ambiguity/function-without-argument.case

3f_ g_{\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}f‾ g‾{\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}

spec/ambiguity/guard-outside-lambda.case

3x ? 1{\mathrm{x}}\ {?}\ {1}x ? 1{\mathrm{x}}\ {?}\ {1}

spec/ambiguity/left-without-right.case

3{ _l }{\{}\ {\_\mathrm{l}}\ {\}}{ _l }{\{}\ {\_\mathrm{l}}\ {\}}

spec/ambiguity/long-right-scope.case

3a - b - c{\mathrm{a}}\ {-}\ {\mathrm{b}}\ {-}\ {\mathrm{c}}a − b − c{\mathrm{a}}\ {-}\ {\mathrm{b}}\ {-}\ {\mathrm{c}}

spec/ambiguity/mixed-parameters.case

3{ x -> x + _r }{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {+}\ {\_\mathrm{r}}\ {\}}{ x → x + _r }{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {+}\ {\_\mathrm{r}}\ {\}}

spec/ambiguity/name-then-number.case

3x 1{\mathrm{x}}\ {1}x 1{\mathrm{x}}\ {1}

spec/ambiguity/no-parameters.case

3{ 42 }{\{}\ {42}\ {\}}{ 42 }{\{}\ {42}\ {\}}

spec/ambiguity/quote-variable.case

3'x{\text{'}}{\mathrm{x}}’x{\text{'}}{\mathrm{x}}

spec/ambiguity/quoted-left-is-operand.case

3'+ r_/ A{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{A}}’+ r‾/ A{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{A}}

spec/ambiguity/reject-string-number-strand.case

4"ab" 12{\text{"ab"}}\ {12}"ab" 12{\text{"ab"}}\ {12}

spec/ambiguity/statement-in-parens.case

3(a := 1; a){(}{\mathrm{a}}\ {\leftarrow}\ {1}{\diamond}\ {\mathrm{a}}{)}(a ← 1⋄ a){(}{\mathrm{a}}\ {\leftarrow}\ {1}{\diamond}\ {\mathrm{a}}{)}

spec/ambiguity/symbol-after-function.case

3f_ + x{\mathrm{\underline{f}}}\ {+}\ {\mathrm{x}}f‾ + x{\mathrm{\underline{f}}}\ {+}\ {\mathrm{x}}

spec/ambiguity/symbol-one-argument.case

3- 3{-}\ {3}− 3{-}\ {3}

spec/ambiguity/too-deep.case

3(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((1))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))){(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{1}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((1))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))){(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{(}{1}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}{)}

spec/ambiguity/trailing-symbol.case

32 +{2}\ {+}2 +{2}\ {+}

spec/ambiguity/value-in-train.case

3[x f_]{[}{\mathrm{x}}\ {\mathrm{\underline{f}}}{]}[x f‾]{[}{\mathrm{x}}\ {\mathrm{\underline{f}}}{]}

spec/ambiguity/value-then-operand.case

3x '+ r_/ y{\mathrm{x}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{y}}x ’+ r‾/ y{\mathrm{x}}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{y}}

spec/eval/add.case

31 + 2{1}\ {+}\ {2}1 + 2{1}\ {+}\ {2}

spec/eval/axes.case

7m := 2 3 r_eshape r_ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}m ← 2 3 r‾eshape r‾ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
8r_ev_2 m{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{m}}r‾ev2 m{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{m}}
9r_ev_1 m{{\mathrm{\underline{r}ev}}_{1}}\ {\mathrm{m}}r‾ev1 m{{\mathrm{\underline{r}ev}}_{1}}\ {\mathrm{m}}
101 o_-_2 m{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{m}}1 o‾−2 m{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{m}}
11'+ r_/_2 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}’+ r‾/2 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}
12'+ s_\_2 m{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{m}}’+ s‾\2 m{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{m}}
132 t_ake_2 m{2}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{m}}2 t‾ake2 m{2}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{m}}
14u:f_lip := { r_ev _r }{{}^{\mathrm{u}}\mathrm{\underline{f}lip}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{r}ev}}\ {\_\mathrm{r}}\ {\}}uf‾lip ← { r‾ev _r }{{}^{\mathrm{u}}\mathrm{\underline{f}lip}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{r}ev}}\ {\_\mathrm{r}}\ {\}}
15u:f_lip_2 m{{{}^{\mathrm{u}}\mathrm{\underline{f}lip}}_{2}}\ {\mathrm{m}}uf‾lip2 m{{{}^{\mathrm{u}}\mathrm{\underline{f}lip}}_{2}}\ {\mathrm{m}}
16u:s_um := { '+ r_/ _r }{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {\leftarrow}\ {\{}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\_\mathrm{r}}\ {\}}us‾um ← { ’+ r‾/ _r }{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {\leftarrow}\ {\{}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\_\mathrm{r}}\ {\}}
17u:s_um_2 m{{{}^{\mathrm{u}}\mathrm{\underline{s}um}}_{2}}\ {\mathrm{m}}us‾um2 m{{{}^{\mathrm{u}}\mathrm{\underline{s}um}}_{2}}\ {\mathrm{m}}
18u:p_air := { a b -> a c_at b }{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\mathrm{\underline{c}at}}\ {\mathrm{b}}\ {\}}up‾air ← { a b → a c‾at b }{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\mathrm{\underline{c}at}}\ {\mathrm{b}}\ {\}}
199 u:p_air_2 m{9}\ {{{}^{\mathrm{u}}\mathrm{\underline{p}air}}_{2}}\ {\mathrm{m}}9 up‾air2 m{9}\ {{{}^{\mathrm{u}}\mathrm{\underline{p}air}}_{2}}\ {\mathrm{m}}
20r_ev_1 5{{\mathrm{\underline{r}ev}}_{1}}\ {5}r‾ev1 5{{\mathrm{\underline{r}ev}}_{1}}\ {5}

spec/eval/bool-arithmetic.case

3(3 = 3) + 1{(}{3}\ {=}\ {3}{)}\ {+}\ {1}(3 = 3) + 1{(}{3}\ {=}\ {3}{)}\ {+}\ {1}

spec/eval/bound-condition.case

4a := 1 2 > 0{\mathrm{a}}\ {\leftarrow}\ {1}\ {2}\ {>}\ {0}a ← 1 2 > 0{\mathrm{a}}\ {\leftarrow}\ {1}\ {2}\ {>}\ {0}
51 * a{1}\ {\times}\ {\mathrm{a}}1 × a{1}\ {\times}\ {\mathrm{a}}
6f_loat a{\mathrm{\underline{f}loat}}\ {\mathrm{a}}f‾loat a{\mathrm{\underline{f}loat}}\ {\mathrm{a}}
7'+ r_/ a{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{a}}’+ r‾/ a{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{a}}
8a{\mathrm{a}}a{\mathrm{a}}

spec/eval/cat-axis.case

8(2 2 r_eshape 1) c_at_2 2 2 r_eshape 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}(2 2 r‾eshape 1) c‾at2 2 2 r‾eshape 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}
9(2 2 r_eshape 1 2 3 4) c_at_2 9 8{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {9}\ {8}(2 2 r‾eshape 1 2 3 4) c‾at2 9 8{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {9}\ {8}
107 c_at_2 2 2 r_eshape 1 2 3 4{7}\ {{\mathrm{\underline{c}at}}_{2}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}7 c‾at2 2 2 r‾eshape 1 2 3 4{7}\ {{\mathrm{\underline{c}at}}_{2}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}
119 8 c_at_2 2 2 r_eshape 1 2 3 4{9}\ {8}\ {{\mathrm{\underline{c}at}}_{2}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}9 8 c‾at2 2 2 r‾eshape 1 2 3 4{9}\ {8}\ {{\mathrm{\underline{c}at}}_{2}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}
12(2 3 r_eshape r_ange 6) c_at_1 7 8 9{(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {{\mathrm{\underline{c}at}}_{1}}\ {7}\ {8}\ {9}(2 3 r‾eshape r‾ange 6) c‾at1 7 8 9{(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {{\mathrm{\underline{c}at}}_{1}}\ {7}\ {8}\ {9}
13"ab" c_at_1 "cd"{\text{"ab"}}\ {{\mathrm{\underline{c}at}}_{1}}\ {\text{"cd"}}"ab" c‾at1 "cd"{\text{"ab"}}\ {{\mathrm{\underline{c}at}}_{1}}\ {\text{"cd"}}
14s_hape (2 3 4 r_eshape 0) c_at_2 2 1 4 r_eshape 1{\mathrm{\underline{s}hape}}\ {(}{2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {2}\ {1}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}s‾hape (2 3 4 r‾eshape 0) c‾at2 2 1 4 r‾eshape 1{\mathrm{\underline{s}hape}}\ {(}{2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {2}\ {1}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}
15s_hape (2 3 4 r_eshape 0) c_at_3 2 3 r_eshape 1{\mathrm{\underline{s}hape}}\ {(}{2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {{\mathrm{\underline{c}at}}_{3}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}s‾hape (2 3 4 r‾eshape 0) c‾at3 2 3 r‾eshape 1{\mathrm{\underline{s}hape}}\ {(}{2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {{\mathrm{\underline{c}at}}_{3}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}
16(2 3 4 r_eshape 0) c_at_3 2 3 r_eshape 1{(}{2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {{\mathrm{\underline{c}at}}_{3}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}(2 3 4 r‾eshape 0) c‾at3 2 3 r‾eshape 1{(}{2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {{\mathrm{\underline{c}at}}_{3}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}

spec/eval/closures.case

3n := 3; u:f_ := { x -> x + n }; n := 100; u:f_ 1{\mathrm{n}}\ {\leftarrow}\ {3}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {+}\ {\mathrm{n}}\ {\}}{\diamond}\ {\mathrm{n}}\ {\leftarrow}\ {100}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {1}n ← 3⋄ uf‾ ← { x → x + n }⋄ n ← 100⋄ uf‾ 1{\mathrm{n}}\ {\leftarrow}\ {3}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {+}\ {\mathrm{n}}\ {\}}{\diamond}\ {\mathrm{n}}\ {\leftarrow}\ {100}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {1}

spec/eval/compose.case

4'n_eg 'a_bs c_ompose 3 -4{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {3}\ {-4}’n‾eg ’a‾bs c‾ompose 3 −4{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {3}\ {-4}
5'{ _r * 10 } '{ _r + 1 } c_ompose 2{\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {10}\ {\}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {\mathrm{\underline{c}ompose}}\ {2}’{ _r × 10 } ’{ _r + 1 } c‾ompose 2{\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {10}\ {\}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {\mathrm{\underline{c}ompose}}\ {2}
6u:n_abs := { x -> 'n_eg 'a_bs c_ompose x }{{}^{\mathrm{u}}\mathrm{\underline{n}abs}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {\mathrm{x}}\ {\}}un‾abs ← { x → ’n‾eg ’a‾bs c‾ompose x }{{}^{\mathrm{u}}\mathrm{\underline{n}abs}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {\mathrm{x}}\ {\}}
7u:n_abs -7{{}^{\mathrm{u}}\mathrm{\underline{n}abs}}\ {-7}un‾abs −7{{}^{\mathrm{u}}\mathrm{\underline{n}abs}}\ {-7}
8'f_loat 't_ally c_ompose 1 2 3{\text{'}}{\mathrm{\underline{f}loat}}\ {\text{'}}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{c}ompose}}\ {1}\ {2}\ {3}’f‾loat ’t‾ally c‾ompose 1 2 3{\text{'}}{\mathrm{\underline{f}loat}}\ {\text{'}}{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{c}ompose}}\ {1}\ {2}\ {3}

spec/eval/decode-any.case

82.0 d_ecode 3 -2 1{2.0}\ {\mathrm{\underline{d}ecode}}\ {3}\ {-2}\ {1}2.0 d‾ecode 3 −2 1{2.0}\ {\mathrm{\underline{d}ecode}}\ {3}\ {-2}\ {1}
92 d_ecode 1.5 2.5{2}\ {\mathrm{\underline{d}ecode}}\ {1.5}\ {2.5}2 d‾ecode 1.5 2.5{2}\ {\mathrm{\underline{d}ecode}}\ {1.5}\ {2.5}
102.0 d_ecode 3.0 -2.0 1.0{2.0}\ {\mathrm{\underline{d}ecode}}\ {3.0}\ {-2.0}\ {1.0}2.0 d‾ecode 3.0 −2.0 1.0{2.0}\ {\mathrm{\underline{d}ecode}}\ {3.0}\ {-2.0}\ {1.0}
11c := 1.0 -2.0 3.0{\mathrm{c}}\ {\leftarrow}\ {1.0}\ {-2.0}\ {3.0}c ← 1.0 −2.0 3.0{\mathrm{c}}\ {\leftarrow}\ {1.0}\ {-2.0}\ {3.0}
120.5 d_ecode r_ev c{0.5}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{c}}0.5 d‾ecode r‾ev c{0.5}\ {\mathrm{\underline{d}ecode}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{c}}
131.5 2.0 d_ecode 1.0 1.0{1.5}\ {2.0}\ {\mathrm{\underline{d}ecode}}\ {1.0}\ {1.0}1.5 2.0 d‾ecode 1.0 1.0{1.5}\ {2.0}\ {\mathrm{\underline{d}ecode}}\ {1.0}\ {1.0}
142.0 d_ecode 2 2 r_eshape 1.0 0.5 1.0 0.25{2.0}\ {\mathrm{\underline{d}ecode}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1.0}\ {0.5}\ {1.0}\ {0.25}2.0 d‾ecode 2 2 r‾eshape 1.0 0.5 1.0 0.25{2.0}\ {\mathrm{\underline{d}ecode}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1.0}\ {0.5}\ {1.0}\ {0.25}
15-1.0 d_ecode 1.0 1.0 1.0{-1.0}\ {\mathrm{\underline{d}ecode}}\ {1.0}\ {1.0}\ {1.0}−1.0 d‾ecode 1.0 1.0 1.0{-1.0}\ {\mathrm{\underline{d}ecode}}\ {1.0}\ {1.0}\ {1.0}

spec/eval/display.case

6d_isplay 2 3 r_eshape r_ange 6{\mathrm{\underline{d}isplay}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}d‾isplay 2 3 r‾eshape r‾ange 6{\mathrm{\underline{d}isplay}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
7d_isplay "abc"{\mathrm{\underline{d}isplay}}\ {\text{"abc"}}d‾isplay "abc"{\mathrm{\underline{d}isplay}}\ {\text{"abc"}}
8d_isplay "ab" "cde"{\mathrm{\underline{d}isplay}}\ {\text{"ab"}}\ {\text{"cde"}}d‾isplay "ab" "cde"{\mathrm{\underline{d}isplay}}\ {\text{"ab"}}\ {\text{"cde"}}
9s_hape d_isplay 1 2 3{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{d}isplay}}\ {1}\ {2}\ {3}s‾hape d‾isplay 1 2 3{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{d}isplay}}\ {1}\ {2}\ {3}
10d_isplay 5{\mathrm{\underline{d}isplay}}\ {5}d‾isplay 5{\mathrm{\underline{d}isplay}}\ {5}

spec/eval/division-is-float.case

37 / 2{7}\ {\div}\ {2}7 ÷ 2{7}\ {\div}\ {2}

spec/eval/each-dyadic.case

61 2 3 '+ e_ach 10 20 30{1}\ {2}\ {3}\ {\text{'}}{+}\ {\mathrm{\underline{e}ach}}\ {10}\ {20}\ {30}1 2 3 ’+ e‾ach 10 20 30{1}\ {2}\ {3}\ {\text{'}}{+}\ {\mathrm{\underline{e}ach}}\ {10}\ {20}\ {30}
71 2 3 '= e_ach 1 5 3{1}\ {2}\ {3}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {1}\ {5}\ {3}1 2 3 ’= e‾ach 1 5 3{1}\ {2}\ {3}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {1}\ {5}\ {3}
85 '+ e_ach 1 2 3{5}\ {\text{'}}{+}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}5 ’+ e‾ach 1 2 3{5}\ {\text{'}}{+}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}
91 2 3 '- e_ach 1{1}\ {2}\ {3}\ {\text{'}}{-}\ {\mathrm{\underline{e}ach}}\ {1}1 2 3 ’− e‾ach 1{1}\ {2}\ {3}\ {\text{'}}{-}\ {\mathrm{\underline{e}ach}}\ {1}
10"abc" '= e_ach "abd"{\text{"abc"}}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {\text{"abd"}}"abc" ’= e‾ach "abd"{\text{"abc"}}\ {\text{'}}{=}\ {\mathrm{\underline{e}ach}}\ {\text{"abd"}}
113 1 4 '{ x y -> x < y ? x; y } e_ach 2 2 2{3}\ {1}\ {4}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{x}}\ {<}\ {\mathrm{y}}\ {?}\ {\mathrm{x}}{\diamond}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {2}\ {2}\ {2}3 1 4 ’{ x y → x < y ? x⋄ y } e‾ach 2 2 2{3}\ {1}\ {4}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{x}}\ {<}\ {\mathrm{y}}\ {?}\ {\mathrm{x}}{\diamond}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {2}\ {2}\ {2}
12u:m_in2 := { x y -> x < y ? x; y }{{}^{\mathrm{u}}\mathrm{\underline{m}in2}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{x}}\ {<}\ {\mathrm{y}}\ {?}\ {\mathrm{x}}{\diamond}\ {\mathrm{y}}\ {\}}um‾in2 ← { x y → x < y ? x⋄ y }{{}^{\mathrm{u}}\mathrm{\underline{m}in2}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{x}}\ {<}\ {\mathrm{y}}\ {?}\ {\mathrm{x}}{\diamond}\ {\mathrm{y}}\ {\}}
13(2 2 r_eshape 1 5 3 7) 'u:m_in2 e_ach 4{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {5}\ {3}\ {7}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{m}in2}}\ {\mathrm{\underline{e}ach}}\ {4}(2 2 r‾eshape 1 5 3 7) ’um‾in2 e‾ach 4{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {5}\ {3}\ {7}{)}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{m}in2}}\ {\mathrm{\underline{e}ach}}\ {4}

spec/eval/each.case

6'n_eg e_ach 1 2 3{\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}’n‾eg e‾ach 1 2 3{\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}
7u:s_ign := { x -> x < 0 ? -1; x = 0 ? 0; 1 }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}us‾ign ← { x → x < 0 ? −1⋄ x = 0 ? 0⋄ 1 }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {-1}{\diamond}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {\}}
8'u:s_ign e_ach -5 0 7{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {-5}\ {0}\ {7}’us‾ign e‾ach −5 0 7{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {-5}\ {0}\ {7}
9'u:s_ign e_ach 2 2 r_eshape -1 0 1 2{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {-1}\ {0}\ {1}\ {2}’us‾ign e‾ach 2 2 r‾eshape −1 0 1 2{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {-1}\ {0}\ {1}\ {2}
10'u:s_ign e_ach 4{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {4}’us‾ign e‾ach 4{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {4}
11t_ally 'u:s_ign e_ach 0 t_ake 1 2{\mathrm{\underline{t}ally}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}t‾ally ’us‾ign e‾ach 0 t‾ake 1 2{\mathrm{\underline{t}ally}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\mathrm{\underline{e}ach}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}
12'p_rint! e_ach 1 2{\text{'}}{\mathrm{\underline{p}rint}{!}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}’p‾rint! e‾ach 1 2{\text{'}}{\mathrm{\underline{p}rint}{!}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}

spec/eval/empty-char-kind.case

6d_isplay ""{\mathrm{\underline{d}isplay}}\ {\text{""}}d‾isplay ""{\mathrm{\underline{d}isplay}}\ {\text{""}}
7d_isplay 0 r_eshape 1{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{r}eshape}}\ {1}d‾isplay 0 r‾eshape 1{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{r}eshape}}\ {1}
8s_hape ""{\mathrm{\underline{s}hape}}\ {\text{""}}s‾hape ""{\mathrm{\underline{s}hape}}\ {\text{""}}

spec/eval/empty-kind-boxes.case

4d_isplay 0 t_ake e_nclose "ab"{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\mathrm{\underline{e}nclose}}\ {\text{"ab"}}d‾isplay 0 t‾ake e‾nclose "ab"{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\mathrm{\underline{e}nclose}}\ {\text{"ab"}}
5d_isplay e_nclose ""{\mathrm{\underline{d}isplay}}\ {\mathrm{\underline{e}nclose}}\ {\text{""}}d‾isplay e‾nclose ""{\mathrm{\underline{d}isplay}}\ {\mathrm{\underline{e}nclose}}\ {\text{""}}

spec/eval/empty-kind-primitives.case

5d_isplay 0 r_eshape "abc"{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{r}eshape}}\ {\text{"abc"}}d‾isplay 0 r‾eshape "abc"{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{r}eshape}}\ {\text{"abc"}}
6d_isplay 0 0 0 r_eplicate "abc"{\mathrm{\underline{d}isplay}}\ {0}\ {0}\ {0}\ {\mathrm{\underline{r}eplicate}}\ {\text{"abc"}}d‾isplay 0 0 0 r‾eplicate "abc"{\mathrm{\underline{d}isplay}}\ {0}\ {0}\ {0}\ {\mathrm{\underline{r}eplicate}}\ {\text{"abc"}}
7d_isplay (0 t_ake 1 2) s_elect "abc"{\mathrm{\underline{d}isplay}}\ {(}{0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}{)}\ {\mathrm{\underline{s}elect}}\ {\text{"abc"}}d‾isplay (0 t‾ake 1 2) s‾elect "abc"{\mathrm{\underline{d}isplay}}\ {(}{0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}{)}\ {\mathrm{\underline{s}elect}}\ {\text{"abc"}}
8d_isplay "" c_at ""{\mathrm{\underline{d}isplay}}\ {\text{""}}\ {\mathrm{\underline{c}at}}\ {\text{""}}d‾isplay "" c‾at ""{\mathrm{\underline{d}isplay}}\ {\text{""}}\ {\mathrm{\underline{c}at}}\ {\text{""}}
9d_isplay r_avel 0 t_ake "abc"{\mathrm{\underline{d}isplay}}\ {\mathrm{\underline{r}avel}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\text{"abc"}}d‾isplay r‾avel 0 t‾ake "abc"{\mathrm{\underline{d}isplay}}\ {\mathrm{\underline{r}avel}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\text{"abc"}}
10d_isplay r_ev 0 t_ake "abc"{\mathrm{\underline{d}isplay}}\ {\mathrm{\underline{r}ev}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\text{"abc"}}d‾isplay r‾ev 0 t‾ake "abc"{\mathrm{\underline{d}isplay}}\ {\mathrm{\underline{r}ev}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\text{"abc"}}
11d_isplay 0 t_ake 1 1 p_artition "ab"{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {1}\ {\mathrm{\underline{p}artition}}\ {\text{"ab"}}d‾isplay 0 t‾ake 1 1 p‾artition "ab"{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {1}\ {\mathrm{\underline{p}artition}}\ {\text{"ab"}}
12d_isplay '{ _r } e_ach 0 t_ake "abc"{\mathrm{\underline{d}isplay}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\text{"abc"}}d‾isplay ’{ _r } e‾ach 0 t‾ake "abc"{\mathrm{\underline{d}isplay}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\text{"abc"}}
13d_isplay (0 t_ake "ab") 'l_eft t_able "ab"{\mathrm{\underline{d}isplay}}\ {(}{0}\ {\mathrm{\underline{t}ake}}\ {\text{"ab"}}{)}\ {\text{'}}{\mathrm{\underline{l}eft}}\ {\mathrm{\underline{t}able}}\ {\text{"ab"}}d‾isplay (0 t‾ake "ab") ’l‾eft t‾able "ab"{\mathrm{\underline{d}isplay}}\ {(}{0}\ {\mathrm{\underline{t}ake}}\ {\text{"ab"}}{)}\ {\text{'}}{\mathrm{\underline{l}eft}}\ {\mathrm{\underline{t}able}}\ {\text{"ab"}}
14d_isplay w_here 0 t_ake 1 0{\mathrm{\underline{d}isplay}}\ {\mathrm{\underline{w}here}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {0}d‾isplay w‾here 0 t‾ake 1 0{\mathrm{\underline{d}isplay}}\ {\mathrm{\underline{w}here}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {0}

spec/eval/empty-kind-through-take.case

5d_isplay 0 t_ake "abc"{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\text{"abc"}}d‾isplay 0 t‾ake "abc"{\mathrm{\underline{d}isplay}}\ {0}\ {\mathrm{\underline{t}ake}}\ {\text{"abc"}}
6d_isplay 2 d_rop "ab"{\mathrm{\underline{d}isplay}}\ {2}\ {\mathrm{\underline{d}rop}}\ {\text{"ab"}}d‾isplay 2 d‾rop "ab"{\mathrm{\underline{d}isplay}}\ {2}\ {\mathrm{\underline{d}rop}}\ {\text{"ab"}}

spec/eval/encode-decode.case

82 2 2 e_ncode 5{2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {5}2 2 2 e‾ncode 5{2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {5}
92 2 2 e_ncode 5 6{2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {5}\ {6}2 2 2 e‾ncode 5 6{2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {5}\ {6}
1024 60 60 e_ncode 3725{24}\ {60}\ {60}\ {\mathrm{\underline{e}ncode}}\ {3725}24 60 60 e‾ncode 3725{24}\ {60}\ {60}\ {\mathrm{\underline{e}ncode}}\ {3725}
110 10 e_ncode 123{0}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}0 10 e‾ncode 123{0}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}
1210 e_ncode 123{10}\ {\mathrm{\underline{e}ncode}}\ {123}10 e‾ncode 123{10}\ {\mathrm{\underline{e}ncode}}\ {123}
132 2 e_ncode 7{2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {7}2 2 e‾ncode 7{2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {7}
142 2 2 e_ncode -1{2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {-1}2 2 2 e‾ncode −1{2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {-1}
152 d_ecode 1 0 1{2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {0}\ {1}2 d‾ecode 1 0 1{2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {0}\ {1}
1610 d_ecode 1 2 3{10}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {3}10 d‾ecode 1 2 3{10}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {3}
1724 60 60 d_ecode 1 2 5{24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {5}24 60 60 d‾ecode 1 2 5{24}\ {60}\ {60}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {5}
182 d_ecode 3 2 r_eshape 1 1 0 1 1 0{2}\ {\mathrm{\underline{d}ecode}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {0}\ {1}\ {1}\ {0}2 d‾ecode 3 2 r‾eshape 1 1 0 1 1 0{2}\ {\mathrm{\underline{d}ecode}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {0}\ {1}\ {1}\ {0}
192 d_ecode 2 2 2 e_ncode r_ange 7{2}\ {\mathrm{\underline{d}ecode}}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{r}ange}}\ {7}2 d‾ecode 2 2 2 e‾ncode r‾ange 7{2}\ {\mathrm{\underline{d}ecode}}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{\underline{r}ange}}\ {7}
202 d_ecode 1 2 3 = 1{2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {3}\ {=}\ {1}2 d‾ecode 1 2 3 = 1{2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {2}\ {3}\ {=}\ {1}

spec/eval/ensure-error.case

5'{ @ -> p_rint! 3; "x" []S_IGNAL "y" } []E_NSURE '{ @ -> p_rint! "cleaned" }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {3}{\diamond}\ {\text{"x"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"y"}}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}’{ @ → p‾rint! 3⋄ "x" □S‾IGNAL "y" } □E‾NSURE ’{ @ → p‾rint! "cleaned" }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {3}{\diamond}\ {\text{"x"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"y"}}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}

spec/eval/ensure.case

5'{ @ -> p_rint! 1; 2 } []E_NSURE '{ @ -> p_rint! "cleaned" }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {1}{\diamond}\ {2}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}’{ @ → p‾rint! 1⋄ 2 } □E‾NSURE ’{ @ → p‾rint! "cleaned" }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {1}{\diamond}\ {2}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}

spec/eval/evaluation-order.case

3(p_rint! 1) + p_rint! 2{(}{\mathrm{\underline{p}rint}{!}}\ {1}{)}\ {+}\ {\mathrm{\underline{p}rint}{!}}\ {2}(p‾rint! 1) + p‾rint! 2{(}{\mathrm{\underline{p}rint}{!}}\ {1}{)}\ {+}\ {\mathrm{\underline{p}rint}{!}}\ {2}

spec/eval/exact-equality.case

3(0.1 + 0.2) = 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {=}\ {0.3}(0.1 + 0.2) = 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {=}\ {0.3}
4(0.1 + 0.2) e_q~ 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {\mathrm{\underline{e}q}{\sim}}\ {0.3}(0.1 + 0.2) e‾q∼ 0.3{(}{0.1}\ {+}\ {0.2}{)}\ {\mathrm{\underline{e}q}{\sim}}\ {0.3}
53 = 3.0{3}\ {=}\ {3.0}3 = 3.0{3}\ {=}\ {3.0}

spec/eval/exponent-canonical.case

50.0000001 + 100000000000000000000000.0{0.0000001}\ {+}\ {100000000000000000000000.0}0.0000001 + 100000000000000000000000.0{0.0000001}\ {+}\ {100000000000000000000000.0}

spec/eval/exponent-literals.case

32E3 + 1{2E3}\ {+}\ {1}2E3 + 1{2E3}\ {+}\ {1}
41.5e-3 * 2{1.5e-3}\ {\times}\ {2}1.5e−3 × 2{1.5e-3}\ {\times}\ {2}
51e2 = 100.0{1e2}\ {=}\ {100.0}1e2 = 100.0{1e2}\ {=}\ {100.0}

spec/eval/factorial.case

3u:f_act := { n ->{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}uf‾act ← { n →{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
4 n <= 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}  n ≤ 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}
5 n * u:f_act n - 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}  n × uf‾act n − 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}
6}{\}}}{\}}
7u:f_act 10{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}uf‾act 10{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}

spec/eval/float-printing.case

410.0 ^ 20{10.0}\ {\mathbin{\hat{}}}\ {20}10.0 ^ 20{10.0}\ {\mathbin{\hat{}}}\ {20}
510.0 ^ -7{10.0}\ {\mathbin{\hat{}}}\ {-7}10.0 ^ −7{10.0}\ {\mathbin{\hat{}}}\ {-7}
65.0{5.0}5.0{5.0}
71.0 / 3{1.0}\ {\div}\ {3}1.0 ÷ 3{1.0}\ {\div}\ {3}

spec/eval/format.case

5f_ormat 1 2.5 -3{\mathrm{\underline{f}ormat}}\ {1}\ {2.5}\ {-3}f‾ormat 1 2.5 −3{\mathrm{\underline{f}ormat}}\ {1}\ {2.5}\ {-3}
6t_ally f_ormat 42{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{f}ormat}}\ {42}t‾ally f‾ormat 42{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{f}ormat}}\ {42}
7n_umbers "1 2.5 -3"{\mathrm{\underline{n}umbers}}\ {\text{"1 2.5 -3"}}n‾umbers "1 2.5 -3"{\mathrm{\underline{n}umbers}}\ {\text{"1 2.5 -3"}}
8n_umbers f_ormat 2 2 r_eshape 1.5 2 3 4{\mathrm{\underline{n}umbers}}\ {\mathrm{\underline{f}ormat}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1.5}\ {2}\ {3}\ {4}n‾umbers f‾ormat 2 2 r‾eshape 1.5 2 3 4{\mathrm{\underline{n}umbers}}\ {\mathrm{\underline{f}ormat}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1.5}\ {2}\ {3}\ {4}
9f_loor f_irst n_umbers " 7 "{\mathrm{\underline{f}loor}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{n}umbers}}\ {\text{" 7 "}}f‾loor f‾irst n‾umbers " 7 "{\mathrm{\underline{f}loor}}\ {\mathrm{\underline{f}irst}}\ {\mathrm{\underline{n}umbers}}\ {\text{" 7 "}}

spec/eval/grid.case

4[]G_RID 1 0{\square \mathrm{\underline{G}RID}}\ {1}\ {0}□G‾RID 1 0{\square \mathrm{\underline{G}RID}}\ {1}\ {0}

spec/eval/identity-and-tacks.case

5i_d 5{\mathrm{\underline{i}d}}\ {5}i‾d 5{\mathrm{\underline{i}d}}\ {5}
6i_d 1 2 3{\mathrm{\underline{i}d}}\ {1}\ {2}\ {3}i‾d 1 2 3{\mathrm{\underline{i}d}}\ {1}\ {2}\ {3}
73 l_eft 4{3}\ {\mathrm{\underline{l}eft}}\ {4}3 l‾eft 4{3}\ {\mathrm{\underline{l}eft}}\ {4}
83 r_ight 4{3}\ {\mathrm{\underline{r}ight}}\ {4}3 r‾ight 4{3}\ {\mathrm{\underline{r}ight}}\ {4}
91 l_eft 1 2 3{1}\ {\mathrm{\underline{l}eft}}\ {1}\ {2}\ {3}1 l‾eft 1 2 3{1}\ {\mathrm{\underline{l}eft}}\ {1}\ {2}\ {3}
103 [l_eft + r_ight] 4{3}\ {[}{\mathrm{\underline{l}eft}}\ {+}\ {\mathrm{\underline{r}ight}}{]}\ {4}3 [l‾eft + r‾ight] 4{3}\ {[}{\mathrm{\underline{l}eft}}\ {+}\ {\mathrm{\underline{r}ight}}{]}\ {4}

spec/eval/inner-empty.case

4(0 t_ake 1) '+ '* i_nner 0 t_ake 1{(}{0}\ {\mathrm{\underline{t}ake}}\ {1}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}(0 t‾ake 1) ’+ ’× i‾nner 0 t‾ake 1{(}{0}\ {\mathrm{\underline{t}ake}}\ {1}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}
5(0 t_ake 1.5) '+ '* i_nner 0 t_ake 1.5{(}{0}\ {\mathrm{\underline{t}ake}}\ {1.5}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}(0 t‾ake 1.5) ’+ ’× i‾nner 0 t‾ake 1.5{(}{0}\ {\mathrm{\underline{t}ake}}\ {1.5}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}
6(0 t_ake 1.5) '* '* i_nner 0 t_ake 1.5{(}{0}\ {\mathrm{\underline{t}ake}}\ {1.5}{)}\ {\text{'}}{\times}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}(0 t‾ake 1.5) ’× ’× i‾nner 0 t‾ake 1.5{(}{0}\ {\mathrm{\underline{t}ake}}\ {1.5}{)}\ {\text{'}}{\times}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}

spec/eval/inner.case

71 2 3 '+ '* i_nner 4 5 6{1}\ {2}\ {3}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {4}\ {5}\ {6}1 2 3 ’+ ’× i‾nner 4 5 6{1}\ {2}\ {3}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {4}\ {5}\ {6}
8(2 2 r_eshape 1 2 3 4) '+ '* i_nner 2 2 r_eshape 5 6 7 8{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {5}\ {6}\ {7}\ {8}(2 2 r‾eshape 1 2 3 4) ’+ ’× i‾nner 2 2 r‾eshape 5 6 7 8{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {5}\ {6}\ {7}\ {8}
9(2 3 r_eshape r_ange 6) '+ '* i_nner 1 1 1{(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}(2 3 r‾eshape r‾ange 6) ’+ ’× i‾nner 1 1 1{(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}
102 '+ '* i_nner 1 2 3{2}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {2}\ {3}2 ’+ ’× i‾nner 1 2 3{2}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {2}\ {3}
111 2 3 'm_ax '+ i_nner 3 2 1{1}\ {2}\ {3}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\text{'}}{+}\ {\mathrm{\underline{i}nner}}\ {3}\ {2}\ {1}1 2 3 ’m‾ax ’+ i‾nner 3 2 1{1}\ {2}\ {3}\ {\text{'}}{\mathrm{\underline{m}ax}}\ {\text{'}}{+}\ {\mathrm{\underline{i}nner}}\ {3}\ {2}\ {1}
12"abc" '& '= i_nner "abc"{\text{"abc"}}\ {\text{'}}{\wedge}\ {\text{'}}{=}\ {\mathrm{\underline{i}nner}}\ {\text{"abc"}}"abc" ’∧ ’= i‾nner "abc"{\text{"abc"}}\ {\text{'}}{\wedge}\ {\text{'}}{=}\ {\mathrm{\underline{i}nner}}\ {\text{"abc"}}
131 2 3 '- '* i_nner 1 1 1{1}\ {2}\ {3}\ {\text{'}}{-}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}1 2 3 ’− ’× i‾nner 1 1 1{1}\ {2}\ {3}\ {\text{'}}{-}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {1}\ {1}
141 2 3 '+ '= i_nner 1 5 3{1}\ {2}\ {3}\ {\text{'}}{+}\ {\text{'}}{=}\ {\mathrm{\underline{i}nner}}\ {1}\ {5}\ {3}1 2 3 ’+ ’= i‾nner 1 5 3{1}\ {2}\ {3}\ {\text{'}}{+}\ {\text{'}}{=}\ {\mathrm{\underline{i}nner}}\ {1}\ {5}\ {3}

spec/eval/integer-division.case

37 d_iv 2{7}\ {\mathrm{\underline{d}iv}}\ {2}7 d‾iv 2{7}\ {\mathrm{\underline{d}iv}}\ {2}
4-7 d_iv 2{-7}\ {\mathrm{\underline{d}iv}}\ {2}−7 d‾iv 2{-7}\ {\mathrm{\underline{d}iv}}\ {2}
5-7 m_od 3{-7}\ {\mathrm{\underline{m}od}}\ {3}−7 m‾od 3{-7}\ {\mathrm{\underline{m}od}}\ {3}

spec/eval/lazy-parameter.case

3u:w_hen := { c ~a ~b -> c ? a; b }{{}^{\mathrm{u}}\mathrm{\underline{w}hen}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\sim}{\mathrm{a}}\ {\sim}{\mathrm{b}}\ {\to}\ {\mathrm{c}}\ {?}\ {\mathrm{a}}{\diamond}\ {\mathrm{b}}\ {\}}uw‾hen ← { c ∼a ∼b → c ? a⋄ b }{{}^{\mathrm{u}}\mathrm{\underline{w}hen}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\sim}{\mathrm{a}}\ {\sim}{\mathrm{b}}\ {\to}\ {\mathrm{c}}\ {?}\ {\mathrm{a}}{\diamond}\ {\mathrm{b}}\ {\}}
4((u:w_hen 1 = 1)_ 42)_ 1 / 0{(}{(}{{}^{\mathrm{u}}\mathrm{\underline{w}hen}}\ {1}\ {=}\ {1}{)}{\_}\ {42}{)}{\_}\ {1}\ {\div}\ {0}((uw‾hen 1 = 1)_ 42)_ 1 ÷ 0{(}{(}{{}^{\mathrm{u}}\mathrm{\underline{w}hen}}\ {1}\ {=}\ {1}{)}{\_}\ {42}{)}{\_}\ {1}\ {\div}\ {0}

spec/eval/literal-is-polymorphic.case

33 + 2.5{3}\ {+}\ {2.5}3 + 2.5{3}\ {+}\ {2.5}

spec/eval/local-poly-literal.case

3{ c -> k_ := { @ -> 2 }; p_rint! (k_ @) d_iv 1; c ? k_ @; 2.5 } 1{\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{\underline{k}}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {2}\ {\}}{\diamond}\ {\mathrm{\underline{p}rint}{!}}\ {(}{\mathrm{\underline{k}}}\ {@}{)}\ {\mathrm{\underline{d}iv}}\ {1}{\diamond}\ {\mathrm{c}}\ {?}\ {\mathrm{\underline{k}}}\ {@}{\diamond}\ {2.5}\ {\}}\ {1}{ c → k‾ ← { @ → 2 }⋄ p‾rint! (k‾ @) d‾iv 1⋄ c ? k‾ @⋄ 2.5 } 1{\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{\underline{k}}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {2}\ {\}}{\diamond}\ {\mathrm{\underline{p}rint}{!}}\ {(}{\mathrm{\underline{k}}}\ {@}{)}\ {\mathrm{\underline{d}iv}}\ {1}{\diamond}\ {\mathrm{c}}\ {?}\ {\mathrm{\underline{k}}}\ {@}{\diamond}\ {2.5}\ {\}}\ {1}

spec/eval/map.case

5t_ally 'r_ange m_ap 1 2 3{\mathrm{\underline{t}ally}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}t‾ally ’r‾ange m‾ap 1 2 3{\mathrm{\underline{t}ally}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}
6d_isclose 3 s_elect 'r_ange m_ap 1 2 3{\mathrm{\underline{d}isclose}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}d‾isclose 3 s‾elect ’r‾ange m‾ap 1 2 3{\mathrm{\underline{d}isclose}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}
7'{ r_ev d_isclose _r } m_ap "ab" "cde"{\text{'}}{\{}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{d}isclose}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\text{"ab"}}\ {\text{"cde"}}’{ r‾ev d‾isclose _r } m‾ap "ab" "cde"{\text{'}}{\{}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{d}isclose}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\text{"ab"}}\ {\text{"cde"}}
8'{ t_ally d_isclose _r } e_ach 'r_ange m_ap 1 2 3{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}’{ t‾ally d‾isclose _r } e‾ach ’r‾ange m‾ap 1 2 3{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}

spec/eval/match.case

41 2 3 m_atch 1 2 3{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}1 2 3 m‾atch 1 2 3{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}
51 2 3 m_atch 1 2 4{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {4}1 2 3 m‾atch 1 2 4{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {4}
61 2 3 m_atch 1 2{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}1 2 3 m‾atch 1 2{1}\ {2}\ {3}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}
7(2 2 r_eshape 1 2 3 4) m_atch 1 2 3 4{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}\ {4}(2 2 r‾eshape 1 2 3 4) m‾atch 1 2 3 4{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\mathrm{\underline{m}atch}}\ {1}\ {2}\ {3}\ {4}
8"abc" m_atch "abc"{\text{"abc"}}\ {\mathrm{\underline{m}atch}}\ {\text{"abc"}}"abc" m‾atch "abc"{\text{"abc"}}\ {\mathrm{\underline{m}atch}}\ {\text{"abc"}}
91 m_atch 1{1}\ {\mathrm{\underline{m}atch}}\ {1}1 m‾atch 1{1}\ {\mathrm{\underline{m}atch}}\ {1}
101 = 1 s_elect 1 2 3{1}\ {=}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {2}\ {3}1 = 1 s‾elect 1 2 3{1}\ {=}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {2}\ {3}
111 m_atch 1 s_elect 1 2 3{1}\ {\mathrm{\underline{m}atch}}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {2}\ {3}1 m‾atch 1 s‾elect 1 2 3{1}\ {\mathrm{\underline{m}atch}}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {2}\ {3}

spec/eval/multi-axis-polymorphic.case

4u:t_otal := { '+ r_/_12 _r }{{}^{\mathrm{u}}\mathrm{\underline{t}otal}}\ {\leftarrow}\ {\{}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\_\mathrm{r}}\ {\}}ut‾otal ← { ’+ r‾/12 _r }{{}^{\mathrm{u}}\mathrm{\underline{t}otal}}\ {\leftarrow}\ {\{}\ {\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\_\mathrm{r}}\ {\}}
5u:t_otal 2 2 r_eshape 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{t}otal}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}ut‾otal 2 2 r‾eshape 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{t}otal}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}
6u:t_otal 2 2 r_eshape 0.5{{}^{\mathrm{u}}\mathrm{\underline{t}otal}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0.5}ut‾otal 2 2 r‾eshape 0.5{{}^{\mathrm{u}}\mathrm{\underline{t}otal}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0.5}
7u:t_otal 0 2 r_eshape 1.5{{}^{\mathrm{u}}\mathrm{\underline{t}otal}}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1.5}ut‾otal 0 2 r‾eshape 1.5{{}^{\mathrm{u}}\mathrm{\underline{t}otal}}\ {0}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1.5}

spec/eval/multi-axis.case

7b := 3 3 r_eshape 1 2 3 4 5 6 7 8 9{\mathrm{b}}\ {\leftarrow}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}\ {7}\ {8}\ {9}b ← 3 3 r‾eshape 1 2 3 4 5 6 7 8 9{\mathrm{b}}\ {\leftarrow}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {5}\ {6}\ {7}\ {8}\ {9}
81 o_-_12 b{1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{b}}1 o‾−12 b{1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{b}}
9s_hape -1 0 1 o_-_12 b{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{b}}s‾hape −1 0 1 o‾−12 b{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{b}}
10s_hape -1 0 1 o_-_2 b{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{b}}s‾hape −1 0 1 o‾−2 b{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{b}}
11-1 0 1 o_-_1 1 2 3{-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {1}\ {2}\ {3}−1 0 1 o‾−1 1 2 3{-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {1}\ {2}\ {3}
12'+ r_/_12 -1 0 1 o_-_12 b{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{b}}’+ r‾/12 −1 0 1 o‾−12 b{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\mathrm{b}}
13'+ r_/_12 b{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{b}}’+ r‾/12 b{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{b}}
14'+ r_/_21 b{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{21}}\ {\mathrm{b}}’+ r‾/21 b{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{21}}\ {\mathrm{b}}
15'+ s_\_12 b{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{12}}\ {\mathrm{b}}’+ s‾\12 b{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{12}}\ {\mathrm{b}}
16'- r_/_12 2 2 r_eshape 10 1 2 3{\text{'}}{-}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {10}\ {1}\ {2}\ {3}’− r‾/12 2 2 r‾eshape 10 1 2 3{\text{'}}{-}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {10}\ {1}\ {2}\ {3}

spec/eval/mutation.case

3c! := 0; u:b_ump! := { @ -> c! := c! + 1 }; u:b_ump! @; u:b_ump! @; c!{\mathrm{c}!}\ {\leftarrow}\ {0}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{b}ump}{!}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\mathrm{c}!}\ {\leftarrow}\ {\mathrm{c}!}\ {+}\ {1}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{b}ump}{!}}\ {@}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{b}ump}{!}}\ {@}{\diamond}\ {\mathrm{c}!}c! ← 0⋄ ub‾ump! ← { @ → c! ← c! + 1 }⋄ ub‾ump! @⋄ ub‾ump! @⋄ c!{\mathrm{c}!}\ {\leftarrow}\ {0}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{b}ump}{!}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\mathrm{c}!}\ {\leftarrow}\ {\mathrm{c}!}\ {+}\ {1}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{b}ump}{!}}\ {@}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{b}ump}{!}}\ {@}{\diamond}\ {\mathrm{c}!}

spec/eval/mutual-recursion.case

3u:e_ven? := { n -> n = 0 ? 1; u:o_dd? n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{o}dd}{?}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}ue‾ven? ← { n → n = 0 ? 1⋄ uo‾dd? n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{o}dd}{?}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
4u:o_dd? := { n -> n = 0 ? 0; u:e_ven? n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{o}dd}{?}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uo‾dd? ← { n → n = 0 ? 0⋄ ue‾ven? n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{o}dd}{?}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
5u:e_ven? 7{{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {7}ue‾ven? 7{{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {7}

spec/eval/nested-equal.case

4("ab" "cd") m_atch "ab" "cd"{(}{\text{"ab"}}\ {\text{"cd"}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"ab"}}\ {\text{"cd"}}("ab" "cd") m‾atch "ab" "cd"{(}{\text{"ab"}}\ {\text{"cd"}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"ab"}}\ {\text{"cd"}}
5("ab" "cd") m_atch "ab" "ce"{(}{\text{"ab"}}\ {\text{"cd"}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"ab"}}\ {\text{"ce"}}("ab" "cd") m‾atch "ab" "ce"{(}{\text{"ab"}}\ {\text{"cd"}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"ab"}}\ {\text{"ce"}}
6("ab" "cd") = "ab" "ce"{(}{\text{"ab"}}\ {\text{"cd"}}{)}\ {=}\ {\text{"ab"}}\ {\text{"ce"}}("ab" "cd") = "ab" "ce"{(}{\text{"ab"}}\ {\text{"cd"}}{)}\ {=}\ {\text{"ab"}}\ {\text{"ce"}}
7t_ally u_nique "ab" "cd" "ab"{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {\text{"ab"}}\ {\text{"cd"}}\ {\text{"ab"}}t‾ally u‾nique "ab" "cd" "ab"{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {\text{"ab"}}\ {\text{"cd"}}\ {\text{"ab"}}
8("ab" "cd" "ef") i_ndexOf "ef" "ab" "zz"{(}{\text{"ab"}}\ {\text{"cd"}}\ {\text{"ef"}}{)}\ {\mathrm{\underline{i}ndexOf}}\ {\text{"ef"}}\ {\text{"ab"}}\ {\text{"zz"}}("ab" "cd" "ef") i‾ndexOf "ef" "ab" "zz"{(}{\text{"ab"}}\ {\text{"cd"}}\ {\text{"ef"}}{)}\ {\mathrm{\underline{i}ndexOf}}\ {\text{"ef"}}\ {\text{"ab"}}\ {\text{"zz"}}
9("ab" "cd") m_atch (e_nclose "ab") c_at e_nclose "cd"{(}{\text{"ab"}}\ {\text{"cd"}}{)}\ {\mathrm{\underline{m}atch}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"ab"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"cd"}}("ab" "cd") m‾atch (e‾nclose "ab") c‾at e‾nclose "cd"{(}{\text{"ab"}}\ {\text{"cd"}}{)}\ {\mathrm{\underline{m}atch}}\ {(}{\mathrm{\underline{e}nclose}}\ {\text{"ab"}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\text{"cd"}}

spec/eval/nested.case

7"ab" "cde"{\text{"ab"}}\ {\text{"cde"}}"ab" "cde"{\text{"ab"}}\ {\text{"cde"}}
8t_ally "ab" "cde"{\mathrm{\underline{t}ally}}\ {\text{"ab"}}\ {\text{"cde"}}t‾ally "ab" "cde"{\mathrm{\underline{t}ally}}\ {\text{"ab"}}\ {\text{"cde"}}
9d_isclose 2 s_elect "ab" "cde"{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\text{"ab"}}\ {\text{"cde"}}d‾isclose 2 s‾elect "ab" "cde"{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\text{"ab"}}\ {\text{"cde"}}
10e_nclose "abc"{\mathrm{\underline{e}nclose}}\ {\text{"abc"}}e‾nclose "abc"{\mathrm{\underline{e}nclose}}\ {\text{"abc"}}
11e_nclose 5{\mathrm{\underline{e}nclose}}\ {5}e‾nclose 5{\mathrm{\underline{e}nclose}}\ {5}
12(e_nclose 1) c_at e_nclose 2 3{(}{\mathrm{\underline{e}nclose}}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {2}\ {3}(e‾nclose 1) c‾at e‾nclose 2 3{(}{\mathrm{\underline{e}nclose}}\ {1}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {2}\ {3}
132 2 r_eshape "a" "bb" "ccc" "d"{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\text{"a"}}\ {\text{"bb"}}\ {\text{"ccc"}}\ {\text{"d"}}2 2 r‾eshape "a" "bb" "ccc" "d"{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\text{"a"}}\ {\text{"bb"}}\ {\text{"ccc"}}\ {\text{"d"}}
14e_nclose "ab" "cd"{\mathrm{\underline{e}nclose}}\ {\text{"ab"}}\ {\text{"cd"}}e‾nclose "ab" "cd"{\mathrm{\underline{e}nclose}}\ {\text{"ab"}}\ {\text{"cd"}}

spec/eval/partial-application.case

3u:s_ub := { _l - _r }; (u:s_ub 10)_ 3{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {10}{)}{\_}\ {3}us‾ub ← { _l − _r }⋄ (us‾ub 10)_ 3{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {10}{)}{\_}\ {3}

spec/eval/partition.case

6t_ally (1 1 0 1 1 1 0 1) p_artition "ab cde f"{\mathrm{\underline{t}ally}}\ {(}{1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"ab cde f"}}t‾ally (1 1 0 1 1 1 0 1) p‾artition "ab cde f"{\mathrm{\underline{t}ally}}\ {(}{1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"ab cde f"}}
7d_isclose 2 s_elect (1 1 0 1 1 1 0 1) p_artition "ab cde f"{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {(}{1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"ab cde f"}}d‾isclose 2 s‾elect (1 1 0 1 1 1 0 1) p‾artition "ab cde f"{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {(}{1}\ {1}\ {0}\ {1}\ {1}\ {1}\ {0}\ {1}{)}\ {\mathrm{\underline{p}artition}}\ {\text{"ab cde f"}}
8s := "the quick brown fox"{\mathrm{s}}\ {\leftarrow}\ {\text{"the quick brown fox"}}s ← "the quick brown fox"{\mathrm{s}}\ {\leftarrow}\ {\text{"the quick brown fox"}}
9t_ally (s != f_irst " ") p_artition s{\mathrm{\underline{t}ally}}\ {(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}t‾ally (s ≠ f‾irst " ") p‾artition s{\mathrm{\underline{t}ally}}\ {(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}
10'{ t_ally d_isclose _r } e_ach (s != f_irst " ") p_artition s{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}’{ t‾ally d‾isclose _r } e‾ach (s ≠ f‾irst " ") p‾artition s{\text{'}}{\{}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{d}isclose}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {(}{\mathrm{s}}\ {\neq}\ {\mathrm{\underline{f}irst}}\ {\text{" "}}{)}\ {\mathrm{\underline{p}artition}}\ {\mathrm{s}}
11t_ally 1 1 2 2 2 1 1 p_artition r_ange 7{\mathrm{\underline{t}ally}}\ {1}\ {1}\ {2}\ {2}\ {2}\ {1}\ {1}\ {\mathrm{\underline{p}artition}}\ {\mathrm{\underline{r}ange}}\ {7}t‾ally 1 1 2 2 2 1 1 p‾artition r‾ange 7{\mathrm{\underline{t}ally}}\ {1}\ {1}\ {2}\ {2}\ {2}\ {1}\ {1}\ {\mathrm{\underline{p}artition}}\ {\mathrm{\underline{r}ange}}\ {7}
12t_ally 1 1 2 2 3 3 3 p_artition r_ange 7{\mathrm{\underline{t}ally}}\ {1}\ {1}\ {2}\ {2}\ {3}\ {3}\ {3}\ {\mathrm{\underline{p}artition}}\ {\mathrm{\underline{r}ange}}\ {7}t‾ally 1 1 2 2 3 3 3 p‾artition r‾ange 7{\mathrm{\underline{t}ally}}\ {1}\ {1}\ {2}\ {2}\ {3}\ {3}\ {3}\ {\mathrm{\underline{p}artition}}\ {\mathrm{\underline{r}ange}}\ {7}
13t_ally 1 p_artition 5 6 7{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{p}artition}}\ {5}\ {6}\ {7}t‾ally 1 p‾artition 5 6 7{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{p}artition}}\ {5}\ {6}\ {7}
14t_ally 0 p_artition 5 6 7{\mathrm{\underline{t}ally}}\ {0}\ {\mathrm{\underline{p}artition}}\ {5}\ {6}\ {7}t‾ally 0 p‾artition 5 6 7{\mathrm{\underline{t}ally}}\ {0}\ {\mathrm{\underline{p}artition}}\ {5}\ {6}\ {7}

spec/eval/path.case

4[]P_ATH 2 3 r_eshape 0 1 2 0 1 0{\square \mathrm{\underline{P}ATH}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {2}\ {0}\ {1}\ {0}□P‾ATH 2 3 r‾eshape 0 1 2 0 1 0{\square \mathrm{\underline{P}ATH}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {2}\ {0}\ {1}\ {0}

spec/eval/phi-combinator.case

4u:s_quare := { _r * _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}us‾quare ← { _r × _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
5[n_eg + u:s_quare] 3{[}{\mathrm{\underline{n}eg}}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}{]}\ {3}[n‾eg + us‾quare] 3{[}{\mathrm{\underline{n}eg}}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}{]}\ {3}
6u:P_hi := { c_ f_ g_ x -> (f_ x) c_ g_ x }{{}^{\mathrm{u}}\mathrm{\underline{P}hi}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{\underline{f}}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\}}uP‾hi ← { c‾ f‾ g‾ x → (f‾ x) c‾ g‾ x }{{}^{\mathrm{u}}\mathrm{\underline{P}hi}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{\underline{f}}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\}}
7'u:s_quare 'n_eg '+ u:P_hi 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{+}\ {{}^{\mathrm{u}}\mathrm{\underline{P}hi}}\ {3}’us‾quare ’n‾eg ’+ uP‾hi 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{+}\ {{}^{\mathrm{u}}\mathrm{\underline{P}hi}}\ {3}

spec/eval/poly-group-float.case

3u:e_ven? := { n -> n = 0 ? 1; u:o_dd? n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{o}dd}{?}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}ue‾ven? ← { n → n = 0 ? 1⋄ uo‾dd? n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{o}dd}{?}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
4u:o_dd? := { n -> n = 0 ? 0; u:e_ven? n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{o}dd}{?}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uo‾dd? ← { n → n = 0 ? 0⋄ ue‾ven? n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{o}dd}{?}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {0}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
5u:g_ := { c -> c ? u:e_ven? 4; 0.5 }{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {4}{\diamond}\ {0.5}\ {\}}ug‾ ← { c → c ? ue‾ven? 4⋄ 0.5 }{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{e}ven}{?}}\ {4}{\diamond}\ {0.5}\ {\}}
6u:g_ 1{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {1}ug‾ 1{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {1}

spec/eval/poly-literal-float.case

4u:k_ := { @ -> 1 }{{}^{\mathrm{u}}\mathrm{\underline{k}}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {1}\ {\}}uk‾ ← { @ → 1 }{{}^{\mathrm{u}}\mathrm{\underline{k}}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {1}\ {\}}
5u:f_ := { c -> c ? u:k_ @; 2.5 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{k}}}\ {@}{\diamond}\ {2.5}\ {\}}uf‾ ← { c → c ? uk‾ @⋄ 2.5 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{k}}}\ {@}{\diamond}\ {2.5}\ {\}}
6u:f_ 1{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {1}uf‾ 1{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {1}

spec/eval/poly-literal-print.case

4u:p_ := { @ -> p_rint! 1 }{{}^{\mathrm{u}}\mathrm{\underline{p}}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {1}\ {\}}up‾ ← { @ → p‾rint! 1 }{{}^{\mathrm{u}}\mathrm{\underline{p}}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {1}\ {\}}
5u:f_ := { c -> c ? u:p_ @; 2.5 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{p}}}\ {@}{\diamond}\ {2.5}\ {\}}uf‾ ← { c → c ? up‾ @⋄ 2.5 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{p}}}\ {@}{\diamond}\ {2.5}\ {\}}
6u:f_ 1{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {1}uf‾ 1{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {1}
7u:p_ @{{}^{\mathrm{u}}\mathrm{\underline{p}}}\ {@}up‾ @{{}^{\mathrm{u}}\mathrm{\underline{p}}}\ {@}

spec/eval/poly-recursion-float.case

3u:c_ount := { n -> n <= 0 ? 0; 1 + u:c_ount n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{c}ount}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ount}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uc‾ount ← { n → n ≤ 0 ? 0⋄ 1 + uc‾ount n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{c}ount}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {0}\ {?}\ {0}{\diamond}\ {1}\ {+}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ount}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
4u:f_ := { c -> c ? u:c_ount 3; 2.5 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ount}}\ {3}{\diamond}\ {2.5}\ {\}}uf‾ ← { c → c ? uc‾ount 3⋄ 2.5 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{c}ount}}\ {3}{\diamond}\ {2.5}\ {\}}
5u:f_ 1{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {1}uf‾ 1{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {1}

spec/eval/power-builtin.case

43 'n_eg p_ower 5{3}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{p}ower}}\ {5}3 ’n‾eg p‾ower 5{3}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{p}ower}}\ {5}
5n := 4{\mathrm{n}}\ {\leftarrow}\ {4}n ← 4{\mathrm{n}}\ {\leftarrow}\ {4}
6n '{ _r * 2 } p_ower 1{\mathrm{n}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}\ {\mathrm{\underline{p}ower}}\ {1}n ’{ _r × 2 } p‾ower 1{\mathrm{n}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}\ {\mathrm{\underline{p}ower}}\ {1}

spec/eval/power.case

5n_eg^3 5{\mathrm{\underline{n}eg}}^{3}\ {5}n‾eg3 5{\mathrm{\underline{n}eg}}^{3}\ {5}
6r_ev^2 1 2 3{\mathrm{\underline{r}ev}}^{2}\ {1}\ {2}\ {3}r‾ev2 1 2 3{\mathrm{\underline{r}ev}}^{2}\ {1}\ {2}\ {3}
7n_eg^0 5{\mathrm{\underline{n}eg}}^{0}\ {5}n‾eg0 5{\mathrm{\underline{n}eg}}^{0}\ {5}
8u:d_ouble := { _r * 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}ud‾ouble ← { _r × 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}
9u:d_ouble^10 1{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{10}\ {1}ud‾ouble10 1{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{10}\ {1}
10'u:d_ouble^3 e_ach 1 2{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{3}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}’ud‾ouble3 e‾ach 1 2{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{3}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}

spec/eval/powers.case

32^10{2}^{10}210{2}^{10}
42^-1{2}^{-1}2−1{2}^{-1}
54^0.5{4}^{0.5}40.5{4}^{0.5}
62 ^ 10{2}\ {\mathbin{\hat{}}}\ {10}2 ^ 10{2}\ {\mathbin{\hat{}}}\ {10}
72.0 ^ -1{2.0}\ {\mathbin{\hat{}}}\ {-1}2.0 ^ −1{2.0}\ {\mathbin{\hat{}}}\ {-1}

spec/eval/quad-clock.case

6s_hape []TS{\mathrm{\underline{s}hape}}\ {\square \mathrm{TS}}s‾hape □TS{\mathrm{\underline{s}hape}}\ {\square \mathrm{TS}}
72026 <= 1 s_elect []TS{2026}\ {\leq}\ {1}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{TS}}2026 ≤ 1 s‾elect □TS{2026}\ {\leq}\ {1}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{TS}}
8([]D_L 0.01) >= 0.01{(}{\square \mathrm{\underline{D}L}}\ {0.01}{)}\ {\geq}\ {0.01}(□D‾L 0.01) ≥ 0.01{(}{\square \mathrm{\underline{D}L}}\ {0.01}{)}\ {\geq}\ {0.01}
9([]D_L 0) >= 0{(}{\square \mathrm{\underline{D}L}}\ {0}{)}\ {\geq}\ {0}(□D‾L 0) ≥ 0{(}{\square \mathrm{\underline{D}L}}\ {0}{)}\ {\geq}\ {0}

spec/eval/quad-values.case

7[]A{\square \mathrm{A}}□A{\square \mathrm{A}}
8[]D{\square \mathrm{D}}□D{\square \mathrm{D}}
9t_ally []AV{\mathrm{\underline{t}ally}}\ {\square \mathrm{AV}}t‾ally □AV{\mathrm{\underline{t}ally}}\ {\square \mathrm{AV}}
10[]IO{\square \mathrm{IO}}□IO{\square \mathrm{IO}}
11[]U_CS "AB"{\square \mathrm{\underline{U}CS}}\ {\text{"AB"}}□U‾CS "AB"{\square \mathrm{\underline{U}CS}}\ {\text{"AB"}}
12[]U_CHAR 72 105{\square \mathrm{\underline{U}CHAR}}\ {72}\ {105}□U‾CHAR 72 105{\square \mathrm{\underline{U}CHAR}}\ {72}\ {105}
13[]U_CHAR []U_CS "abc"{\square \mathrm{\underline{U}CHAR}}\ {\square \mathrm{\underline{U}CS}}\ {\text{"abc"}}□U‾CHAR □U‾CS "abc"{\square \mathrm{\underline{U}CHAR}}\ {\square \mathrm{\underline{U}CS}}\ {\text{"abc"}}
14([]U_CS "a") - []U_CS "A"{(}{\square \mathrm{\underline{U}CS}}\ {\text{"a"}}{)}\ {-}\ {\square \mathrm{\underline{U}CS}}\ {\text{"A"}}(□U‾CS "a") − □U‾CS "A"{(}{\square \mathrm{\underline{U}CS}}\ {\text{"a"}}{)}\ {-}\ {\square \mathrm{\underline{U}CS}}\ {\text{"A"}}
153 t_ake []A{3}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{A}}3 t‾ake □A{3}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{A}}

spec/eval/reduce-empty.case

7'+ r_/ 0 t_ake 1 2{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}’+ r‾/ 0 t‾ake 1 2{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}
8'- r_/ 0 t_ake 1 2{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}’− r‾/ 0 t‾ake 1 2{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}
9'* r_/ 0 t_ake 1 2{\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}’× r‾/ 0 t‾ake 1 2{\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}
10'/ r_/ 0 t_ake 1 2{\text{'}}{\div}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}’÷ r‾/ 0 t‾ake 1 2{\text{'}}{\div}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}
11'+ r_/ 0 t_ake 1.5 2.5{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}\ {2.5}’+ r‾/ 0 t‾ake 1.5 2.5{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}\ {2.5}
12'* r_/ 0 t_ake 1.5 2.5{\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}\ {2.5}’× r‾/ 0 t‾ake 1.5 2.5{\text{'}}{\times}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}\ {2.5}
13'& r_/ 0 t_ake 1 = 1{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {=}\ {1}’∧ r‾/ 0 t‾ake 1 = 1{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {=}\ {1}
14'| r_/ 0 t_ake 1 = 1{\text{'}}{\vee}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {=}\ {1}’∨ r‾/ 0 t‾ake 1 = 1{\text{'}}{\vee}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {=}\ {1}
15'= r_/ 0 t_ake 1 = 1{\text{'}}{=}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {=}\ {1}’= r‾/ 0 t‾ake 1 = 1{\text{'}}{=}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {=}\ {1}
16'!= r_/ 0 t_ake 1 = 1{\text{'}}{\neq}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {=}\ {1}’≠ r‾/ 0 t‾ake 1 = 1{\text{'}}{\neq}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {=}\ {1}
17'+ r_/ 0 3 r_eshape 1{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {0}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}’+ r‾/ 0 3 r‾eshape 1{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {0}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}
18u:s_um := { '+ r_/ _r }{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {\leftarrow}\ {\{}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\_\mathrm{r}}\ {\}}us‾um ← { ’+ r‾/ _r }{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {\leftarrow}\ {\{}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\_\mathrm{r}}\ {\}}
19u:s_um 0 t_ake 1.5{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}us‾um 0 t‾ake 1.5{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1.5}
20u:s_um 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {1}\ {2}\ {3}us‾um 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {1}\ {2}\ {3}

spec/eval/reduce.case

8'+ r_/ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}’+ r‾/ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}
9'- r_/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’− r‾/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
10'{ (10 * _l) + _r } r_/ 1 2 3{\text{'}}{\{}\ {(}{10}\ {\times}\ {\_\mathrm{l}}{)}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’{ (10 × _l) + _r } r‾/ 1 2 3{\text{'}}{\{}\ {(}{10}\ {\times}\ {\_\mathrm{l}}{)}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
11'm_ax r_/ 3 1 4 1 5{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}’m‾ax r‾/ 3 1 4 1 5{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {3}\ {1}\ {4}\ {1}\ {5}
12'+ r_/ 2 3 r_eshape r_ange 6{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}’+ r‾/ 2 3 r‾eshape r‾ange 6{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
13'+ r_/ 7{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {7}’+ r‾/ 7{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {7}
14u:m_ul := { a b -> a * b }{{}^{\mathrm{u}}\mathrm{\underline{m}ul}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\times}\ {\mathrm{b}}\ {\}}um‾ul ← { a b → a × b }{{}^{\mathrm{u}}\mathrm{\underline{m}ul}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\times}\ {\mathrm{b}}\ {\}}
15'u:m_ul r_/ 1 2 3 4{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{m}ul}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}’um‾ul r‾/ 1 2 3 4{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{m}ul}}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}
16'& r_/ 1 1 0{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {1}\ {1}\ {0}’∧ r‾/ 1 1 0{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {1}\ {1}\ {0}
17'+ r_/ 0.5 0.25{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {0.5}\ {0.25}’+ r‾/ 0.5 0.25{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {0.5}\ {0.25}
18'+ r_/ 9223372036854775807 1 -1{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {9223372036854775807}\ {1}\ {-1}’+ r‾/ 9223372036854775807 1 −1{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {9223372036854775807}\ {1}\ {-1}
19u:s_um := r_/ '+{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {\leftarrow}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}us‾um ← r‾/ ’+{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {\leftarrow}\ {\mathrm{\underline{r}}{/}}\ {\text{'}}{+}
20u:s_um 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {1}\ {2}\ {3}\ {4}us‾um 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{s}um}}\ {1}\ {2}\ {3}\ {4}

spec/eval/reject-array-division-by-zero.case

31 2 / 1 0{1}\ {2}\ {\div}\ {1}\ {0}1 2 ÷ 1 0{1}\ {2}\ {\div}\ {1}\ {0}

spec/eval/reject-axis-beyond-rank.case

3r_ev_2 1 2 3{{\mathrm{\underline{r}ev}}_{2}}\ {1}\ {2}\ {3}r‾ev2 1 2 3{{\mathrm{\underline{r}ev}}_{2}}\ {1}\ {2}\ {3}

spec/eval/reject-axis-rank-change.case

4t_ally_2 2 3 r_eshape r_ange 6{{\mathrm{\underline{t}ally}}_{2}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}t‾ally2 2 3 r‾eshape r‾ange 6{{\mathrm{\underline{t}ally}}_{2}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}

spec/eval/reject-axis-several.case

4r_ev_12 2 3 r_eshape r_ange 6{{\mathrm{\underline{r}ev}}_{12}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}r‾ev12 2 3 r‾eshape r‾ange 6{{\mathrm{\underline{r}ev}}_{12}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}

spec/eval/reject-bound-condition-float.case

3a := 1 2 > 0{\mathrm{a}}\ {\leftarrow}\ {1}\ {2}\ {>}\ {0}a ← 1 2 > 0{\mathrm{a}}\ {\leftarrow}\ {1}\ {2}\ {>}\ {0}
4a + 2.5{\mathrm{a}}\ {+}\ {2.5}a + 2.5{\mathrm{a}}\ {+}\ {2.5}

spec/eval/reject-cat-axis-beyond.case

31 2 c_at_2 3 4{1}\ {2}\ {{\mathrm{\underline{c}at}}_{2}}\ {3}\ {4}1 2 c‾at2 3 4{1}\ {2}\ {{\mathrm{\underline{c}at}}_{2}}\ {3}\ {4}

spec/eval/reject-cat-axis-many.case

3(2 2 r_eshape 1) c_at_12 2 2 r_eshape 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{\mathrm{\underline{c}at}}_{12}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}(2 2 r‾eshape 1) c‾at12 2 2 r‾eshape 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{\mathrm{\underline{c}at}}_{12}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}

spec/eval/reject-cat-axis-shape.case

4(2 2 r_eshape 1) c_at_2 3 2 r_eshape 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}(2 2 r‾eshape 1) c‾at2 3 2 r‾eshape 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{\mathrm{\underline{c}at}}_{2}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}

spec/eval/reject-cat-shapes.case

3(2 2 r_eshape 1 2 3 4) c_at 5 6 7{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\mathrm{\underline{c}at}}\ {5}\ {6}\ {7}(2 2 r‾eshape 1 2 3 4) c‾at 5 6 7{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\mathrm{\underline{c}at}}\ {5}\ {6}\ {7}

spec/eval/reject-color-out-of-range.case

4[]C_OLOR 9{\square \mathrm{\underline{C}OLOR}}\ {9}□C‾OLOR 9{\square \mathrm{\underline{C}OLOR}}\ {9}

spec/eval/reject-compose-types.case

4'n_eg '{ _r c_at "ab" } c_ompose "x"{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\mathrm{\underline{c}at}}\ {\text{"ab"}}\ {\}}\ {\mathrm{\underline{c}ompose}}\ {\text{"x"}}’n‾eg ’{ _r c‾at "ab" } c‾ompose "x"{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\mathrm{\underline{c}at}}\ {\text{"ab"}}\ {\}}\ {\mathrm{\underline{c}ompose}}\ {\text{"x"}}

spec/eval/reject-continue-signal.case

4'{ @ -> "a" []S_IGNAL "b" } []T_RAP '{ e -> []C_ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}’{ @ → "a" □S‾IGNAL "b" } □T‾RAP ’{ e → □C‾ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}

spec/eval/reject-decode-length.case

42 2 d_ecode 1 0 1{2}\ {2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {0}\ {1}2 2 d‾ecode 1 0 1{2}\ {2}\ {\mathrm{\underline{d}ecode}}\ {1}\ {0}\ {1}

spec/eval/reject-decode-mixed.case

6n := 2{\mathrm{n}}\ {\leftarrow}\ {2}n ← 2{\mathrm{n}}\ {\leftarrow}\ {2}
7n d_ecode 1.5 2.5{\mathrm{n}}\ {\mathrm{\underline{d}ecode}}\ {1.5}\ {2.5}n d‾ecode 1.5 2.5{\mathrm{n}}\ {\mathrm{\underline{d}ecode}}\ {1.5}\ {2.5}

spec/eval/reject-decode-overflow.case

310 d_ecode 20 r_eshape 9{10}\ {\mathrm{\underline{d}ecode}}\ {20}\ {\mathrm{\underline{r}eshape}}\ {9}10 d‾ecode 20 r‾eshape 9{10}\ {\mathrm{\underline{d}ecode}}\ {20}\ {\mathrm{\underline{r}eshape}}\ {9}

spec/eval/reject-delay-negative.case

3[]D_L -1{\square \mathrm{\underline{D}L}}\ {-1}□D‾L −1{\square \mathrm{\underline{D}L}}\ {-1}

spec/eval/reject-disclose-many.case

4d_isclose "ab" "cd"{\mathrm{\underline{d}isclose}}\ {\text{"ab"}}\ {\text{"cd"}}d‾isclose "ab" "cd"{\mathrm{\underline{d}isclose}}\ {\text{"ab"}}\ {\text{"cd"}}

spec/eval/reject-disclose-plain.case

3d_isclose "ab"{\mathrm{\underline{d}isclose}}\ {\text{"ab"}}d‾isclose "ab"{\mathrm{\underline{d}isclose}}\ {\text{"ab"}}

spec/eval/reject-division-by-zero.case

31 / 0{1}\ {\div}\ {0}1 ÷ 0{1}\ {\div}\ {0}

spec/eval/reject-duplicate-definition.case

3u:f_ := { _r }; u:f_ := { _r }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\}}uf‾ ← { _r }⋄ uf‾ ← { _r }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\}}

spec/eval/reject-each-extra-argument.case

41 2 3 'n_eg e_ach 4 5 6{1}\ {2}\ {3}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {4}\ {5}\ {6}1 2 3 ’n‾eg e‾ach 4 5 6{1}\ {2}\ {3}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {4}\ {5}\ {6}

spec/eval/reject-each-nested.case

3'r_ange e_ach 1 2{\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}’r‾ange e‾ach 1 2{\text{'}}{\mathrm{\underline{r}ange}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}

spec/eval/reject-each-shape.case

31 2 '+ e_ach 1 2 3{1}\ {2}\ {\text{'}}{+}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}1 2 ’+ e‾ach 1 2 3{1}\ {2}\ {\text{'}}{+}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}

spec/eval/reject-each-types.case

3'n_eg e_ach "ab"{\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {\text{"ab"}}’n‾eg e‾ach "ab"{\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {\text{"ab"}}

spec/eval/reject-empty-first.case

3f_irst r_ange 0{\mathrm{\underline{f}irst}}\ {\mathrm{\underline{r}ange}}\ {0}f‾irst r‾ange 0{\mathrm{\underline{f}irst}}\ {\mathrm{\underline{r}ange}}\ {0}

spec/eval/reject-empty-reshape.case

33 r_eshape r_ange 0{3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {0}3 r‾eshape r‾ange 0{3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {0}

spec/eval/reject-encode-float-radix.case

32.0 e_ncode 5{2.0}\ {\mathrm{\underline{e}ncode}}\ {5}2.0 e‾ncode 5{2.0}\ {\mathrm{\underline{e}ncode}}\ {5}

spec/eval/reject-encode-rank.case

42 2 e_ncode 2 2 r_eshape 1{2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}2 2 e‾ncode 2 2 r‾eshape 1{2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}

spec/eval/reject-encode-types.case

32 e_ncode 1.5{2}\ {\mathrm{\underline{e}ncode}}\ {1.5}2 e‾ncode 1.5{2}\ {\mathrm{\underline{e}ncode}}\ {1.5}

spec/eval/reject-grid-rank.case

3[]G_RID 1 1 1 1 r_eshape 1{\square \mathrm{\underline{G}RID}}\ {1}\ {1}\ {1}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}□G‾RID 1 1 1 1 r‾eshape 1{\square \mathrm{\underline{G}RID}}\ {1}\ {1}\ {1}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}

spec/eval/reject-identity-dyadic.case

31 i_d 2{1}\ {\mathrm{\underline{i}d}}\ {2}1 i‾d 2{1}\ {\mathrm{\underline{i}d}}\ {2}

spec/eval/reject-inner-length.case

31 2 '+ '* i_nner 1 2 3{1}\ {2}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {2}\ {3}1 2 ’+ ’× i‾nner 1 2 3{1}\ {2}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {1}\ {2}\ {3}

spec/eval/reject-inner-types.case

4"ab" '+ '* i_nner "ab"{\text{"ab"}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\text{"ab"}}"ab" ’+ ’× i‾nner "ab"{\text{"ab"}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\text{"ab"}}

spec/eval/reject-key-as-color.case

3"t:" u_se< "Terminal"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Terminal"}}"t:" u‾se< "Terminal"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Terminal"}}
4t:UP []F_G "x"{{}^{\mathrm{t}}\mathrm{UP}}\ {\square \mathrm{\underline{F}G}}\ {\text{"x"}}tUP □F‾G "x"{{}^{\mathrm{t}}\mathrm{UP}}\ {\square \mathrm{\underline{F}G}}\ {\text{"x"}}

spec/eval/reject-match-types.case

31 m_atch "a"{1}\ {\mathrm{\underline{m}atch}}\ {\text{"a"}}1 m‾atch "a"{1}\ {\mathrm{\underline{m}atch}}\ {\text{"a"}}

spec/eval/reject-negative-exponent.case

32 ^ -1{2}\ {\mathbin{\hat{}}}\ {-1}2 ^ −1{2}\ {\mathbin{\hat{}}}\ {-1}

spec/eval/reject-negative-range.case

3r_ange -1{\mathrm{\underline{r}ange}}\ {-1}r‾ange −1{\mathrm{\underline{r}ange}}\ {-1}

spec/eval/reject-nested-types.case

4"ab" c_at "cd" "ef"{\text{"ab"}}\ {\mathrm{\underline{c}at}}\ {\text{"cd"}}\ {\text{"ef"}}"ab" c‾at "cd" "ef"{\text{"ab"}}\ {\mathrm{\underline{c}at}}\ {\text{"cd"}}\ {\text{"ef"}}

spec/eval/reject-no-guard.case

3u:f_ := { n -> n = 0 ? 1 }; u:f_ 5{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {5}uf‾ ← { n → n = 0 ? 1 }⋄ uf‾ 5{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {=}\ {0}\ {?}\ {1}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {5}

spec/eval/reject-no-identity.case

4'm_ax r_/ 0 t_ake 1 2{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}’m‾ax r‾/ 0 t‾ake 1 2{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}

spec/eval/reject-not-a-bool.case

32 & 1{2}\ {\wedge}\ {1}2 ∧ 1{2}\ {\wedge}\ {1}

spec/eval/reject-not-unit.case

3u:a_nswer := { @ -> 42 }; u:a_nswer 1{{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {42}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {1}ua‾nswer ← { @ → 42 }⋄ ua‾nswer 1{{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {42}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {1}

spec/eval/reject-numbers-type.case

3n_umbers 5{\mathrm{\underline{n}umbers}}\ {5}n‾umbers 5{\mathrm{\underline{n}umbers}}\ {5}

spec/eval/reject-numbers.case

3n_umbers "1 two 3"{\mathrm{\underline{n}umbers}}\ {\text{"1 two 3"}}n‾umbers "1 two 3"{\mathrm{\underline{n}umbers}}\ {\text{"1 two 3"}}

spec/eval/reject-overflow.case

32 ^ 100{2}\ {\mathbin{\hat{}}}\ {100}2 ^ 100{2}\ {\mathbin{\hat{}}}\ {100}

spec/eval/reject-partition-keys.case

31 -1 1 p_artition 1 2 3{1}\ {-1}\ {1}\ {\mathrm{\underline{p}artition}}\ {1}\ {2}\ {3}1 −1 1 p‾artition 1 2 3{1}\ {-1}\ {1}\ {\mathrm{\underline{p}artition}}\ {1}\ {2}\ {3}

spec/eval/reject-partition-length.case

31 1 p_artition 1 2 3{1}\ {1}\ {\mathrm{\underline{p}artition}}\ {1}\ {2}\ {3}1 1 p‾artition 1 2 3{1}\ {1}\ {\mathrm{\underline{p}artition}}\ {1}\ {2}\ {3}

spec/eval/reject-path-shape.case

3[]P_ATH 3 2 r_eshape 0{\square \mathrm{\underline{P}ATH}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}□P‾ATH 3 2 r‾eshape 0{\square \mathrm{\underline{P}ATH}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0}

spec/eval/reject-pi-argument.case

3p_i 3{\mathrm{\underline{p}i}}\ {3}p‾i 3{\mathrm{\underline{p}i}}\ {3}

spec/eval/reject-power-dyadic.case

4u:s_ub := { _l - _r }{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}us‾ub ← { _l − _r }{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}
510 u:s_ub^2 3{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}^{2}\ {3}10 us‾ub2 3{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}^{2}\ {3}

spec/eval/reject-power-negative.case

4-1 'n_eg p_ower 5{-1}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{p}ower}}\ {5}−1 ’n‾eg p‾ower 5{-1}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{p}ower}}\ {5}

spec/eval/reject-program-defines-library-names.case

5l:x := 3{{}^{\mathrm{l}}\mathrm{x}}\ {\leftarrow}\ {3}lx ← 3{{}^{\mathrm{l}}\mathrm{x}}\ {\leftarrow}\ {3}
6l:x + 1{{}^{\mathrm{l}}\mathrm{x}}\ {+}\ {1}lx + 1{{}^{\mathrm{l}}\mathrm{x}}\ {+}\ {1}

spec/eval/reject-quad-unknown-value.case

4[]XYZ{\square \mathrm{XYZ}}□XYZ{\square \mathrm{XYZ}}

spec/eval/reject-quad-value-applied.case

4[]A 1{\square \mathrm{A}}\ {1}□A 1{\square \mathrm{A}}\ {1}

spec/eval/reject-reduce-lambda-empty.case

3'{ _l + _r } r_/ 0 t_ake 1 2{\text{'}}{\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}’{ _l + _r } r‾/ 0 t‾ake 1 2{\text{'}}{\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}}{/}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}

spec/eval/reject-reduce-types.case

4'+ r_/ "abc"{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{"abc"}}’+ r‾/ "abc"{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\text{"abc"}}

spec/eval/reject-replicate-length.case

41 0 r_eplicate 1 2 3{1}\ {0}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}\ {3}1 0 r‾eplicate 1 2 3{1}\ {0}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}\ {3}

spec/eval/reject-replicate-negative.case

41 -1 2 r_eplicate 1 2 3{1}\ {-1}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}\ {3}1 −1 2 r‾eplicate 1 2 3{1}\ {-1}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}\ {3}

spec/eval/reject-replicate-rank.case

3(2 2 r_eshape 1) r_eplicate 1 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}(2 2 r‾eshape 1) r‾eplicate 1 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}

spec/eval/reject-replicate-types.case

31.5 2 r_eplicate 1 2{1.5}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}1.5 2 r‾eplicate 1 2{1.5}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}

spec/eval/reject-roll-float.case

3r_oll! 2.5{\mathrm{\underline{r}oll}{!}}\ {2.5}r‾oll! 2.5{\mathrm{\underline{r}oll}{!}}\ {2.5}

spec/eval/reject-roll-zero.case

3r_oll! 3 0{\mathrm{\underline{r}oll}{!}}\ {3}\ {0}r‾oll! 3 0{\mathrm{\underline{r}oll}{!}}\ {3}\ {0}

spec/eval/reject-rotate-amount-rank.case

4(2 2 r_eshape 1) o_- 1 2 3{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}(2 2 r‾eshape 1) o‾− 1 2 3{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}

spec/eval/reject-rotate-amount-type.case

31.5 o_- 1 2 3{1.5}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}1.5 o‾− 1 2 3{1.5}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}

spec/eval/reject-rotate-axes-amount-rank.case

3(2 2 r_eshape 1) o_-_12 3 3 r_eshape r_ange 9{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {9}(2 2 r‾eshape 1) o‾−12 3 3 r‾eshape r‾ange 9{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {9}

spec/eval/reject-rotate-axis-beyond-rank.case

31 o_-_13 3 3 r_eshape r_ange 9{1}\ {{\mathrm{\underline{o}}{-}}_{13}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {9}1 o‾−13 3 3 r‾eshape r‾ange 9{1}\ {{\mathrm{\underline{o}}{-}}_{13}}\ {3}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {9}

spec/eval/reject-scan-overflow.case

4'+ s_\ 9223372036854775807 1 -1{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {9223372036854775807}\ {1}\ {-1}’+ s‾\ 9223372036854775807 1 −1{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {9223372036854775807}\ {1}\ {-1}

spec/eval/reject-scan-shape.case

4'{ _l c_at _r } s_\ 1 2 3{\text{'}}{\{}\ {\_\mathrm{l}}\ {\mathrm{\underline{c}at}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}’{ _l c‾at _r } s‾\ 1 2 3{\text{'}}{\{}\ {\_\mathrm{l}}\ {\mathrm{\underline{c}at}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}

spec/eval/reject-search-cells.case

4(2 3 r_eshape 1) i_ndexOf 1 2{(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{i}ndexOf}}\ {1}\ {2}(2 3 r‾eshape 1) i‾ndexOf 1 2{(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\mathrm{\underline{i}ndexOf}}\ {1}\ {2}

spec/eval/reject-search-kinds.case

3"abc" i_ndexOf 1{\text{"abc"}}\ {\mathrm{\underline{i}ndexOf}}\ {1}"abc" i‾ndexOf 1{\text{"abc"}}\ {\mathrm{\underline{i}ndexOf}}\ {1}

spec/eval/reject-shape-mismatch.case

31 2 + 1 2 3{1}\ {2}\ {+}\ {1}\ {2}\ {3}1 2 + 1 2 3{1}\ {2}\ {+}\ {1}\ {2}\ {3}

spec/eval/reject-show-types.case

3[]S_HOW 3{\square \mathrm{\underline{S}HOW}}\ {3}□S‾HOW 3{\square \mathrm{\underline{S}HOW}}\ {3}

spec/eval/reject-signal-code.case

4"Bad Code" []S_IGNAL "message"{\text{"Bad Code"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"message"}}"Bad Code" □S‾IGNAL "message"{\text{"Bad Code"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"message"}}

spec/eval/reject-sort-boxes.case

3s_ort "b" "a"{\mathrm{\underline{s}ort}}\ {\text{"b"}}\ {\text{"a"}}s‾ort "b" "a"{\mathrm{\underline{s}ort}}\ {\text{"b"}}\ {\text{"a"}}

spec/eval/reject-structural.case

34 s_elect 10 20 30{4}\ {\mathrm{\underline{s}elect}}\ {10}\ {20}\ {30}4 s‾elect 10 20 30{4}\ {\mathrm{\underline{s}elect}}\ {10}\ {20}\ {30}

spec/eval/reject-swap-monadic.case

32 'n_eg s_wap 1{2}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{s}wap}}\ {1}2 ’n‾eg s‾wap 1{2}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{s}wap}}\ {1}

spec/eval/reject-table-nested.case

31 2 '{ x y -> x c_at y } t_able 3{1}\ {2}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{c}at}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{t}able}}\ {3}1 2 ’{ x y → x c‾at y } t‾able 3{1}\ {2}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{c}at}}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{t}able}}\ {3}

spec/eval/reject-table-types.case

31 2 '+ t_able "ab"{1}\ {2}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {\text{"ab"}}1 2 ’+ t‾able "ab"{1}\ {2}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {\text{"ab"}}

spec/eval/reject-tack-monadic.case

4(r_ight 5) + 1{(}{\mathrm{\underline{r}ight}}\ {5}{)}\ {+}\ {1}(r‾ight 5) + 1{(}{\mathrm{\underline{r}ight}}\ {5}{)}\ {+}\ {1}

spec/eval/reject-train-atop-number.case

4[+ -] 1 2{[}{+}\ {-}{]}\ {1}\ {2}[+ −] 1 2{[}{+}\ {-}{]}\ {1}\ {2}

spec/eval/reject-train-atop-outer.case

5[n_ot +] 1 2{[}{\mathrm{\underline{n}ot}}\ {+}{]}\ {1}\ {2}[n‾ot +] 1 2{[}{\mathrm{\underline{n}ot}}\ {+}{]}\ {1}\ {2}

spec/eval/reject-train-chain.case

4[r_ev n_eg a_bs] -1 2 -3{[}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-1}\ {2}\ {-3}[r‾ev n‾eg a‾bs] −1 2 −3{[}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {-1}\ {2}\ {-3}

spec/eval/reject-train-dyadic-middle.case

41 2 [+ n_ot -] 3 4{1}\ {2}\ {[}{+}\ {\mathrm{\underline{n}ot}}\ {-}{]}\ {3}\ {4}1 2 [+ n‾ot −] 3 4{1}\ {2}\ {[}{+}\ {\mathrm{\underline{n}ot}}\ {-}{]}\ {3}\ {4}

spec/eval/reject-train-dyadic-tine.case

41 2 [r_ev + a_bs] 3 4{1}\ {2}\ {[}{\mathrm{\underline{r}ev}}\ {+}\ {\mathrm{\underline{a}bs}}{]}\ {3}\ {4}1 2 [r‾ev + a‾bs] 3 4{1}\ {2}\ {[}{\mathrm{\underline{r}ev}}\ {+}\ {\mathrm{\underline{a}bs}}{]}\ {3}\ {4}

spec/eval/reject-train-fork-middle.case

4[r_ev n_ot t_ally] 1 2{[}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{n}ot}}\ {\mathrm{\underline{t}ally}}{]}\ {1}\ {2}[r‾ev n‾ot t‾ally] 1 2{[}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{n}ot}}\ {\mathrm{\underline{t}ally}}{]}\ {1}\ {2}

spec/eval/reject-train-long.case

4[r_ev + a_bs n_ot t_ally] 1 2{[}{\mathrm{\underline{r}ev}}\ {+}\ {\mathrm{\underline{a}bs}}\ {\mathrm{\underline{n}ot}}\ {\mathrm{\underline{t}ally}}{]}\ {1}\ {2}[r‾ev + a‾bs n‾ot t‾ally] 1 2{[}{\mathrm{\underline{r}ev}}\ {+}\ {\mathrm{\underline{a}bs}}\ {\mathrm{\underline{n}ot}}\ {\mathrm{\underline{t}ally}}{]}\ {1}\ {2}

spec/eval/reject-train-named.case

4u:t_ := [n_ot +]{{}^{\mathrm{u}}\mathrm{\underline{t}}}\ {\leftarrow}\ {[}{\mathrm{\underline{n}ot}}\ {+}{]}ut‾ ← [n‾ot +]{{}^{\mathrm{u}}\mathrm{\underline{t}}}\ {\leftarrow}\ {[}{\mathrm{\underline{n}ot}}\ {+}{]}
5u:t_ 1 2{{}^{\mathrm{u}}\mathrm{\underline{t}}}\ {1}\ {2}ut‾ 1 2{{}^{\mathrm{u}}\mathrm{\underline{t}}}\ {1}\ {2}

spec/eval/reject-train-nested.case

3[r_ev [n_ot -]] 1 2{[}{\mathrm{\underline{r}ev}}\ {[}{\mathrm{\underline{n}ot}}\ {-}{]}{]}\ {1}\ {2}[r‾ev [n‾ot −]] 1 2{[}{\mathrm{\underline{r}ev}}\ {[}{\mathrm{\underline{n}ot}}\ {-}{]}{]}\ {1}\ {2}

spec/eval/reject-train-runtime.case

4[r_ev + n_ot] 1 2{[}{\mathrm{\underline{r}ev}}\ {+}\ {\mathrm{\underline{n}ot}}{]}\ {1}\ {2}[r‾ev + n‾ot] 1 2{[}{\mathrm{\underline{r}ev}}\ {+}\ {\mathrm{\underline{n}ot}}{]}\ {1}\ {2}

spec/eval/reject-transpose-axis-beyond.case

3o_\_13 2 3 r_eshape r_ange 6{{\mathrm{\underline{o}}{\backslash}}_{13}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}o‾\13 2 3 r‾eshape r‾ange 6{{\mathrm{\underline{o}}{\backslash}}_{13}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}

spec/eval/reject-transpose-axis-one.case

3o_\_2 2 3 r_eshape r_ange 6{{\mathrm{\underline{o}}{\backslash}}_{2}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}o‾\2 2 3 r‾eshape r‾ange 6{{\mathrm{\underline{o}}{\backslash}}_{2}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}

spec/eval/reject-transpose-axis-three.case

4o_\_123 2 3 4 r_eshape r_ange 24{{\mathrm{\underline{o}}{\backslash}}_{123}}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}o‾\123 2 3 4 r‾eshape r‾ange 24{{\mathrm{\underline{o}}{\backslash}}_{123}}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}

spec/eval/reject-transpose-dyadic.case

41 2 o_\ 2 2 r_eshape r_ange 4{1}\ {2}\ {\mathrm{\underline{o}}{\backslash}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}1 2 o‾\ 2 2 r‾eshape r‾ange 4{1}\ {2}\ {\mathrm{\underline{o}}{\backslash}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}

spec/eval/reject-transpose-length.case

41 2 3 t_ranspose 2 2 r_eshape r_ange 4{1}\ {2}\ {3}\ {\mathrm{\underline{t}ranspose}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}1 2 3 t‾ranspose 2 2 r‾eshape r‾ange 4{1}\ {2}\ {3}\ {\mathrm{\underline{t}ranspose}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}

spec/eval/reject-transpose-range.case

30 1 t_ranspose 2 2 r_eshape r_ange 4{0}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}0 1 t‾ranspose 2 2 r‾eshape r‾ange 4{0}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}

spec/eval/reject-transpose-repeated.case

41 1 t_ranspose 2 2 r_eshape r_ange 4{1}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}1 1 t‾ranspose 2 2 r‾eshape r‾ange 4{1}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}

spec/eval/reject-trap-recover-type.case

4'{ @ -> 1 + 2 } []T_RAP '{ e -> []R_ECOVER "text" }{\text{'}}{\{}\ {@}\ {\to}\ {1}\ {+}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\text{"text"}}\ {\}}’{ @ → 1 + 2 } □T‾RAP ’{ e → □R‾ECOVER "text" }{\text{'}}{\{}\ {@}\ {\to}\ {1}\ {+}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\text{"text"}}\ {\}}

spec/eval/reject-trig-types.case

4s_in "a"{\mathrm{\underline{s}in}}\ {\text{"a"}}s‾in "a"{\mathrm{\underline{s}in}}\ {\text{"a"}}

spec/eval/reject-u-char-range.case

4[]U_CHAR 65 200{\square \mathrm{\underline{U}CHAR}}\ {65}\ {200}□U‾CHAR 65 200{\square \mathrm{\underline{U}CHAR}}\ {65}\ {200}

spec/eval/reject-u-cs-number.case

3[]U_CS 65{\square \mathrm{\underline{U}CS}}\ {65}□U‾CS 65{\square \mathrm{\underline{U}CS}}\ {65}

spec/eval/reject-vector-condition.case

3{ c -> c ? 1; 0 } 1 0{\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {1}{\diamond}\ {0}\ {\}}\ {1}\ {0}{ c → c ? 1⋄ 0 } 1 0{\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {?}\ {1}{\diamond}\ {0}\ {\}}\ {1}\ {0}

spec/eval/reject-warn-type.case

510 + ("x" []W_ARN "empty" "nothing"){10}\ {+}\ {(}{\text{"x"}}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}10 + ("x" □W‾ARN "empty" "nothing"){10}\ {+}\ {(}{\text{"x"}}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}

spec/eval/reject-where-matrix.case

3w_here 2 2 r_eshape 1 0{\mathrm{\underline{w}here}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {0}w‾here 2 2 r‾eshape 1 0{\mathrm{\underline{w}here}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {0}

spec/eval/reject-where-not-bool.case

3w_here 0 2 1{\mathrm{\underline{w}here}}\ {0}\ {2}\ {1}w‾here 0 2 1{\mathrm{\underline{w}here}}\ {0}\ {2}\ {1}

spec/eval/replicate-axis.case

41 0 2 r_eplicate_2 2 3 r_eshape r_ange 6{1}\ {0}\ {2}\ {{\mathrm{\underline{r}eplicate}}_{2}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}1 0 2 r‾eplicate2 2 3 r‾eshape r‾ange 6{1}\ {0}\ {2}\ {{\mathrm{\underline{r}eplicate}}_{2}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
51 0 r_eplicate_1 2 3 r_eshape r_ange 6{1}\ {0}\ {{\mathrm{\underline{r}eplicate}}_{1}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}1 0 r‾eplicate1 2 3 r‾eshape r‾ange 6{1}\ {0}\ {{\mathrm{\underline{r}eplicate}}_{1}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}

spec/eval/replicate.case

61 0 2 r_eplicate "abc"{1}\ {0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {\text{"abc"}}1 0 2 r‾eplicate "abc"{1}\ {0}\ {2}\ {\mathrm{\underline{r}eplicate}}\ {\text{"abc"}}
73 r_eplicate 1 2{3}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}3 r‾eplicate 1 2{3}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}
82 r_eplicate 7{2}\ {\mathrm{\underline{r}eplicate}}\ {7}2 r‾eplicate 7{2}\ {\mathrm{\underline{r}eplicate}}\ {7}
90 r_eplicate 1 2 3{0}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}\ {3}0 r‾eplicate 1 2 3{0}\ {\mathrm{\underline{r}eplicate}}\ {1}\ {2}\ {3}
10(1 0 1 0 = 1) r_eplicate 10 20 30 40{(}{1}\ {0}\ {1}\ {0}\ {=}\ {1}{)}\ {\mathrm{\underline{r}eplicate}}\ {10}\ {20}\ {30}\ {40}(1 0 1 0 = 1) r‾eplicate 10 20 30 40{(}{1}\ {0}\ {1}\ {0}\ {=}\ {1}{)}\ {\mathrm{\underline{r}eplicate}}\ {10}\ {20}\ {30}\ {40}
11(3 1 4 1 5 > 2) r_eplicate 3 1 4 1 5{(}{3}\ {1}\ {4}\ {1}\ {5}\ {>}\ {2}{)}\ {\mathrm{\underline{r}eplicate}}\ {3}\ {1}\ {4}\ {1}\ {5}(3 1 4 1 5 > 2) r‾eplicate 3 1 4 1 5{(}{3}\ {1}\ {4}\ {1}\ {5}\ {>}\ {2}{)}\ {\mathrm{\underline{r}eplicate}}\ {3}\ {1}\ {4}\ {1}\ {5}
122 0 1 r_eplicate 3 2 r_eshape r_ange 6{2}\ {0}\ {1}\ {\mathrm{\underline{r}eplicate}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}2 0 1 r‾eplicate 3 2 r‾eshape r‾ange 6{2}\ {0}\ {1}\ {\mathrm{\underline{r}eplicate}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
131 2 3 r_eplicate 1.5 2.5 3.5{1}\ {2}\ {3}\ {\mathrm{\underline{r}eplicate}}\ {1.5}\ {2.5}\ {3.5}1 2 3 r‾eplicate 1.5 2.5 3.5{1}\ {2}\ {3}\ {\mathrm{\underline{r}eplicate}}\ {1.5}\ {2.5}\ {3.5}
14s_hape 0 0 r_eplicate 2 3 r_eshape 0{\mathrm{\underline{s}hape}}\ {0}\ {0}\ {\mathrm{\underline{r}eplicate}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}s‾hape 0 0 r‾eplicate 2 3 r‾eshape 0{\mathrm{\underline{s}hape}}\ {0}\ {0}\ {\mathrm{\underline{r}eplicate}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}

spec/eval/reshape-and-range.case

4r_ange 5{\mathrm{\underline{r}ange}}\ {5}r‾ange 5{\mathrm{\underline{r}ange}}\ {5}
5o_ffsets 3{\mathrm{\underline{o}ffsets}}\ {3}o‾ffsets 3{\mathrm{\underline{o}ffsets}}\ {3}
62 3 r_eshape r_ange 6{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}2 3 r‾eshape r‾ange 6{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
72 2 r_eshape 1 2 3{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}2 2 r‾eshape 1 2 3{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}
85 r_eshape 7{5}\ {\mathrm{\underline{r}eshape}}\ {7}5 r‾eshape 7{5}\ {\mathrm{\underline{r}eshape}}\ {7}
9s_hape 2 3 r_eshape r_ange 6{\mathrm{\underline{s}hape}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}s‾hape 2 3 r‾eshape r‾ange 6{\mathrm{\underline{s}hape}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
10s_hape 5{\mathrm{\underline{s}hape}}\ {5}s‾hape 5{\mathrm{\underline{s}hape}}\ {5}
11t_ally 2 3 r_eshape r_ange 6{\mathrm{\underline{t}ally}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}t‾ally 2 3 r‾eshape r‾ange 6{\mathrm{\underline{t}ally}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
12t_ally 5{\mathrm{\underline{t}ally}}\ {5}t‾ally 5{\mathrm{\underline{t}ally}}\ {5}
13r_avel 2 2 r_eshape r_ange 4{\mathrm{\underline{r}avel}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}r‾avel 2 2 r‾eshape r‾ange 4{\mathrm{\underline{r}avel}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {4}
1410 ^ o_ffsets 3{10}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {3}10 ^ o‾ffsets 3{10}\ {\mathbin{\hat{}}}\ {\mathrm{\underline{o}ffsets}}\ {3}

spec/eval/reverse.case

4r_ev 1 2 3{\mathrm{\underline{r}ev}}\ {1}\ {2}\ {3}r‾ev 1 2 3{\mathrm{\underline{r}ev}}\ {1}\ {2}\ {3}
5r_ev "abc"{\mathrm{\underline{r}ev}}\ {\text{"abc"}}r‾ev "abc"{\mathrm{\underline{r}ev}}\ {\text{"abc"}}
6r_ev 2 2 r_eshape 1 2 3 4{\mathrm{\underline{r}ev}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}r‾ev 2 2 r‾eshape 1 2 3 4{\mathrm{\underline{r}ev}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}
7r_ev 5{\mathrm{\underline{r}ev}}\ {5}r‾ev 5{\mathrm{\underline{r}ev}}\ {5}
8r_ev s_ort 3 1 2{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}ort}}\ {3}\ {1}\ {2}r‾ev s‾ort 3 1 2{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}ort}}\ {3}\ {1}\ {2}

spec/eval/right-to-left.case

32 * 3 + 4{2}\ {\times}\ {3}\ {+}\ {4}2 × 3 + 4{2}\ {\times}\ {3}\ {+}\ {4}

spec/eval/roll.case

6v := r_oll! 1000 r_eshape 6{\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{r}oll}{!}}\ {1000}\ {\mathrm{\underline{r}eshape}}\ {6}v ← r‾oll! 1000 r‾eshape 6{\mathrm{v}}\ {\leftarrow}\ {\mathrm{\underline{r}oll}{!}}\ {1000}\ {\mathrm{\underline{r}eshape}}\ {6}
7'& r_/ (v >= 1) & v <= 6{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{v}}\ {\geq}\ {1}{)}\ {\wedge}\ {\mathrm{v}}\ {\leq}\ {6}’∧ r‾/ (v ≥ 1) ∧ v ≤ 6{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{v}}\ {\geq}\ {1}{)}\ {\wedge}\ {\mathrm{v}}\ {\leq}\ {6}
8t_ally u_nique v{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{v}}t‾ally u‾nique v{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{v}}
9s_hape r_oll! 2 3 r_eshape 10{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{r}oll}{!}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {10}s‾hape r‾oll! 2 3 r‾eshape 10{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{r}oll}{!}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {10}
10r_oll! 1 1 1{\mathrm{\underline{r}oll}{!}}\ {1}\ {1}\ {1}r‾oll! 1 1 1{\mathrm{\underline{r}oll}{!}}\ {1}\ {1}\ {1}
11'& r_/ (r_oll! 5 10 1000) <= 5 10 1000{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{r}oll}{!}}\ {5}\ {10}\ {1000}{)}\ {\leq}\ {5}\ {10}\ {1000}’∧ r‾/ (r‾oll! 5 10 1000) ≤ 5 10 1000{\text{'}}{\wedge}\ {\mathrm{\underline{r}}{/}}\ {(}{\mathrm{\underline{r}oll}{!}}\ {5}\ {10}\ {1000}{)}\ {\leq}\ {5}\ {10}\ {1000}
121 < t_ally u_nique r_oll! 20 r_eshape 1000000000{1}\ {<}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{\underline{r}oll}{!}}\ {20}\ {\mathrm{\underline{r}eshape}}\ {1000000000}1 < t‾ally u‾nique r‾oll! 20 r‾eshape 1000000000{1}\ {<}\ {\mathrm{\underline{t}ally}}\ {\mathrm{\underline{u}nique}}\ {\mathrm{\underline{r}oll}{!}}\ {20}\ {\mathrm{\underline{r}eshape}}\ {1000000000}

spec/eval/rotate.case

71 o_- 1 2 3 4 5{1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}\ {4}\ {5}1 o‾− 1 2 3 4 5{1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}\ {4}\ {5}
8-1 o_- 1 2 3 4 5{-1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}\ {4}\ {5}−1 o‾− 1 2 3 4 5{-1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}\ {4}\ {5}
97 o_- 1 2 3{7}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}7 o‾− 1 2 3{7}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}
100 o_- 1 2 3{0}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}0 o‾− 1 2 3{0}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}
111 o_- 3 2 r_eshape r_ange 6{1}\ {\mathrm{\underline{o}}{-}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}1 o‾− 3 2 r‾eshape r‾ange 6{1}\ {\mathrm{\underline{o}}{-}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
121 o_- "hello"{1}\ {\mathrm{\underline{o}}{-}}\ {\text{"hello"}}1 o‾− "hello"{1}\ {\mathrm{\underline{o}}{-}}\ {\text{"hello"}}
13-1 0 1 o_- 1 2 3{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}−1 0 1 o‾− 1 2 3{-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {1}\ {2}\ {3}
14s_hape -1 0 1 o_- 4 5 r_eshape 0{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {4}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}s‾hape −1 0 1 o‾− 4 5 r‾eshape 0{\mathrm{\underline{s}hape}}\ {-1}\ {0}\ {1}\ {\mathrm{\underline{o}}{-}}\ {4}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}
151 o_- 5{1}\ {\mathrm{\underline{o}}{-}}\ {5}1 o‾− 5{1}\ {\mathrm{\underline{o}}{-}}\ {5}
16t_ally 1 o_- 0 t_ake 1{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{o}}{-}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}t‾ally 1 o‾− 0 t‾ake 1{\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{o}}{-}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}

spec/eval/s-combinator.case

3[i_d - n_eg] 5{[}{\mathrm{\underline{i}d}}\ {-}\ {\mathrm{\underline{n}eg}}{]}\ {5}[i‾d − n‾eg] 5{[}{\mathrm{\underline{i}d}}\ {-}\ {\mathrm{\underline{n}eg}}{]}\ {5}
4u:S_ := { f_ g_ x -> x f_ g_ x }{{}^{\mathrm{u}}\mathrm{\underline{S}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\}}uS‾ ← { f‾ g‾ x → x f‾ g‾ x }{{}^{\mathrm{u}}\mathrm{\underline{S}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}\ {\}}
5'n_eg '- u:S_ 5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{-}\ {{}^{\mathrm{u}}\mathrm{\underline{S}}}\ {5}’n‾eg ’− uS‾ 5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{-}\ {{}^{\mathrm{u}}\mathrm{\underline{S}}}\ {5}

spec/eval/scalar-extension.case

41 2 3 + 1{1}\ {2}\ {3}\ {+}\ {1}1 2 3 + 1{1}\ {2}\ {3}\ {+}\ {1}
510 * 1 2 3{10}\ {\times}\ {1}\ {2}\ {3}10 × 1 2 3{10}\ {\times}\ {1}\ {2}\ {3}
61 2 3 - 3 2 1{1}\ {2}\ {3}\ {-}\ {3}\ {2}\ {1}1 2 3 − 3 2 1{1}\ {2}\ {3}\ {-}\ {3}\ {2}\ {1}
71 2 3 = 1 5 3{1}\ {2}\ {3}\ {=}\ {1}\ {5}\ {3}1 2 3 = 1 5 3{1}\ {2}\ {3}\ {=}\ {1}\ {5}\ {3}
8n_eg 1 2{\mathrm{\underline{n}eg}}\ {1}\ {2}n‾eg 1 2{\mathrm{\underline{n}eg}}\ {1}\ {2}
91 2 3 / 2{1}\ {2}\ {3}\ {\div}\ {2}1 2 3 ÷ 2{1}\ {2}\ {3}\ {\div}\ {2}
10u:s_quare := { _r * _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}us‾quare ← { _r × _r }{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
11u:s_quare 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {1}\ {2}\ {3}us‾quare 1 2 3{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {1}\ {2}\ {3}

spec/eval/scan.case

5'+ s_\ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}\ {4}’+ s‾\ 1 2 3 4{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}\ {4}
6'- s_\ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}’− s‾\ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}
7'm_ax s_\ 3 1 4 1 5{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{s}}{\backslash}}\ {3}\ {1}\ {4}\ {1}\ {5}’m‾ax s‾\ 3 1 4 1 5{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{s}}{\backslash}}\ {3}\ {1}\ {4}\ {1}\ {5}
8'+ s_\ 2 3 r_eshape r_ange 6{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}’+ s‾\ 2 3 r‾eshape r‾ange 6{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
9'+ s_\ 5{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {5}’+ s‾\ 5{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {5}
10t_ally '+ s_\ 0 t_ake 1 2{\mathrm{\underline{t}ally}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}t‾ally ’+ s‾\ 0 t‾ake 1 2{\mathrm{\underline{t}ally}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}
11'- r_/ 1 2 3 4{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}’− r‾/ 1 2 3 4{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}\ {4}
12'- s_\ 1 2 3 4{\text{'}}{-}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}\ {4}’− s‾\ 1 2 3 4{\text{'}}{-}\ {\mathrm{\underline{s}}{\backslash}}\ {1}\ {2}\ {3}\ {4}

spec/eval/search.case

75 6 7 i_ndexOf 7 9{5}\ {6}\ {7}\ {\mathrm{\underline{i}ndexOf}}\ {7}\ {9}5 6 7 i‾ndexOf 7 9{5}\ {6}\ {7}\ {\mathrm{\underline{i}ndexOf}}\ {7}\ {9}
8"hello" i_ndexOf "lo"{\text{"hello"}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{"lo"}}"hello" i‾ndexOf "lo"{\text{"hello"}}\ {\mathrm{\underline{i}ndexOf}}\ {\text{"lo"}}
95 6 7 i_ndexOf 6{5}\ {6}\ {7}\ {\mathrm{\underline{i}ndexOf}}\ {6}5 6 7 i‾ndexOf 6{5}\ {6}\ {7}\ {\mathrm{\underline{i}ndexOf}}\ {6}
101 2 3 i_ndexOf 2.0{1}\ {2}\ {3}\ {\mathrm{\underline{i}ndexOf}}\ {2.0}1 2 3 i‾ndexOf 2.0{1}\ {2}\ {3}\ {\mathrm{\underline{i}ndexOf}}\ {2.0}
11(3 2 r_eshape 1 2 3 4 1 2) i_ndexOf 3 4{(}{3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {1}\ {2}{)}\ {\mathrm{\underline{i}ndexOf}}\ {3}\ {4}(3 2 r‾eshape 1 2 3 4 1 2) i‾ndexOf 3 4{(}{3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {1}\ {2}{)}\ {\mathrm{\underline{i}ndexOf}}\ {3}\ {4}
12(3 2 r_eshape 1 2 3 4 1 2) i_ndexOf 2 2 r_eshape 1 2 9 9{(}{3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {1}\ {2}{)}\ {\mathrm{\underline{i}ndexOf}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {9}\ {9}(3 2 r‾eshape 1 2 3 4 1 2) i‾ndexOf 2 2 r‾eshape 1 2 9 9{(}{3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {1}\ {2}{)}\ {\mathrm{\underline{i}ndexOf}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {9}\ {9}
132 9 m_ember? 1 2 3{2}\ {9}\ {\mathrm{\underline{m}ember}{?}}\ {1}\ {2}\ {3}2 9 m‾ember? 1 2 3{2}\ {9}\ {\mathrm{\underline{m}ember}{?}}\ {1}\ {2}\ {3}
14"hi!" m_ember? "abcdefghi"{\text{"hi!"}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"abcdefghi"}}"hi!" m‾ember? "abcdefghi"{\text{"hi!"}}\ {\mathrm{\underline{m}ember}{?}}\ {\text{"abcdefghi"}}
15(2 2 r_eshape 1 5 6 2) m_ember? 1 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {5}\ {6}\ {2}{)}\ {\mathrm{\underline{m}ember}{?}}\ {1}\ {2}(2 2 r‾eshape 1 5 6 2) m‾ember? 1 2{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {5}\ {6}\ {2}{)}\ {\mathrm{\underline{m}ember}{?}}\ {1}\ {2}

spec/eval/select-first-cat.case

42 3 s_elect 10 20 30{2}\ {3}\ {\mathrm{\underline{s}elect}}\ {10}\ {20}\ {30}2 3 s‾elect 10 20 30{2}\ {3}\ {\mathrm{\underline{s}elect}}\ {10}\ {20}\ {30}
52 s_elect 10 20 30{2}\ {\mathrm{\underline{s}elect}}\ {10}\ {20}\ {30}2 s‾elect 10 20 30{2}\ {\mathrm{\underline{s}elect}}\ {10}\ {20}\ {30}
62 s_elect 2 3 r_eshape r_ange 6{2}\ {\mathrm{\underline{s}elect}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}2 s‾elect 2 3 r‾eshape r‾ange 6{2}\ {\mathrm{\underline{s}elect}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
7f_irst 10 20 30{\mathrm{\underline{f}irst}}\ {10}\ {20}\ {30}f‾irst 10 20 30{\mathrm{\underline{f}irst}}\ {10}\ {20}\ {30}
8f_irst 2 3 r_eshape r_ange 6{\mathrm{\underline{f}irst}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}f‾irst 2 3 r‾eshape r‾ange 6{\mathrm{\underline{f}irst}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
91 2 c_at 3 4 5{1}\ {2}\ {\mathrm{\underline{c}at}}\ {3}\ {4}\ {5}1 2 c‾at 3 4 5{1}\ {2}\ {\mathrm{\underline{c}at}}\ {3}\ {4}\ {5}
100 c_at 1 2{0}\ {\mathrm{\underline{c}at}}\ {1}\ {2}0 c‾at 1 2{0}\ {\mathrm{\underline{c}at}}\ {1}\ {2}
11(2 2 r_eshape 1 2 3 4) c_at 5 6{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\mathrm{\underline{c}at}}\ {5}\ {6}(2 2 r‾eshape 1 2 3 4) c‾at 5 6{(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}{)}\ {\mathrm{\underline{c}at}}\ {5}\ {6}
12"ab" c_at "cd"{\text{"ab"}}\ {\mathrm{\underline{c}at}}\ {\text{"cd"}}"ab" c‾at "cd"{\text{"ab"}}\ {\mathrm{\underline{c}at}}\ {\text{"cd"}}

spec/eval/signal.case

5u:c_heck := { n -> n < 0 ? "negative" []S_IGNAL "n must be 0 or more"; n }{{}^{\mathrm{u}}\mathrm{\underline{c}heck}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {<}\ {0}\ {?}\ {\text{"negative"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"n must be 0 or more"}}{\diamond}\ {\mathrm{n}}\ {\}}uc‾heck ← { n → n < 0 ? "negative" □S‾IGNAL "n must be 0 or more"⋄ n }{{}^{\mathrm{u}}\mathrm{\underline{c}heck}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {<}\ {0}\ {?}\ {\text{"negative"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"n must be 0 or more"}}{\diamond}\ {\mathrm{n}}\ {\}}
6p_rint! u:c_heck 3{\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}heck}}\ {3}p‾rint! uc‾heck 3{\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{u}}\mathrm{\underline{c}heck}}\ {3}
7u:c_heck -1{{}^{\mathrm{u}}\mathrm{\underline{c}heck}}\ {-1}uc‾heck −1{{}^{\mathrm{u}}\mathrm{\underline{c}heck}}\ {-1}
8p_rint! "not reached"{\mathrm{\underline{p}rint}{!}}\ {\text{"not reached"}}p‾rint! "not reached"{\mathrm{\underline{p}rint}{!}}\ {\text{"not reached"}}

spec/eval/square.case

3u:s_quare := { _r * _r }; u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare ← { _r × _r }⋄ us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}

spec/eval/strands.case

41 2 3{1}\ {2}\ {3}1 2 3{1}\ {2}\ {3}
51 2.5{1}\ {2.5}1 2.5{1}\ {2.5}
6-1 2 -3{-1}\ {2}\ {-3}−1 2 −3{-1}\ {2}\ {-3}

spec/eval/string-comparison.case

4"abc" = "abd"{\text{"abc"}}\ {=}\ {\text{"abd"}}"abc" = "abd"{\text{"abc"}}\ {=}\ {\text{"abd"}}
5"abc" != "abd"{\text{"abc"}}\ {\neq}\ {\text{"abd"}}"abc" ≠ "abd"{\text{"abc"}}\ {\neq}\ {\text{"abd"}}
6"a" < "b"{\text{"a"}}\ {<}\ {\text{"b"}}"a" < "b"{\text{"a"}}\ {<}\ {\text{"b"}}
7"hello" >= "help!"{\text{"hello"}}\ {\geq}\ {\text{"help!"}}"hello" ≥ "help!"{\text{"hello"}}\ {\geq}\ {\text{"help!"}}
8(1 = 1) = 2 = 2{(}{1}\ {=}\ {1}{)}\ {=}\ {2}\ {=}\ {2}(1 = 1) = 2 = 2{(}{1}\ {=}\ {1}{)}\ {=}\ {2}\ {=}\ {2}

spec/eval/string-structure.case

43 t_ake "hello"{3}\ {\mathrm{\underline{t}ake}}\ {\text{"hello"}}3 t‾ake "hello"{3}\ {\mathrm{\underline{t}ake}}\ {\text{"hello"}}
56 t_ake "ab"{6}\ {\mathrm{\underline{t}ake}}\ {\text{"ab"}}6 t‾ake "ab"{6}\ {\mathrm{\underline{t}ake}}\ {\text{"ab"}}
62 d_rop "hello"{2}\ {\mathrm{\underline{d}rop}}\ {\text{"hello"}}2 d‾rop "hello"{2}\ {\mathrm{\underline{d}rop}}\ {\text{"hello"}}
72 3 r_eshape "abcdef"{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\text{"abcdef"}}2 3 r‾eshape "abcdef"{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\text{"abcdef"}}
8"ab" c_at "cd"{\text{"ab"}}\ {\mathrm{\underline{c}at}}\ {\text{"cd"}}"ab" c‾at "cd"{\text{"ab"}}\ {\mathrm{\underline{c}at}}\ {\text{"cd"}}
91 3 s_elect "cat"{1}\ {3}\ {\mathrm{\underline{s}elect}}\ {\text{"cat"}}1 3 s‾elect "cat"{1}\ {3}\ {\mathrm{\underline{s}elect}}\ {\text{"cat"}}
10f_irst "xyz"{\mathrm{\underline{f}irst}}\ {\text{"xyz"}}f‾irst "xyz"{\mathrm{\underline{f}irst}}\ {\text{"xyz"}}
11s_hape "hello"{\mathrm{\underline{s}hape}}\ {\text{"hello"}}s‾hape "hello"{\mathrm{\underline{s}hape}}\ {\text{"hello"}}

spec/eval/strings-are-char-vectors.case

3"hello"{\text{"hello"}}"hello"{\text{"hello"}}
4p_rint! "ab"{\mathrm{\underline{p}rint}{!}}\ {\text{"ab"}}p‾rint! "ab"{\mathrm{\underline{p}rint}{!}}\ {\text{"ab"}}

spec/eval/sub.case

3u:s_ub := { _l - _r }; 10 u:s_ub 3{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}us‾ub ← { _l − _r }⋄ 10 us‾ub 3{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}

spec/eval/swap.case

52 '/ s_wap 1{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}2 ’÷ s‾wap 1{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}
610 '- s_wap 3{10}\ {\text{'}}{-}\ {\mathrm{\underline{s}wap}}\ {3}10 ’− s‾wap 3{10}\ {\text{'}}{-}\ {\mathrm{\underline{s}wap}}\ {3}
72 4 '/ s_wap 1{2}\ {4}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}2 4 ’÷ s‾wap 1{2}\ {4}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}
8u:l_ess3 := (s_wap '-)_ 3{{}^{\mathrm{u}}\mathrm{\underline{l}ess3}}\ {\leftarrow}\ {(}{\mathrm{\underline{s}wap}}\ {\text{'}}{-}{)}{\_}\ {3}ul‾ess3 ← (s‾wap ’−)_ 3{{}^{\mathrm{u}}\mathrm{\underline{l}ess3}}\ {\leftarrow}\ {(}{\mathrm{\underline{s}wap}}\ {\text{'}}{-}{)}{\_}\ {3}
9u:l_ess3 10{{}^{\mathrm{u}}\mathrm{\underline{l}ess3}}\ {10}ul‾ess3 10{{}^{\mathrm{u}}\mathrm{\underline{l}ess3}}\ {10}
10"ab" 'c_at s_wap "cd"{\text{"ab"}}\ {\text{'}}{\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}wap}}\ {\text{"cd"}}"ab" ’c‾at s‾wap "cd"{\text{"ab"}}\ {\text{'}}{\mathrm{\underline{c}at}}\ {\mathrm{\underline{s}wap}}\ {\text{"cd"}}

spec/eval/table.case

51 2 3 '* t_able 1 2 3{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}1 2 3 ’× t‾able 1 2 3{1}\ {2}\ {3}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}
61 2 '+ t_able 10 20 30{1}\ {2}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {10}\ {20}\ {30}1 2 ’+ t‾able 10 20 30{1}\ {2}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {10}\ {20}\ {30}
7"ab" '= t_able "abc"{\text{"ab"}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\text{"abc"}}"ab" ’= t‾able "abc"{\text{"ab"}}\ {\text{'}}{=}\ {\mathrm{\underline{t}able}}\ {\text{"abc"}}
81 2 '{ x y -> (10 * x) + y } t_able 3 4{1}\ {2}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {(}{10}\ {\times}\ {\mathrm{x}}{)}\ {+}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{t}able}}\ {3}\ {4}1 2 ’{ x y → (10 × x) + y } t‾able 3 4{1}\ {2}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {(}{10}\ {\times}\ {\mathrm{x}}{)}\ {+}\ {\mathrm{y}}\ {\}}\ {\mathrm{\underline{t}able}}\ {3}\ {4}
9s_hape (2 2 r_eshape 1) '+ t_able 1 2 3{\mathrm{\underline{s}hape}}\ {(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}s‾hape (2 2 r‾eshape 1) ’+ t‾able 1 2 3{\mathrm{\underline{s}hape}}\ {(}{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}{)}\ {\text{'}}{+}\ {\mathrm{\underline{t}able}}\ {1}\ {2}\ {3}
105 '* t_able 1 2{5}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}5 ’× t‾able 1 2{5}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {1}\ {2}
112 '* t_able 3{2}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {3}2 ’× t‾able 3{2}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {3}

spec/eval/take-and-drop.case

42 t_ake 10 20 30{2}\ {\mathrm{\underline{t}ake}}\ {10}\ {20}\ {30}2 t‾ake 10 20 30{2}\ {\mathrm{\underline{t}ake}}\ {10}\ {20}\ {30}
5-2 t_ake 10 20 30{-2}\ {\mathrm{\underline{t}ake}}\ {10}\ {20}\ {30}−2 t‾ake 10 20 30{-2}\ {\mathrm{\underline{t}ake}}\ {10}\ {20}\ {30}
65 t_ake 1 2 3{5}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}\ {3}5 t‾ake 1 2 3{5}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}\ {3}
7-5 t_ake 1.5 2.5{-5}\ {\mathrm{\underline{t}ake}}\ {1.5}\ {2.5}−5 t‾ake 1.5 2.5{-5}\ {\mathrm{\underline{t}ake}}\ {1.5}\ {2.5}
84 t_ake "ab"{4}\ {\mathrm{\underline{t}ake}}\ {\text{"ab"}}4 t‾ake "ab"{4}\ {\mathrm{\underline{t}ake}}\ {\text{"ab"}}
91 d_rop 10 20 30{1}\ {\mathrm{\underline{d}rop}}\ {10}\ {20}\ {30}1 d‾rop 10 20 30{1}\ {\mathrm{\underline{d}rop}}\ {10}\ {20}\ {30}
10-1 d_rop 10 20 30{-1}\ {\mathrm{\underline{d}rop}}\ {10}\ {20}\ {30}−1 d‾rop 10 20 30{-1}\ {\mathrm{\underline{d}rop}}\ {10}\ {20}\ {30}
115 d_rop 10 20 30{5}\ {\mathrm{\underline{d}rop}}\ {10}\ {20}\ {30}5 d‾rop 10 20 30{5}\ {\mathrm{\underline{d}rop}}\ {10}\ {20}\ {30}
121 t_ake 2 3 r_eshape r_ange 6{1}\ {\mathrm{\underline{t}ake}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}1 t‾ake 2 3 r‾eshape r‾ange 6{1}\ {\mathrm{\underline{t}ake}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}

spec/eval/terminal-types.case

5"t:" u_se< "Terminal"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Terminal"}}"t:" u‾se< "Terminal"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Terminal"}}
6t:RED{{}^{\mathrm{t}}\mathrm{RED}}tRED{{}^{\mathrm{t}}\mathrm{RED}}
7t:UP{{}^{\mathrm{t}}\mathrm{UP}}tUP{{}^{\mathrm{t}}\mathrm{UP}}
8t:UP = t:DOWN{{}^{\mathrm{t}}\mathrm{UP}}\ {=}\ {{}^{\mathrm{t}}\mathrm{DOWN}}tUP = tDOWN{{}^{\mathrm{t}}\mathrm{UP}}\ {=}\ {{}^{\mathrm{t}}\mathrm{DOWN}}
9t:RED []F_G "x"{{}^{\mathrm{t}}\mathrm{RED}}\ {\square \mathrm{\underline{F}G}}\ {\text{"x"}}tRED □F‾G "x"{{}^{\mathrm{t}}\mathrm{RED}}\ {\square \mathrm{\underline{F}G}}\ {\text{"x"}}
10[]K_CHAR t:ENTER{\square \mathrm{\underline{K}CHAR}}\ {{}^{\mathrm{t}}\mathrm{ENTER}}□K‾CHAR tENTER{\square \mathrm{\underline{K}CHAR}}\ {{}^{\mathrm{t}}\mathrm{ENTER}}

spec/eval/transpose-axes.case

6m := 2 3 r_eshape r_ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}m ← 2 3 r‾eshape r‾ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
7a := 2 3 4 r_eshape r_ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}a ← 2 3 4 r‾eshape r‾ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}
8(o_\_12 m) m_atch o_\ m{(}{{\mathrm{\underline{o}}{\backslash}}_{12}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}(o‾\12 m) m‾atch o‾\ m{(}{{\mathrm{\underline{o}}{\backslash}}_{12}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}
9s_hape o_\_23 a{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}s‾hape o‾\23 a{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}
101 s_elect o_\_23 a{1}\ {\mathrm{\underline{s}elect}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}1 s‾elect o‾\23 a{1}\ {\mathrm{\underline{s}elect}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}
11s_hape o_\_12 a{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{12}}\ {\mathrm{a}}s‾hape o‾\12 a{\mathrm{\underline{s}hape}}\ {{\mathrm{\underline{o}}{\backslash}}_{12}}\ {\mathrm{a}}
12(o_\_13 a) m_atch o_\ a{(}{{\mathrm{\underline{o}}{\backslash}}_{13}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}(o‾\13 a) m‾atch o‾\ a{(}{{\mathrm{\underline{o}}{\backslash}}_{13}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}
13(o_\_32 a) m_atch o_\_23 a{(}{{\mathrm{\underline{o}}{\backslash}}_{32}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}(o‾\32 a) m‾atch o‾\23 a{(}{{\mathrm{\underline{o}}{\backslash}}_{32}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {{\mathrm{\underline{o}}{\backslash}}_{23}}\ {\mathrm{a}}

spec/eval/transpose-permute.case

6m := 2 3 r_eshape r_ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}m ← 2 3 r‾eshape r‾ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
7a := 2 3 4 r_eshape r_ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}a ← 2 3 4 r‾eshape r‾ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}
8s_hape 2 1 3 t_ranspose a{\mathrm{\underline{s}hape}}\ {2}\ {1}\ {3}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}s‾hape 2 1 3 t‾ranspose a{\mathrm{\underline{s}hape}}\ {2}\ {1}\ {3}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}
9s_hape 3 1 2 t_ranspose a{\mathrm{\underline{s}hape}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}s‾hape 3 1 2 t‾ranspose a{\mathrm{\underline{s}hape}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}
101 s_elect 3 1 2 t_ranspose a{1}\ {\mathrm{\underline{s}elect}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}1 s‾elect 3 1 2 t‾ranspose a{1}\ {\mathrm{\underline{s}elect}}\ {3}\ {1}\ {2}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}
11(2 1 t_ranspose m) m_atch o_\ m{(}{2}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}(2 1 t‾ranspose m) m‾atch o‾\ m{(}{2}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{m}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}
12(3 2 1 t_ranspose a) m_atch o_\ a{(}{3}\ {2}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}(3 2 1 t‾ranspose a) m‾atch o‾\ a{(}{3}\ {2}\ {1}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}
13(1 2 3 t_ranspose a) m_atch a{(}{1}\ {2}\ {3}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{a}}(1 2 3 t‾ranspose a) m‾atch a{(}{1}\ {2}\ {3}\ {\mathrm{\underline{t}ranspose}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{a}}
141 t_ranspose 1 2 3{1}\ {\mathrm{\underline{t}ranspose}}\ {1}\ {2}\ {3}1 t‾ranspose 1 2 3{1}\ {\mathrm{\underline{t}ranspose}}\ {1}\ {2}\ {3}

spec/eval/transpose.case

6m := 2 3 r_eshape r_ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}m ← 2 3 r‾eshape r‾ange 6{\mathrm{m}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
7a := 2 3 4 r_eshape r_ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}a ← 2 3 4 r‾eshape r‾ange 24{\mathrm{a}}\ {\leftarrow}\ {2}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {24}
8o_\ m{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}o‾\ m{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}
9s_hape o_\ a{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}s‾hape o‾\ a{\mathrm{\underline{s}hape}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}
101 s_elect o_\ a{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}1 s‾elect o‾\ a{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}
11o_\ 1 2 3{\mathrm{\underline{o}}{\backslash}}\ {1}\ {2}\ {3}o‾\ 1 2 3{\mathrm{\underline{o}}{\backslash}}\ {1}\ {2}\ {3}
12o_\ 5{\mathrm{\underline{o}}{\backslash}}\ {5}o‾\ 5{\mathrm{\underline{o}}{\backslash}}\ {5}
13o_\ "abc"{\mathrm{\underline{o}}{\backslash}}\ {\text{"abc"}}o‾\ "abc"{\mathrm{\underline{o}}{\backslash}}\ {\text{"abc"}}
14(o_\ o_\ a) m_atch a{(}{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{a}}(o‾\ o‾\ a) m‾atch a{(}{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{\underline{o}}{\backslash}}\ {\mathrm{a}}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{a}}

spec/eval/trap-halt.case

4'{ @ -> "a" []S_IGNAL "b" } []T_RAP '{ e -> ([]E_CODE e) m_atch "io" ? []R_ECOVER 1; []H_ALT e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {(}{\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"io"}}\ {?}\ {\square \mathrm{\underline{R}ECOVER}}\ {1}{\diamond}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}’{ @ → "a" □S‾IGNAL "b" } □T‾RAP ’{ e → (□E‾CODE e) m‾atch "io" ? □R‾ECOVER 1⋄ □H‾ALT e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {(}{\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}{)}\ {\mathrm{\underline{m}atch}}\ {\text{"io"}}\ {?}\ {\square \mathrm{\underline{R}ECOVER}}\ {1}{\diamond}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}

spec/eval/trap-nested.case

6'{ @ -> '{ @ -> "in" []S_IGNAL "deep" } []T_RAP '{ e -> []H_ALT e } } []T_RAP '{ e -> []R_ECOVER []E_CODE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {\text{"in"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"deep"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}\ {\}}’{ @ → ’{ @ → "in" □S‾IGNAL "deep" } □T‾RAP ’{ e → □H‾ALT e } } □T‾RAP ’{ e → □R‾ECOVER □E‾CODE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {\text{"in"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"deep"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}\ {\}}
7'{ @ -> '{ x -> x = 2 ? "two" []S_IGNAL "no twos"; x } e_ach 1 2 3 } []T_RAP '{ e -> []R_ECOVER 0 0 0 }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {=}\ {2}\ {?}\ {\text{"two"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"no twos"}}{\diamond}\ {\mathrm{x}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {0}\ {0}\ {0}\ {\}}’{ @ → ’{ x → x = 2 ? "two" □S‾IGNAL "no twos"⋄ x } e‾ach 1 2 3 } □T‾RAP ’{ e → □R‾ECOVER 0 0 0 }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {=}\ {2}\ {?}\ {\text{"two"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"no twos"}}{\diamond}\ {\mathrm{x}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {0}\ {0}\ {0}\ {\}}
8'{ @ -> f_irst 0 t_ake 1 2 } []T_RAP '{ e -> []R_ECOVER -1 }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{f}irst}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {-1}\ {\}}’{ @ → f‾irst 0 t‾ake 1 2 } □T‾RAP ’{ e → □R‾ECOVER −1 }{\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{f}irst}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {-1}\ {\}}
9'{ @ -> "a" []S_IGNAL "b" } []T_RAP '{ e -> "handler-broke" []S_IGNAL "while handling" }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\text{"handler-broke"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"while handling"}}\ {\}}’{ @ → "a" □S‾IGNAL "b" } □T‾RAP ’{ e → "handler-broke" □S‾IGNAL "while handling" }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"a"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"b"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\text{"handler-broke"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"while handling"}}\ {\}}

spec/eval/trap-retry.case

5n! := 0{\mathrm{n}!}\ {\leftarrow}\ {0}n! ← 0{\mathrm{n}!}\ {\leftarrow}\ {0}
6u:f_laky := { @ -> n! := n! + 1; n! < 3 ? "again" []S_IGNAL "not yet"; n! }{{}^{\mathrm{u}}\mathrm{\underline{f}laky}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\mathrm{n}!}\ {\leftarrow}\ {\mathrm{n}!}\ {+}\ {1}{\diamond}\ {\mathrm{n}!}\ {<}\ {3}\ {?}\ {\text{"again"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"not yet"}}{\diamond}\ {\mathrm{n}!}\ {\}}uf‾laky ← { @ → n! ← n! + 1⋄ n! < 3 ? "again" □S‾IGNAL "not yet"⋄ n! }{{}^{\mathrm{u}}\mathrm{\underline{f}laky}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\mathrm{n}!}\ {\leftarrow}\ {\mathrm{n}!}\ {+}\ {1}{\diamond}\ {\mathrm{n}!}\ {<}\ {3}\ {?}\ {\text{"again"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"not yet"}}{\diamond}\ {\mathrm{n}!}\ {\}}
7'u:f_laky []T_RAP '{ e -> []R_ETRY e }{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}laky}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ETRY}}\ {\mathrm{e}}\ {\}}’uf‾laky □T‾RAP ’{ e → □R‾ETRY e }{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}laky}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ETRY}}\ {\mathrm{e}}\ {\}}
8n!{\mathrm{n}!}n!{\mathrm{n}!}

spec/eval/trap.case

7u:r_ead := { path -> '{ @ -> []N_GET path } []T_RAP '{ e -> []R_ECOVER "" } }{{}^{\mathrm{u}}\mathrm{\underline{r}ead}}\ {\leftarrow}\ {\{}\ {\mathrm{path}}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {\square \mathrm{\underline{N}GET}}\ {\mathrm{path}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\text{""}}\ {\}}\ {\}}ur‾ead ← { path → ’{ @ → □N‾GET path } □T‾RAP ’{ e → □R‾ECOVER "" } }{{}^{\mathrm{u}}\mathrm{\underline{r}ead}}\ {\leftarrow}\ {\{}\ {\mathrm{path}}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {\square \mathrm{\underline{N}GET}}\ {\mathrm{path}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\text{""}}\ {\}}\ {\}}
8t_ally u:r_ead "no/such/file.txt"{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ead}}\ {\text{"no/such/file.txt"}}t‾ally ur‾ead "no/such/file.txt"{\mathrm{\underline{t}ally}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ead}}\ {\text{"no/such/file.txt"}}
9'{ @ -> "mine" []S_IGNAL "oops" } []T_RAP '{ e -> []R_ECOVER []E_CODE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}\ {\}}’{ @ → "mine" □S‾IGNAL "oops" } □T‾RAP ’{ e → □R‾ECOVER □E‾CODE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}CODE}}\ {\mathrm{e}}\ {\}}
10'{ @ -> "mine" []S_IGNAL "oops" } []T_RAP '{ e -> []R_ECOVER []E_MESSAGE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}MESSAGE}}\ {\mathrm{e}}\ {\}}’{ @ → "mine" □S‾IGNAL "oops" } □T‾RAP ’{ e → □R‾ECOVER □E‾MESSAGE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{"mine"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"oops"}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {\square \mathrm{\underline{E}MESSAGE}}\ {\mathrm{e}}\ {\}}
11'{ @ -> 1 + 2 } []T_RAP '{ e -> []R_ECOVER 0 }{\text{'}}{\{}\ {@}\ {\to}\ {1}\ {+}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {0}\ {\}}’{ @ → 1 + 2 } □T‾RAP ’{ e → □R‾ECOVER 0 }{\text{'}}{\{}\ {@}\ {\to}\ {1}\ {+}\ {2}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {0}\ {\}}

spec/eval/trig.case

4p_i @{\mathrm{\underline{p}i}}\ {@}p‾i @{\mathrm{\underline{p}i}}\ {@}
5c_os p_i @{\mathrm{\underline{c}os}}\ {\mathrm{\underline{p}i}}\ {@}c‾os p‾i @{\mathrm{\underline{c}os}}\ {\mathrm{\underline{p}i}}\ {@}
6s_in 0 1{\mathrm{\underline{s}in}}\ {0}\ {1}s‾in 0 1{\mathrm{\underline{s}in}}\ {0}\ {1}
7c_os 0.0{\mathrm{\underline{c}os}}\ {0.0}c‾os 0.0{\mathrm{\underline{c}os}}\ {0.0}
8a_tan 1{\mathrm{\underline{a}tan}}\ {1}a‾tan 1{\mathrm{\underline{a}tan}}\ {1}
94 * a_tan 1{4}\ {\times}\ {\mathrm{\underline{a}tan}}\ {1}4 × a‾tan 1{4}\ {\times}\ {\mathrm{\underline{a}tan}}\ {1}
10(s_in 0.5)^2 + (c_os 0.5)^2{(}{\mathrm{\underline{s}in}}\ {0.5}{)}^{2}\ {+}\ {(}{\mathrm{\underline{c}os}}\ {0.5}{)}^{2}(s‾in 0.5)2 + (c‾os 0.5)2{(}{\mathrm{\underline{s}in}}\ {0.5}{)}^{2}\ {+}\ {(}{\mathrm{\underline{c}os}}\ {0.5}{)}^{2}

spec/eval/unicode-strings.case

5g := "hello X̲ᵉTᵃL" # a comment may too: ⍝ café{\mathrm{g}}\ {\leftarrow}\ {\text{"hello \underline{X}ᵉTᵃL"}}g ← "hello X‾ᵉTᵃL"{\mathrm{g}}\ {\leftarrow}\ {\text{"hello \underline{X}ᵉTᵃL"}}
6g c_at "!"{\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {\text{"!"}}g c‾at "!"{\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {\text{"!"}}
7t_ally "é"{\mathrm{\underline{t}ally}}\ {\text{"é"}}t‾ally "eˊ"{\mathrm{\underline{t}ally}}\ {\text{"é"}}

spec/eval/unique-sort.case

7u_nique 3 1 3 2 1{\mathrm{\underline{u}nique}}\ {3}\ {1}\ {3}\ {2}\ {1}u‾nique 3 1 3 2 1{\mathrm{\underline{u}nique}}\ {3}\ {1}\ {3}\ {2}\ {1}
8u_nique "mississippi"{\mathrm{\underline{u}nique}}\ {\text{"mississippi"}}u‾nique "mississippi"{\mathrm{\underline{u}nique}}\ {\text{"mississippi"}}
9u_nique 3 2 r_eshape 1 2 3 4 1 2{\mathrm{\underline{u}nique}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {1}\ {2}u‾nique 3 2 r‾eshape 1 2 3 4 1 2{\mathrm{\underline{u}nique}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}\ {1}\ {2}
10s_ort 3 1 4 1 5{\mathrm{\underline{s}ort}}\ {3}\ {1}\ {4}\ {1}\ {5}s‾ort 3 1 4 1 5{\mathrm{\underline{s}ort}}\ {3}\ {1}\ {4}\ {1}\ {5}
11s_ort "banana"{\mathrm{\underline{s}ort}}\ {\text{"banana"}}s‾ort "banana"{\mathrm{\underline{s}ort}}\ {\text{"banana"}}
12s_ort 3 2 r_eshape 2 1 1 9 1 3{\mathrm{\underline{s}ort}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}\ {1}\ {1}\ {9}\ {1}\ {3}s‾ort 3 2 r‾eshape 2 1 1 9 1 3{\mathrm{\underline{s}ort}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {2}\ {1}\ {1}\ {9}\ {1}\ {3}
13s_ort 2.5 1 -3{\mathrm{\underline{s}ort}}\ {2.5}\ {1}\ {-3}s‾ort 2.5 1 −3{\mathrm{\underline{s}ort}}\ {2.5}\ {1}\ {-3}
14g_rade 3 1 4 1 5{\mathrm{\underline{g}rade}}\ {3}\ {1}\ {4}\ {1}\ {5}g‾rade 3 1 4 1 5{\mathrm{\underline{g}rade}}\ {3}\ {1}\ {4}\ {1}\ {5}
15v := 3 1 4 1 5{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}v ← 3 1 4 1 5{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {4}\ {1}\ {5}
16(g_rade v) s_elect v{(}{\mathrm{\underline{g}rade}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}(g‾rade v) s‾elect v{(}{\mathrm{\underline{g}rade}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{v}}
17g_rade "cab"{\mathrm{\underline{g}rade}}\ {\text{"cab"}}g‾rade "cab"{\mathrm{\underline{g}rade}}\ {\text{"cab"}}
18w_here 0 1 1 0 1{\mathrm{\underline{w}here}}\ {0}\ {1}\ {1}\ {0}\ {1}w‾here 0 1 1 0 1{\mathrm{\underline{w}here}}\ {0}\ {1}\ {1}\ {0}\ {1}
19w_here 3 1 4 1 5 > 2{\mathrm{\underline{w}here}}\ {3}\ {1}\ {4}\ {1}\ {5}\ {>}\ {2}w‾here 3 1 4 1 5 > 2{\mathrm{\underline{w}here}}\ {3}\ {1}\ {4}\ {1}\ {5}\ {>}\ {2}
20t_ally w_here 0 0{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{w}here}}\ {0}\ {0}t‾ally w‾here 0 0{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{w}here}}\ {0}\ {0}
21t_ally s_ort 0 t_ake 1 2{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{s}ort}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}t‾ally s‾ort 0 t‾ake 1 2{\mathrm{\underline{t}ally}}\ {\mathrm{\underline{s}ort}}\ {0}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}

spec/eval/warn-ensure-recover.case

5'{ @ -> '{ @ -> 10 + (0 []W_ARN "empty" "nothing") } []E_NSURE '{ @ -> p_rint! "cleaned" } } []T_RAP '{ e -> p_rint! "handled"; []R_ECOVER 99 }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"handled"}}{\diamond}\ {\square \mathrm{\underline{R}ECOVER}}\ {99}\ {\}}’{ @ → ’{ @ → 10 + (0 □W‾ARN "empty" "nothing") } □E‾NSURE ’{ @ → p‾rint! "cleaned" } } □T‾RAP ’{ e → p‾rint! "handled"⋄ □R‾ECOVER 99 }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"handled"}}{\diamond}\ {\square \mathrm{\underline{R}ECOVER}}\ {99}\ {\}}

spec/eval/warn-ensure.case

5'{ @ -> '{ @ -> 10 + (0 []W_ARN "empty" "nothing") } []E_NSURE '{ @ -> p_rint! "cleaned" } } []T_RAP '{ e -> p_rint! "handled"; []C_ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"handled"}}{\diamond}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}’{ @ → ’{ @ → 10 + (0 □W‾ARN "empty" "nothing") } □E‾NSURE ’{ @ → p‾rint! "cleaned" } } □T‾RAP ’{ e → p‾rint! "handled"⋄ □C‾ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}\ {\}}\ {\square \mathrm{\underline{E}NSURE}}\ {\text{'}}{\{}\ {@}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"cleaned"}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"handled"}}{\diamond}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}

spec/eval/warn-halt.case

4'{ @ -> '{ @ -> 10 + (0 []W_ARN "empty" "nothing") } []T_RAP '{ e -> []H_ALT e } } []T_RAP '{ e -> []C_ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}’{ @ → ’{ @ → 10 + (0 □W‾ARN "empty" "nothing") } □T‾RAP ’{ e → □H‾ALT e } } □T‾RAP ’{ e → □C‾ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{H}ALT}}\ {\mathrm{e}}\ {\}}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}

spec/eval/warn-recover.case

4'{ @ -> 10 + (0 []W_ARN "empty" "nothing to add") } []T_RAP '{ e -> []R_ECOVER 99 }{\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {99}\ {\}}’{ @ → 10 + (0 □W‾ARN "empty" "nothing to add") } □T‾RAP ’{ e → □R‾ECOVER 99 }{\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{R}ECOVER}}\ {99}\ {\}}

spec/eval/warn-uncaught.case

410 + (0 []W_ARN "empty" "nothing to add"){10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}10 + (0 □W‾ARN "empty" "nothing to add"){10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}

spec/eval/warn.case

6'{ @ -> 10 + (0 []W_ARN "empty" "nothing to add") } []T_RAP '{ e -> []C_ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}’{ @ → 10 + (0 □W‾ARN "empty" "nothing to add") } □T‾RAP ’{ e → □C‾ONTINUE e }{\text{'}}{\{}\ {@}\ {\to}\ {10}\ {+}\ {(}{0}\ {\square \mathrm{\underline{W}ARN}}\ {\text{"empty"}}\ {\text{"nothing to add"}}{)}\ {\}}\ {\square \mathrm{\underline{T}RAP}}\ {\text{'}}{\{}\ {\mathrm{e}}\ {\to}\ {\square \mathrm{\underline{C}ONTINUE}}\ {\mathrm{e}}\ {\}}

spec/eval/y-combinator.case

4u:Y_ := { f_ -> { x_ -> f_ x_ 'x_ } '{ x_ -> f_ x_ 'x_ } }{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\}}uY‾ ← { f‾ → { x‾ → f‾ x‾ ’x‾ } ’{ x‾ → f‾ x‾ ’x‾ } }{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\text{'}}{\{}\ {\mathrm{\underline{x}}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{x}}}\ {\text{'}}{\mathrm{\underline{x}}}\ {\}}\ {\}}
5u:F_ := { ~s_elf n -> n <= 1 ? 1; n * s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uF‾ ← { ∼s‾elf n → n ≤ 1 ? 1⋄ n × s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{F}}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
6(u:Y_ 'u:F_)_ 5{(}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {5}(uY‾ ’uF‾)_ 5{(}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{)}{\_}\ {5}

spec/integration/combinators.case

6"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
7u:a_b := { a b -> (10 * a) + b }{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{10}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\}}ua‾b ← { a b → (10 × a) + b }{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {(}{10}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {\mathrm{b}}\ {\}}
8u:a_bc := { a b c -> (100 * a) + (10 * b) + c }{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\to}\ {(}{100}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {(}{10}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {\mathrm{c}}\ {\}}ua‾bc ← { a b c → (100 × a) + (10 × b) + c }{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\to}\ {(}{100}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {(}{10}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {\mathrm{c}}\ {\}}
9u:a_bcd := { a b c d -> (1000 * a) + (100 * b) + (10 * c) + d }{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\mathrm{d}}\ {\to}\ {(}{1000}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {(}{100}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {(}{10}\ {\times}\ {\mathrm{c}}{)}\ {+}\ {\mathrm{d}}\ {\}}ua‾bcd ← { a b c d → (1000 × a) + (100 × b) + (10 × c) + d }{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\mathrm{d}}\ {\to}\ {(}{1000}\ {\times}\ {\mathrm{a}}{)}\ {+}\ {(}{100}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {(}{10}\ {\times}\ {\mathrm{c}}{)}\ {+}\ {\mathrm{d}}\ {\}}
10u:i_nc := { _r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}ui‾nc ← { _r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}
11u:d_bl := { _r * 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}ud‾bl ← { _r × 2 }{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}
12c:I_ 7{{}^{\mathrm{c}}\mathrm{\underline{I}}}\ {7}cI‾ 7{{}^{\mathrm{c}}\mathrm{\underline{I}}}\ {7}
131 c:K_ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}1 cK‾ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}
143 c:T_ 'u:d_bl{3}\ {{}^{\mathrm{c}}\mathrm{\underline{T}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}3 cT‾ ’ud‾bl{3}\ {{}^{\mathrm{c}}\mathrm{\underline{T}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}
15'u:a_b c:W_ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {3}’ua‾b cW‾ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {3}
163 c:W_1 'u:a_b{3}\ {{}^{\mathrm{c}}\mathrm{\underline{W}1}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}3 cW‾1 ’ua‾b{3}\ {{}^{\mathrm{c}}\mathrm{\underline{W}1}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}
17'u:d_bl 'u:i_nc c:B_ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}’ud‾bl ’ui‾nc cB‾ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}}\ {5}
181 'u:a_b 'u:i_nc c:B_1 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}1}}\ {2}1 ’ua‾b ’ui‾nc cB‾1 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}1}}\ {2}
19(1 'u:a_bc 'u:i_nc c:B_2 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}2}}\ {2}{)}{\_}\ {3}(1 ’ua‾bc ’ui‾nc cB‾2 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}2}}\ {2}{)}{\_}\ {3}
20'u:i_nc 'u:d_bl 'n_eg c:B_3 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}3}}\ {5}’ui‾nc ’ud‾bl ’n‾eg cB‾3 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}3}}\ {5}
211 'u:a_b c:C_ 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {2}1 ’ua‾b cC‾ 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {2}
22(1 'u:a_b c:D_ 'u:d_bl)_ 2{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{)}{\_}\ {2}(1 ’ua‾b cD‾ ’ud‾bl)_ 2{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{)}{\_}\ {2}
23((1 'u:a_bc c:D_1 2)_ 'u:d_bl)_ 3{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}1}}\ {2}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{)}{\_}\ {3}((1 ’ua‾bc cD‾1 2)_ ’ud‾bl)_ 3{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}1}}\ {2}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{)}{\_}\ {3}
24(1 'u:d_bl 'u:a_b c:D_2 'u:i_nc)_ 2{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}2}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}{)}{\_}\ {2}(1 ’ud‾bl ’ua‾b cD‾2 ’ui‾nc)_ 2{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}2}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}{)}{\_}\ {2}
25((1 'u:a_b c:E_ 'u:a_b)_ 2)_ 3{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{E}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{)}{\_}\ {2}{)}{\_}\ {3}((1 ’ua‾b cE‾ ’ua‾b)_ 2)_ 3{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{E}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{)}{\_}\ {2}{)}{\_}\ {3}
26(((1 'u:a_b 'u:a_b c:E_h 2)_ 'u:a_b)_ 3)_ 4{(}{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{E}h}}\ {2}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{)}{\_}\ {3}{)}{\_}\ {4}(((1 ’ua‾b ’ua‾b cE‾h 2)_ ’ua‾b)_ 3)_ 4{(}{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{E}h}}\ {2}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{)}{\_}\ {3}{)}{\_}\ {4}
27(1 c:F_ 2)_ 'u:a_b{(}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{F}}}\ {2}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}(1 cF‾ 2)_ ’ua‾b{(}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{F}}}\ {2}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}
281 'u:d_bl 'u:a_b c:G_ 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{G}}}\ {2}1 ’ud‾bl ’ua‾b cG‾ 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{G}}}\ {2}
291 'u:a_bc c:H_ 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{H}}}\ {2}1 ’ua‾bc cH‾ 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{H}}}\ {2}
30(1 'u:a_b c:J_ 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{J}}}\ {2}{)}{\_}\ {3}(1 ’ua‾b cJ‾ 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{J}}}\ {2}{)}{\_}\ {3}
31'{ f_ -> f_ 3 } c:O_ 'u:d_bl{\text{'}}{\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\mathrm{\underline{f}}}\ {3}\ {\}}\ {{}^{\mathrm{c}}\mathrm{\underline{O}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}’{ f‾ → f‾ 3 } cO‾ ’ud‾bl{\text{'}}{\{}\ {\mathrm{\underline{f}}}\ {\to}\ {\mathrm{\underline{f}}}\ {3}\ {\}}\ {{}^{\mathrm{c}}\mathrm{\underline{O}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}
32'u:d_bl 'u:i_nc c:Q_ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}}}\ {5}’ud‾bl ’ui‾nc cQ‾ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}}}\ {5}
335 'u:i_nc c:Q_1 'u:d_bl{5}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}1}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}5 ’ui‾nc cQ‾1 ’ud‾bl{5}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}1}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}
34(5 c:Q_2 'u:i_nc)_ 'u:d_bl{(}{5}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}2}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}(5 cQ‾2 ’ui‾nc)_ ’ud‾bl{(}{5}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}2}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}
355 'u:d_bl c:Q_3 'u:i_nc{5}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}3}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}5 ’ud‾bl cQ‾3 ’ui‾nc{5}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}3}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}
36(5 c:Q_4 'u:d_bl)_ 'u:i_nc{(}{5}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}4}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}(5 cQ‾4 ’ud‾bl)_ ’ui‾nc{(}{5}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}4}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}
37(1 c:R_ 'u:a_b)_ 2{(}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{R}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{)}{\_}\ {2}(1 cR‾ ’ua‾b)_ 2{(}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{R}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{)}{\_}\ {2}
38'u:d_bl 'u:a_b c:S_ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{S}}}\ {3}’ud‾bl ’ua‾b cS‾ 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{S}}}\ {3}
39(1 c:V_ 2)_ 'u:a_b{(}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {2}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}(1 cV‾ 2)_ ’ua‾b{(}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {2}{)}{\_}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}
40(1 'u:a_bc c:C_s 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}s}}\ {2}{)}{\_}\ {3}(1 ’ua‾bc cC‾s 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}s}}\ {2}{)}{\_}\ {3}
41(1 'u:a_bc c:R_s 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{R}s}}\ {2}{)}{\_}\ {3}(1 ’ua‾bc cR‾s 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{R}s}}\ {2}{)}{\_}\ {3}
42(1 'u:a_bc c:F_s 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{F}s}}\ {2}{)}{\_}\ {3}(1 ’ua‾bc cF‾s 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{F}s}}\ {2}{)}{\_}\ {3}
43(1 'u:a_bc c:V_s 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{V}s}}\ {2}{)}{\_}\ {3}(1 ’ua‾bc cV‾s 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{V}s}}\ {2}{)}{\_}\ {3}
441 'u:a_bc c:W_s 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}s}}\ {2}1 ’ua‾bc cW‾s 2{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}s}}\ {2}
45((1 'u:a_bcd c:C_ss 2)_ 3)_ 4{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}ss}}\ {2}{)}{\_}\ {3}{)}{\_}\ {4}((1 ’ua‾bcd cC‾ss 2)_ 3)_ 4{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}ss}}\ {2}{)}{\_}\ {3}{)}{\_}\ {4}
46((1 'u:a_bcd c:R_ss 2)_ 3)_ 4{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{R}ss}}\ {2}{)}{\_}\ {3}{)}{\_}\ {4}((1 ’ua‾bcd cR‾ss 2)_ 3)_ 4{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{R}ss}}\ {2}{)}{\_}\ {3}{)}{\_}\ {4}
47((1 'u:a_bcd c:F_ss 2)_ 3)_ 4{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{F}ss}}\ {2}{)}{\_}\ {3}{)}{\_}\ {4}((1 ’ua‾bcd cF‾ss 2)_ 3)_ 4{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{F}ss}}\ {2}{)}{\_}\ {3}{)}{\_}\ {4}
48((1 'u:a_bcd c:V_ss 2)_ 3)_ 4{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{V}ss}}\ {2}{)}{\_}\ {3}{)}{\_}\ {4}((1 ’ua‾bcd cV‾ss 2)_ 3)_ 4{(}{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{V}ss}}\ {2}{)}{\_}\ {3}{)}{\_}\ {4}
49(1 'u:a_bcd c:W_ss 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}ss}}\ {2}{)}{\_}\ {3}(1 ’ua‾bcd cW‾ss 2)_ 3{(}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}ss}}\ {2}{)}{\_}\ {3}
50u:f_act := { ~s_elf n -> n <= 1 ? 1; n * s_elf n - 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}uf‾act ← { ∼s‾elf n → n ≤ 1 ? 1⋄ n × s‾elf n − 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}
51'u:f_act c:Y_ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {5}’uf‾act cY‾ 5{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}}\ {5}

spec/integration/geometry3d.case

8"g:" u_se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}"g:" u‾se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}
9sq := f_loat 3 4 r_eshape 1 1 -1 -1 1 -1 -1 1 0 0 0 0{\mathrm{sq}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {-1}\ {-1}\ {1}\ {0}\ {0}\ {0}\ {0}sq ← f‾loat 3 4 r‾eshape 1 1 −1 −1 1 −1 −1 1 0 0 0 0{\mathrm{sq}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {-1}\ {-1}\ {1}\ {0}\ {0}\ {0}\ {0}
10f_loor 0.5 + (g:r_otZ 90) g:t_urn sq{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otZ}}\ {90}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{sq}}f‾loor 0.5 + (gr‾otZ 90) gt‾urn sq{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otZ}}\ {90}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{sq}}
11f_loor 0.5 + (g:r_otX 90) g:t_urn sq{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otX}}\ {90}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{sq}}f‾loor 0.5 + (gr‾otX 90) gt‾urn sq{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otX}}\ {90}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{sq}}
12f_loor 0.5 + (g:r_otY 180) g:t_urn sq{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otY}}\ {180}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{sq}}f‾loor 0.5 + (gr‾otY 180) gt‾urn sq{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otY}}\ {180}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{sq}}
1310 g:p_roject 3 2 r_eshape 1 1 1 1 0 5{10}\ {{}^{\mathrm{g}}\mathrm{\underline{p}roject}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {1}\ {1}\ {0}\ {5}10 gp‾roject 3 2 r‾eshape 1 1 1 1 0 5{10}\ {{}^{\mathrm{g}}\mathrm{\underline{p}roject}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {1}\ {1}\ {0}\ {5}
14g:f_ar 2 3 1 r_eshape 0 0 -3 0 0 2{{}^{\mathrm{g}}\mathrm{\underline{f}ar}}\ {2}\ {3}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {-3}\ {0}\ {0}\ {2}gf‾ar 2 3 1 r‾eshape 0 0 −3 0 0 2{{}^{\mathrm{g}}\mathrm{\underline{f}ar}}\ {2}\ {3}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {-3}\ {0}\ {0}\ {2}
15g:o_rder 2 3 1 r_eshape 0 0 -3 0 0 2{{}^{\mathrm{g}}\mathrm{\underline{o}rder}}\ {2}\ {3}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {-3}\ {0}\ {0}\ {2}go‾rder 2 3 1 r‾eshape 0 0 −3 0 0 2{{}^{\mathrm{g}}\mathrm{\underline{o}rder}}\ {2}\ {3}\ {1}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {-3}\ {0}\ {0}\ {2}
16s_hape g:c_ube 2{\mathrm{\underline{s}hape}}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ube}}\ {2}s‾hape gc‾ube 2{\mathrm{\underline{s}hape}}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ube}}\ {2}
172 3 4 g:f_ace g:c_ube 2{2}\ {3}\ {4}\ {{}^{\mathrm{g}}\mathrm{\underline{f}ace}}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ube}}\ {2}2 3 4 gf‾ace gc‾ube 2{2}\ {3}\ {4}\ {{}^{\mathrm{g}}\mathrm{\underline{f}ace}}\ {{}^{\mathrm{g}}\mathrm{\underline{c}ube}}\ {2}

spec/integration/idioms.case

5a := 2; b := 3; c := 4{\mathrm{a}}\ {\leftarrow}\ {2}{\diamond}\ {\mathrm{b}}\ {\leftarrow}\ {3}{\diamond}\ {\mathrm{c}}\ {\leftarrow}\ {4}a ← 2⋄ b ← 3⋄ c ← 4{\mathrm{a}}\ {\leftarrow}\ {2}{\diamond}\ {\mathrm{b}}\ {\leftarrow}\ {3}{\diamond}\ {\mathrm{c}}\ {\leftarrow}\ {4}
6a + b * c{\mathrm{a}}\ {+}\ {\mathrm{b}}\ {\times}\ {\mathrm{c}}a + b × c{\mathrm{a}}\ {+}\ {\mathrm{b}}\ {\times}\ {\mathrm{c}}
7x := 5{\mathrm{x}}\ {\leftarrow}\ {5}x ← 5{\mathrm{x}}\ {\leftarrow}\ {5}
8x > 0{\mathrm{x}}\ {>}\ {0}x > 0{\mathrm{x}}\ {>}\ {0}
9y! := 5{\mathrm{y}!}\ {\leftarrow}\ {5}y! ← 5{\mathrm{y}!}\ {\leftarrow}\ {5}
10y! := y! + 1{\mathrm{y}!}\ {\leftarrow}\ {\mathrm{y}!}\ {+}\ {1}y! ← y! + 1{\mathrm{y}!}\ {\leftarrow}\ {\mathrm{y}!}\ {+}\ {1}
11y!{\mathrm{y}!}y!{\mathrm{y}!}
12u:s_q := { x -> x * x }{{}^{\mathrm{u}}\mathrm{\underline{s}q}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\times}\ {\mathrm{x}}\ {\}}us‾q ← { x → x × x }{{}^{\mathrm{u}}\mathrm{\underline{s}q}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\times}\ {\mathrm{x}}\ {\}}
13u:s_q 5{{}^{\mathrm{u}}\mathrm{\underline{s}q}}\ {5}us‾q 5{{}^{\mathrm{u}}\mathrm{\underline{s}q}}\ {5}
14'{ _r * _r } e_ach 1 2 3{\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}’{ _r × _r } e‾ach 1 2 3{\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}
15u:a_bs := { x -> x < 0 ? n_eg x; x }{{}^{\mathrm{u}}\mathrm{\underline{a}bs}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {\mathrm{\underline{n}eg}}\ {\mathrm{x}}{\diamond}\ {\mathrm{x}}\ {\}}ua‾bs ← { x → x < 0 ? n‾eg x⋄ x }{{}^{\mathrm{u}}\mathrm{\underline{a}bs}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {\mathrm{\underline{n}eg}}\ {\mathrm{x}}{\diamond}\ {\mathrm{x}}\ {\}}
16u:a_bs -3{{}^{\mathrm{u}}\mathrm{\underline{a}bs}}\ {-3}ua‾bs −3{{}^{\mathrm{u}}\mathrm{\underline{a}bs}}\ {-3}
17u:n_ame := { x -> x = 0 ? "zero"; "other" }{{}^{\mathrm{u}}\mathrm{\underline{n}ame}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {\text{"zero"}}{\diamond}\ {\text{"other"}}\ {\}}un‾ame ← { x → x = 0 ? "zero"⋄ "other" }{{}^{\mathrm{u}}\mathrm{\underline{n}ame}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {=}\ {0}\ {?}\ {\text{"zero"}}{\diamond}\ {\text{"other"}}\ {\}}
18u:n_ame 0{{}^{\mathrm{u}}\mathrm{\underline{n}ame}}\ {0}un‾ame 0{{}^{\mathrm{u}}\mathrm{\underline{n}ame}}\ {0}
19u:n_ame 7{{}^{\mathrm{u}}\mathrm{\underline{n}ame}}\ {7}un‾ame 7{{}^{\mathrm{u}}\mathrm{\underline{n}ame}}\ {7}
20r_ange 5{\mathrm{\underline{r}ange}}\ {5}r‾ange 5{\mathrm{\underline{r}ange}}\ {5}
21xs := r_ange 6{\mathrm{xs}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {6}xs ← r‾ange 6{\mathrm{xs}}\ {\leftarrow}\ {\mathrm{\underline{r}ange}}\ {6}
22xs * 2{\mathrm{xs}}\ {\times}\ {2}xs × 2{\mathrm{xs}}\ {\times}\ {2}
23(w_here 0 = xs m_od 2) s_elect xs{(}{\mathrm{\underline{w}here}}\ {0}\ {=}\ {\mathrm{xs}}\ {\mathrm{\underline{m}od}}\ {2}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xs}}(w‾here 0 = xs m‾od 2) s‾elect xs{(}{\mathrm{\underline{w}here}}\ {0}\ {=}\ {\mathrm{xs}}\ {\mathrm{\underline{m}od}}\ {2}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xs}}
24'+ r_/ xs{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{xs}}’+ r‾/ xs{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{xs}}
25s_ort 3 1 2{\mathrm{\underline{s}ort}}\ {3}\ {1}\ {2}s‾ort 3 1 2{\mathrm{\underline{s}ort}}\ {3}\ {1}\ {2}
26t_ally xs{\mathrm{\underline{t}ally}}\ {\mathrm{xs}}t‾ally xs{\mathrm{\underline{t}ally}}\ {\mathrm{xs}}
27s := "ab"; t := "cd"{\mathrm{s}}\ {\leftarrow}\ {\text{"ab"}}{\diamond}\ {\mathrm{t}}\ {\leftarrow}\ {\text{"cd"}}s ← "ab"⋄ t ← "cd"{\mathrm{s}}\ {\leftarrow}\ {\text{"ab"}}{\diamond}\ {\mathrm{t}}\ {\leftarrow}\ {\text{"cd"}}
28s c_at t{\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {\mathrm{t}}s c‾at t{\mathrm{s}}\ {\mathrm{\underline{c}at}}\ {\mathrm{t}}
29p_rint! x{\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}p‾rint! x{\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}
30n_umbers "1.5 2"{\mathrm{\underline{n}umbers}}\ {\text{"1.5 2"}}n‾umbers "1.5 2"{\mathrm{\underline{n}umbers}}\ {\text{"1.5 2"}}
31"s:" u_se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
32s:m_ean 1 2 3{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}sm‾ean 1 2 3{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}
33v := 3 1 2{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {2}v ← 3 1 2{\mathrm{v}}\ {\leftarrow}\ {3}\ {1}\ {2}
34'+ r_/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’+ r‾/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
35'+ s_\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}’+ s‾\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}
362 3 r_eshape r_ange 6{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}2 3 r‾eshape r‾ange 6{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
37s_hape 2 3 r_eshape r_ange 6{\mathrm{\underline{s}hape}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}s‾hape 2 3 r‾eshape r‾ange 6{\mathrm{\underline{s}hape}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
38t_ally v{\mathrm{\underline{t}ally}}\ {\mathrm{v}}t‾ally v{\mathrm{\underline{t}ally}}\ {\mathrm{v}}
39r_ev v{\mathrm{\underline{r}ev}}\ {\mathrm{v}}r‾ev v{\mathrm{\underline{r}ev}}\ {\mathrm{v}}
401 o_- v{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}1 o‾− v{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}
41o_\ 2 3 r_eshape r_ange 6{\mathrm{\underline{o}}{\backslash}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}o‾\ 2 3 r‾eshape r‾ange 6{\mathrm{\underline{o}}{\backslash}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
42v '* t_able v{\mathrm{v}}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{v}}v ’× t‾able v{\mathrm{v}}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{v}}
43m := 2 2 r_eshape 1 2 3 4{\mathrm{m}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}m ← 2 2 r‾eshape 1 2 3 4{\mathrm{m}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}\ {3}\ {4}
44m '+ '* i_nner m{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{m}}m ’+ ’× i‾nner m{\mathrm{m}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{m}}
45'n_eg e_ach v{\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{v}}’n‾eg e‾ach v{\text{'}}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{v}}
4610 '- s_wap 3{10}\ {\text{'}}{-}\ {\mathrm{\underline{s}wap}}\ {3}10 ’− s‾wap 3{10}\ {\text{'}}{-}\ {\mathrm{\underline{s}wap}}\ {3}
47'n_eg 'a_bs c_ompose -5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-5}’n‾eg ’a‾bs c‾ompose −5{\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{\mathrm{\underline{a}bs}}\ {\mathrm{\underline{c}ompose}}\ {-5}
48n_eg^3 5{\mathrm{\underline{n}eg}}^{3}\ {5}n‾eg3 5{\mathrm{\underline{n}eg}}^{3}\ {5}
49u:m_ean := ['+ r_/ / t_ally]{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}um‾ean ← [’+ r‾/ ÷ t‾ally]{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {\leftarrow}\ {[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}
50u:m_ean 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}\ {4}um‾ean 1 2 3 4{{}^{\mathrm{u}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}\ {4}
51v i_ndexOf 2{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {2}v i‾ndexOf 2{\mathrm{v}}\ {\mathrm{\underline{i}ndexOf}}\ {2}
522 9 m_ember? v{2}\ {9}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{v}}2 9 m‾ember? v{2}\ {9}\ {\mathrm{\underline{m}ember}{?}}\ {\mathrm{v}}
53v m_atch 3 1 2{\mathrm{v}}\ {\mathrm{\underline{m}atch}}\ {3}\ {1}\ {2}v m‾atch 3 1 2{\mathrm{v}}\ {\mathrm{\underline{m}atch}}\ {3}\ {1}\ {2}
54w_here 0 1 1 0{\mathrm{\underline{w}here}}\ {0}\ {1}\ {1}\ {0}w‾here 0 1 1 0{\mathrm{\underline{w}here}}\ {0}\ {1}\ {1}\ {0}
55f_ormat v{\mathrm{\underline{f}ormat}}\ {\mathrm{v}}f‾ormat v{\mathrm{\underline{f}ormat}}\ {\mathrm{v}}
56"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
5710 '- c:C_ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}10 ’− cC‾ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}
58"1 d_iv 0" t_ry< "@ r_ecover< \"-1\""{\text{"1 d\_iv 0"}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ r\_ecover< \textbackslash{}"-1\textbackslash{}""}}"1 d_iv 0" t‾ry< "@ r_ecover< \"-1\""{\text{"1 d\_iv 0"}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ r\_ecover< \textbackslash{}"-1\textbackslash{}""}}

spec/integration/life-blinker.case

7u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }; u:l_ife 5 5 r_eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }⋄ ul‾ife 5 5 r‾eshape 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {5}\ {5}\ {\mathrm{\underline{r}eshape}}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {1}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}\ {0}

spec/integration/long-aliases.case

4"combinators:" u_se< "Combinators"{\text{"combinators:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"combinators:" u‾se< "Combinators"{\text{"combinators:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
51 combinators:K_ 2{1}\ {{}^{\mathrm{combinators}}\mathrm{\underline{K}}}\ {2}1 combinatorsK‾ 2{1}\ {{}^{\mathrm{combinators}}\mathrm{\underline{K}}}\ {2}
6"b2:" u_se< "Stats"{\text{"b2:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"b2:" u‾se< "Stats"{\text{"b2:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
7b2:m_ean 1 2 3{{}^{\mathrm{b2}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}b2m‾ean 1 2 3{{}^{\mathrm{b2}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}

spec/integration/maybe.case

4"m:" u_se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}"m:" u‾se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}
50 m:o_r m:j_ust 7{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {7}0 mo‾r mj‾ust 7{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {7}
60 m:o_r 'm:n_othing{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}0 mo‾r ’mn‾othing{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}
70 m:o_r '{ _r + 1 } m:m_ap m:j_ust 7{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}ap}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {7}0 mo‾r ’{ _r + 1 } mm‾ap mj‾ust 7{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}ap}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {7}
80 m:o_r '{ _r + 1 } m:m_ap 'm:n_othing{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}ap}}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}0 mo‾r ’{ _r + 1 } mm‾ap ’mn‾othing{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}ap}}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}
90 '{ _r * 2 } m:m_aybe m:j_ust 7{0}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}aybe}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {7}0 ’{ _r × 2 } mm‾aybe mj‾ust 7{0}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}aybe}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {7}
100 '{ _r * 2 } m:m_aybe 'm:n_othing{0}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}aybe}}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}0 ’{ _r × 2 } mm‾aybe ’mn‾othing{0}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {\times}\ {2}\ {\}}\ {{}^{\mathrm{m}}\mathrm{\underline{m}aybe}}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}
11u:h_alf := { x -> x = 1 ? 'm:n_othing; m:j_ust x - 1 }{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {=}\ {1}\ {?}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}{\diamond}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\mathrm{x}}\ {-}\ {1}\ {\}}uh‾alf ← { x → x = 1 ? ’mn‾othing⋄ mj‾ust x − 1 }{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {=}\ {1}\ {?}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}{\diamond}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\mathrm{x}}\ {-}\ {1}\ {\}}
120 m:o_r 'u:h_alf m:b_ind 'u:h_alf m:b_ind m:j_ust 5{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {5}0 mo‾r ’uh‾alf mb‾ind ’uh‾alf mb‾ind mj‾ust 5{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {5}
130 m:o_r 'u:h_alf m:b_ind 'u:h_alf m:b_ind m:j_ust 2{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {2}0 mo‾r ’uh‾alf mb‾ind ’uh‾alf mb‾ind mj‾ust 2{0}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{m}}\mathrm{\underline{b}ind}}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {2}

spec/integration/reject-alias-digit-first.case

3"2b:" u_se< "Stats"{\text{"2b:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"2b:" u‾se< "Stats"{\text{"2b:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}

spec/integration/reject-alias-uppercase.case

3"Abc:" u_se< "Stats"{\text{"Abc:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"Abc:" u‾se< "Stats"{\text{"Abc:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}

spec/integration/reject-hidden-namespace.case

3"s:" u_se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
4LA:m_ean 1 2{{}^{\mathrm{LA}}\mathrm{\underline{m}ean}}\ {1}\ {2}LAm‾ean 1 2{{}^{\mathrm{LA}}\mathrm{\underline{m}ean}}\ {1}\ {2}

spec/integration/reject-maybe-types.case

5"m:" u_se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}"m:" u‾se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}
6u:p_ositive := { x -> x > 0 ? m:j_ust x; 'm:n_othing }{{}^{\mathrm{u}}\mathrm{\underline{p}ositive}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {>}\ {0}\ {?}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\mathrm{x}}{\diamond}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}\ {\}}up‾ositive ← { x → x > 0 ? mj‾ust x⋄ ’mn‾othing }{{}^{\mathrm{u}}\mathrm{\underline{p}ositive}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {>}\ {0}\ {?}\ {{}^{\mathrm{m}}\mathrm{\underline{j}ust}}\ {\mathrm{x}}{\diamond}\ {\text{'}}{{}^{\mathrm{m}}\mathrm{\underline{n}othing}}\ {\}}
7"none" m:o_r u:p_ositive 7{\text{"none"}}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ositive}}\ {7}"none" mo‾r up‾ositive 7{\text{"none"}}\ {{}^{\mathrm{m}}\mathrm{\underline{o}r}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ositive}}\ {7}

spec/integration/svg.case

5"g:" u_se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}"g:" u‾se< "Geometry3D"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Geometry3D"}}
6"v:" u_se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}"v:" u‾se< "Svg"{\text{"v:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Svg"}}
7sq := f_loat 3 4 r_eshape 1 1 -1 -1 1 -1 -1 1 0 0 0 0{\mathrm{sq}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {-1}\ {-1}\ {1}\ {0}\ {0}\ {0}\ {0}sq ← f‾loat 3 4 r‾eshape 1 1 −1 −1 1 −1 −1 1 0 0 0 0{\mathrm{sq}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {3}\ {4}\ {\mathrm{\underline{r}eshape}}\ {1}\ {1}\ {-1}\ {-1}\ {1}\ {-1}\ {-1}\ {1}\ {0}\ {0}\ {0}\ {0}
8pts := 50 + 20 * 10 g:p_roject (g:r_otZ 90) g:t_urn sq{\mathrm{pts}}\ {\leftarrow}\ {50}\ {+}\ {20}\ {\times}\ {10}\ {{}^{\mathrm{g}}\mathrm{\underline{p}roject}}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otZ}}\ {90}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{sq}}pts ← 50 + 20 × 10 gp‾roject (gr‾otZ 90) gt‾urn sq{\mathrm{pts}}\ {\leftarrow}\ {50}\ {+}\ {20}\ {\times}\ {10}\ {{}^{\mathrm{g}}\mathrm{\underline{p}roject}}\ {(}{{}^{\mathrm{g}}\mathrm{\underline{r}otZ}}\ {90}{)}\ {{}^{\mathrm{g}}\mathrm{\underline{t}urn}}\ {\mathrm{sq}}
9100 100 v:p_icture (v:t_ranslate 0 0) v:g_roup ((v:f_ill "#ccc") c_at "#333" v:s_troke 1) v:p_olygon f_loor 0.5 + pts{100}\ {100}\ {{}^{\mathrm{v}}\mathrm{\underline{p}icture}}\ {(}{{}^{\mathrm{v}}\mathrm{\underline{t}ranslate}}\ {0}\ {0}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{g}roup}}\ {(}{(}{{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\text{"\#ccc"}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\#333"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}troke}}\ {1}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}olygon}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {\mathrm{pts}}100 100 vp‾icture (vt‾ranslate 0 0) vg‾roup ((vf‾ill "#ccc") c‾at "#333" vs‾troke 1) vp‾olygon f‾loor 0.5 + pts{100}\ {100}\ {{}^{\mathrm{v}}\mathrm{\underline{p}icture}}\ {(}{{}^{\mathrm{v}}\mathrm{\underline{t}ranslate}}\ {0}\ {0}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{g}roup}}\ {(}{(}{{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\text{"\#ccc"}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\#333"}}\ {{}^{\mathrm{v}}\mathrm{\underline{s}troke}}\ {1}{)}\ {{}^{\mathrm{v}}\mathrm{\underline{p}olygon}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {\mathrm{pts}}

spec/integration/turtle.case

5"t:" u_se< "Turtle"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Turtle"}}"t:" u‾se< "Turtle"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Turtle"}}
6t:p_olygon 4{{}^{\mathrm{t}}\mathrm{\underline{p}olygon}}\ {4}tp‾olygon 4{{}^{\mathrm{t}}\mathrm{\underline{p}olygon}}\ {4}
7f_loor 0.5 + t:p_oints 0 90 90 90{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {0}\ {90}\ {90}\ {90}f‾loor 0.5 + tp‾oints 0 90 90 90{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {{}^{\mathrm{t}}\mathrm{\underline{p}oints}}\ {0}\ {90}\ {90}\ {90}
8f_loor 0.5 + 1 2 t:w_alk 0 90{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {1}\ {2}\ {{}^{\mathrm{t}}\mathrm{\underline{w}alk}}\ {0}\ {90}f‾loor 0.5 + 1 2 tw‾alk 0 90{\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {1}\ {2}\ {{}^{\mathrm{t}}\mathrm{\underline{w}alk}}\ {0}\ {90}
960 t:t_urn 0 10 20{60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {0}\ {10}\ {20}60 tt‾urn 0 10 20{60}\ {{}^{\mathrm{t}}\mathrm{\underline{t}urn}}\ {0}\ {10}\ {20}

spec/lex/abutting.case

31+2 x+y f_(x){1}{+}{2}\ {\mathrm{x}}{+}{\mathrm{y}}\ {\mathrm{\underline{f}}}{(}{\mathrm{x}}{)}1+2 x+y f‾(x){1}{+}{2}\ {\mathrm{x}}{+}{\mathrm{y}}\ {\mathrm{\underline{f}}}{(}{\mathrm{x}}{)}

spec/lex/assign.case

3x := 3{\mathrm{x}}\ {\leftarrow}\ {3}x ← 3{\mathrm{x}}\ {\leftarrow}\ {3}

spec/lex/axes.case

3r_/_2 o_-_12 r__2 n_eg_2{{\mathrm{\underline{r}}{/}}_{2}}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {{\mathrm{\underline{r}}}_{2}}\ {{\mathrm{\underline{n}eg}}_{2}}r‾/2 o‾−12 r‾2 n‾eg2{{\mathrm{\underline{r}}{/}}_{2}}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {{\mathrm{\underline{r}}}_{2}}\ {{\mathrm{\underline{n}eg}}_{2}}

spec/lex/binding-arrow-guard.case

3{ ~s_elf n -> n <= 1 ? 1 }{\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}\ {\}}{ ∼s‾elf n → n ≤ 1 ? 1 }{\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}\ {\}}

spec/lex/comments.case

3x := 3 # note{\mathrm{x}}\ {\leftarrow}\ {3}x ← 3{\mathrm{x}}\ {\leftarrow}\ {3}
4y{\mathrm{y}}y{\mathrm{y}}

spec/lex/docs-input-examples.case

3x^-1 x^0.5 (a + b)^2 x ^ n 1+2 x+y 3 - 1 f_- 1 x != 3 x! = 3{\mathrm{x}}^{-1}\ {\mathrm{x}}^{0.5}\ {(}{\mathrm{a}}\ {+}\ {\mathrm{b}}{)}^{2}\ {\mathrm{x}}\ {\mathbin{\hat{}}}\ {\mathrm{n}}\ {1}{+}{2}\ {\mathrm{x}}{+}{\mathrm{y}}\ {3}\ {-}\ {1}\ {\mathrm{\underline{f}}{-}}\ {1}\ {\mathrm{x}}\ {\neq}\ {3}\ {\mathrm{x}!}\ {=}\ {3}x−1 x0.5 (a + b)2 x ^ n 1+2 x+y 3 − 1 f‾− 1 x ≠ 3 x! = 3{\mathrm{x}}^{-1}\ {\mathrm{x}}^{0.5}\ {(}{\mathrm{a}}\ {+}\ {\mathrm{b}}{)}^{2}\ {\mathrm{x}}\ {\mathbin{\hat{}}}\ {\mathrm{n}}\ {1}{+}{2}\ {\mathrm{x}}{+}{\mathrm{y}}\ {3}\ {-}\ {1}\ {\mathrm{\underline{f}}{-}}\ {1}\ {\mathrm{x}}\ {\neq}\ {3}\ {\mathrm{x}!}\ {=}\ {3}

spec/lex/exponent-literals.case

51.5e-7 6.02e23 2E3 -1e-3 x 1.5 e3{1.5e-7}\ {6.02e23}\ {2E3}\ {-1e-3}\ {\mathrm{x}}\ {1.5}\ {\mathrm{e3}}1.5e−7 6.02e23 2E3 −1e−3 x 1.5 e3{1.5e-7}\ {6.02e23}\ {2E3}\ {-1e-3}\ {\mathrm{x}}\ {1.5}\ {\mathrm{e3}}

spec/lex/exponents.case

3x^2 x^-1 x^0.5 _r^2 (a + b)^2{\mathrm{x}}^{2}\ {\mathrm{x}}^{-1}\ {\mathrm{x}}^{0.5}\ {\_\mathrm{r}}^{2}\ {(}{\mathrm{a}}\ {+}\ {\mathrm{b}}{)}^{2}x2 x−1 x0.5 _r2 (a + b)2{\mathrm{x}}^{2}\ {\mathrm{x}}^{-1}\ {\mathrm{x}}^{0.5}\ {\_\mathrm{r}}^{2}\ {(}{\mathrm{a}}\ {+}\ {\mathrm{b}}{)}^{2}

spec/lex/function-names.case

3r_ev s_quare self_ r_2 u:s_quare c:K_ l:B_{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}quare}}\ {\mathrm{sel\underline{f}}}\ {\mathrm{\underline{r}2}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {{}^{\mathrm{l}}\mathrm{\underline{B}}}r‾ev s‾quare self‾ r‾2 us‾quare cK‾ lB‾{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{s}quare}}\ {\mathrm{sel\underline{f}}}\ {\mathrm{\underline{r}2}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {{}^{\mathrm{l}}\mathrm{\underline{B}}}

spec/lex/lambda-args.case

3_l _r _l_ _r_{\_\mathrm{l}}\ {\_\mathrm{r}}\ {\_\mathrm{l}\_}\ {\_\mathrm{r}\_}_l _r _l_ _r_{\_\mathrm{l}}\ {\_\mathrm{r}}\ {\_\mathrm{l}\_}\ {\_\mathrm{r}\_}

spec/lex/life.case

3u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}

spec/lex/long-prefixes.case

5combinators:K_ 1 2; b2:m_ean 3; quux:y{{}^{\mathrm{combinators}}\mathrm{\underline{K}}}\ {1}\ {2}{\diamond}\ {{}^{\mathrm{b2}}\mathrm{\underline{m}ean}}\ {3}{\diamond}\ {{}^{\mathrm{quux}}\mathrm{y}}combinatorsK‾ 1 2⋄ b2m‾ean 3⋄ quuxy{{}^{\mathrm{combinators}}\mathrm{\underline{K}}}\ {1}\ {2}{\diamond}\ {{}^{\mathrm{b2}}\mathrm{\underline{m}ean}}\ {3}{\diamond}\ {{}^{\mathrm{quux}}\mathrm{y}}

spec/lex/negative-literals.case

3-1 0 1 3 -1 x - -3{-1}\ {0}\ {1}\ {3}\ {-1}\ {\mathrm{x}}\ {-}\ {-3}−1 0 1 3 −1 x − −3{-1}\ {0}\ {1}\ {3}\ {-1}\ {\mathrm{x}}\ {-}\ {-3}

spec/lex/power-spaced.case

3x ^ n{\mathrm{x}}\ {\mathbin{\hat{}}}\ {\mathrm{n}}x ^ n{\mathrm{x}}\ {\mathbin{\hat{}}}\ {\mathrm{n}}

spec/lex/quotes.case

3'+ r_/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’+ r‾/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}

spec/lex/square.case

3u:s_quare := { _r * _r }; u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare ← { _r × _r }⋄ us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}

spec/lex/strings.case

3"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}

spec/lex/subtraction.case

33 - 1{3}\ {-}\ {1}3 − 1{3}\ {-}\ {1}

spec/lex/symbols.case

3+ - * / ^ = != < > <= >= & |{+}\ {-}\ {\times}\ {\div}\ {\mathbin{\hat{}}}\ {=}\ {\neq}\ {<}\ {>}\ {\leq}\ {\geq}\ {\wedge}\ {\vee}+ − × ÷ ^ = ≠ < > ≤ ≥ ∧ ∨{+}\ {-}\ {\times}\ {\div}\ {\mathbin{\hat{}}}\ {=}\ {\neq}\ {<}\ {>}\ {\leq}\ {\geq}\ {\wedge}\ {\vee}

spec/lex/trailing-marks.case

3r_/ s_\ o_- e_mpty? p_rint! u_se< e_q~{\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{\underline{e}mpty}{?}}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{\underline{u}se}{<}}\ {\mathrm{\underline{e}q}{\sim}}r‾/ s‾\ o‾− e‾mpty? p‾rint! u‾se< e‾q∼{\mathrm{\underline{r}}{/}}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{\underline{e}mpty}{?}}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{\underline{u}se}{<}}\ {\mathrm{\underline{e}q}{\sim}}

spec/lex/variables.case

3x board2 count! m:pi{\mathrm{x}}\ {\mathrm{board2}}\ {\mathrm{count}!}\ {{}^{\mathrm{m}}\mathrm{pi}}x board2 count! mpi{\mathrm{x}}\ {\mathrm{board2}}\ {\mathrm{count}!}\ {{}^{\mathrm{m}}\mathrm{pi}}

spec/macros/argument-error-located.case

4x := 1{\mathrm{x}}\ {\leftarrow}\ {1}x ← 1{\mathrm{x}}\ {\leftarrow}\ {1}
5"x > 0" i_f< "y_z 1; 2"{\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"y\_z 1; 2"}}"x > 0" i‾f< "y_z 1; 2"{\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"y\_z 1; 2"}}

spec/macros/assert.case

5x := 6{\mathrm{x}}\ {\leftarrow}\ {6}x ← 6{\mathrm{x}}\ {\leftarrow}\ {6}
6"x > 10" a_ssert< "x is big"{\text{"x > 10"}}\ {\mathrm{\underline{a}ssert}{<}}\ {\text{"x is big"}}"x > 10" a‾ssert< "x is big"{\text{"x > 10"}}\ {\mathrm{\underline{a}ssert}{<}}\ {\text{"x is big"}}
7"x > 1" a_ssert< @{\text{"x > 1"}}\ {\mathrm{\underline{a}ssert}{<}}\ {@}"x > 1" a‾ssert< @{\text{"x > 1"}}\ {\mathrm{\underline{a}ssert}{<}}\ {@}
8x{\mathrm{x}}x{\mathrm{x}}

spec/macros/catch-halts.case

4u:r_ead := { c -> c []S_IGNAL "stopped" }{{}^{\mathrm{u}}\mathrm{\underline{r}ead}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"stopped"}}\ {\}}ur‾ead ← { c → c □S‾IGNAL "stopped" }{{}^{\mathrm{u}}\mathrm{\underline{r}ead}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"stopped"}}\ {\}}
5"u:r_ead \"other\"" t_ry< "\"io empty\" c_atch< \"@ r_ecover< \\\"1\\\"\""{\text{"u:r\_ead \textbackslash{}"other\textbackslash{}""}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"\textbackslash{}"io empty\textbackslash{}" c\_atch< \textbackslash{}"@ r\_ecover< \textbackslash{}\textbackslash{}\textbackslash{}"1\textbackslash{}\textbackslash{}\textbackslash{}"\textbackslash{}""}}"u:r_ead \"other\"" t‾ry< "\"io empty\" c_atch< \"@ r_ecover< \\\"1\\\"\""{\text{"u:r\_ead \textbackslash{}"other\textbackslash{}""}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"\textbackslash{}"io empty\textbackslash{}" c\_atch< \textbackslash{}"@ r\_ecover< \textbackslash{}\textbackslash{}\textbackslash{}"1\textbackslash{}\textbackslash{}\textbackslash{}"\textbackslash{}""}}

spec/macros/catch.case

5u:r_ead := { c -> c []S_IGNAL "stopped" }{{}^{\mathrm{u}}\mathrm{\underline{r}ead}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"stopped"}}\ {\}}ur‾ead ← { c → c □S‾IGNAL "stopped" }{{}^{\mathrm{u}}\mathrm{\underline{r}ead}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\to}\ {\mathrm{c}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"stopped"}}\ {\}}
6"u:r_ead \"empty\"" t_ry< "\"io empty\" c_atch< \"@ r_ecover< \\\"1\\\"\""{\text{"u:r\_ead \textbackslash{}"empty\textbackslash{}""}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"\textbackslash{}"io empty\textbackslash{}" c\_atch< \textbackslash{}"@ r\_ecover< \textbackslash{}\textbackslash{}\textbackslash{}"1\textbackslash{}\textbackslash{}\textbackslash{}"\textbackslash{}""}}"u:r_ead \"empty\"" t‾ry< "\"io empty\" c_atch< \"@ r_ecover< \\\"1\\\"\""{\text{"u:r\_ead \textbackslash{}"empty\textbackslash{}""}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"\textbackslash{}"io empty\textbackslash{}" c\_atch< \textbackslash{}"@ r\_ecover< \textbackslash{}\textbackslash{}\textbackslash{}"1\textbackslash{}\textbackslash{}\textbackslash{}"\textbackslash{}""}}

spec/macros/cfg.case

4@ c_fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}@ c‾fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}
5@ c_fg< "web"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"web"}}@ c‾fg< "web"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"web"}}

spec/macros/combinators-b.case

4"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
5u:s_umTo := "'+ r_/" c:B_< "r_ange"{{}^{\mathrm{u}}\mathrm{\underline{s}umTo}}\ {\leftarrow}\ {\text{"'+ r\_/"}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}{<}}\ {\text{"r\_ange"}}us‾umTo ← "’+ r_/" cB‾< "r_ange"{{}^{\mathrm{u}}\mathrm{\underline{s}umTo}}\ {\leftarrow}\ {\text{"'+ r\_/"}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}}{<}}\ {\text{"r\_ange"}}
6u:s_umTo 4{{}^{\mathrm{u}}\mathrm{\underline{s}umTo}}\ {4}us‾umTo 4{{}^{\mathrm{u}}\mathrm{\underline{s}umTo}}\ {4}

spec/macros/combinators-y.case

5"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
6"u:f_ib5" c:Y_< "{ ~s_elf n -> n < 2 ? n; (s_elf n - 1) + s_elf n - 2 }"{\text{"u:f\_ib5"}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}{<}}\ {\text{"\{ \textasciitilde{}s\_elf n -> n < 2 ? n; (s\_elf n - 1) + s\_elf n - 2 \}"}}"u:f_ib5" cY‾< "{ ~s_elf n -> n < 2 ? n; (s_elf n - 1) + s_elf n - 2 }"{\text{"u:f\_ib5"}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}{<}}\ {\text{"\{ \textasciitilde{}s\_elf n -> n < 2 ? n; (s\_elf n - 1) + s\_elf n - 2 \}"}}
7'u:f_ib5 e_ach o_ffsets 10{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}ib5}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {10}’uf‾ib5 e‾ach o‾ffsets 10{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{f}ib5}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{o}ffsets}}\ {10}
81 c:K_ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}1 cK‾ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}

spec/macros/dbg-hygienic.case

5v := 10{\mathrm{v}}\ {\leftarrow}\ {10}v ← 10{\mathrm{v}}\ {\leftarrow}\ {10}
6dbgValue := 20{\mathrm{dbgValue}}\ {\leftarrow}\ {20}dbgValue ← 20{\mathrm{dbgValue}}\ {\leftarrow}\ {20}
71 + @ d_bg< "v + dbgValue"{1}\ {+}\ {@}\ {\mathrm{\underline{d}bg}{<}}\ {\text{"v + dbgValue"}}1 + @ d‾bg< "v + dbgValue"{1}\ {+}\ {@}\ {\mathrm{\underline{d}bg}{<}}\ {\text{"v + dbgValue"}}

spec/macros/dbg.case

4x := 6{\mathrm{x}}\ {\leftarrow}\ {6}x ← 6{\mathrm{x}}\ {\leftarrow}\ {6}
5y := 1 + @ d_bg< "x * 2"{\mathrm{y}}\ {\leftarrow}\ {1}\ {+}\ {@}\ {\mathrm{\underline{d}bg}{<}}\ {\text{"x * 2"}}y ← 1 + @ d‾bg< "x * 2"{\mathrm{y}}\ {\leftarrow}\ {1}\ {+}\ {@}\ {\mathrm{\underline{d}bg}{<}}\ {\text{"x * 2"}}
6y{\mathrm{y}}y{\mathrm{y}}

spec/macros/each.case

4"sum max" e_ach< "u:$w_s := { a b -> a + b }"{\text{"sum max"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"u:\$w\_s := \{ a b -> a + b \}"}}"sum max" e‾ach< "u:$w_s := { a b -> a + b }"{\text{"sum max"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"u:\$w\_s := \{ a b -> a + b \}"}}
53 u:sum_s 4{3}\ {{}^{\mathrm{u}}\mathrm{su\underline{m}s}}\ {4}3 usum‾s 4{3}\ {{}^{\mathrm{u}}\mathrm{su\underline{m}s}}\ {4}
6"twice thrice" e_ach< "$w := 2"{\text{"twice thrice"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"\$w := 2"}}"twice thrice" e‾ach< "$w := 2"{\text{"twice thrice"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"\$w := 2"}}
7twice + thrice{\mathrm{twice}}\ {+}\ {\mathrm{thrice}}twice + thrice{\mathrm{twice}}\ {+}\ {\mathrm{thrice}}

spec/macros/error.case

4x := 1{\mathrm{x}}\ {\leftarrow}\ {1}x ← 1{\mathrm{x}}\ {\leftarrow}\ {1}
5"too-big" e_rror< "x must be small"{\text{"too-big"}}\ {\mathrm{\underline{e}rror}{<}}\ {\text{"x must be small"}}"too-big" e‾rror< "x must be small"{\text{"too-big"}}\ {\mathrm{\underline{e}rror}{<}}\ {\text{"x must be small"}}

spec/macros/file.case

4@ f_ile< @{@}\ {\mathrm{\underline{f}ile}{<}}\ {@}@ f‾ile< @{@}\ {\mathrm{\underline{f}ile}{<}}\ {@}

spec/macros/finally.case

4"p_rint! 1; 2" f_inally< "p_rint! \"cleaned\""{\text{"p\_rint! 1; 2"}}\ {\mathrm{\underline{f}inally}{<}}\ {\text{"p\_rint! \textbackslash{}"cleaned\textbackslash{}""}}"p_rint! 1; 2" f‾inally< "p_rint! \"cleaned\""{\text{"p\_rint! 1; 2"}}\ {\mathrm{\underline{f}inally}{<}}\ {\text{"p\_rint! \textbackslash{}"cleaned\textbackslash{}""}}

spec/macros/format-hole-located.case

4x := 6{\mathrm{x}}\ {\leftarrow}\ {6}x ← 6{\mathrm{x}}\ {\leftarrow}\ {6}
5@ f_ormat< "x is {x + \"a\"}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x is \{x + \textbackslash{}"a\textbackslash{}"\}"}}@ f‾ormat< "x is {x + \"a\"}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x is \{x + \textbackslash{}"a\textbackslash{}"\}"}}

spec/macros/format.case

5x := 6{\mathrm{x}}\ {\leftarrow}\ {6}x ← 6{\mathrm{x}}\ {\leftarrow}\ {6}
6n := 3 4{\mathrm{n}}\ {\leftarrow}\ {3}\ {4}n ← 3 4{\mathrm{n}}\ {\leftarrow}\ {3}\ {4}
7@ f_ormat< "x = {x}, twice {x * 2}, n = {n} {{braces}}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x = \{x\}, twice \{x * 2\}, n = \{n\} \{\{braces\}\}"}}@ f‾ormat< "x = {x}, twice {x * 2}, n = {n} {{braces}}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x = \{x\}, twice \{x * 2\}, n = \{n\} \{\{braces\}\}"}}
8p_rint! @ f_ormat< "plain"{\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"plain"}}p‾rint! @ f‾ormat< "plain"{\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"plain"}}

spec/macros/hygiene-anaphor.case

4"x:" u_se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"x:" u‾se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
5"3 + 4" x:w_ith< "it * it"{\text{"3 + 4"}}\ {{}^{\mathrm{x}}\mathrm{\underline{w}ith}{<}}\ {\text{"it * it"}}"3 + 4" xw‾ith< "it * it"{\text{"3 + 4"}}\ {{}^{\mathrm{x}}\mathrm{\underline{w}ith}{<}}\ {\text{"it * it"}}

spec/macros/hygiene-capture.case

5"x:" u_se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"x:" u‾se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
6t := 5{\mathrm{t}}\ {\leftarrow}\ {5}t ← 5{\mathrm{t}}\ {\leftarrow}\ {5}
7@ x:t_wice< "t + 1"{@}\ {{}^{\mathrm{x}}\mathrm{\underline{t}wice}{<}}\ {\text{"t + 1"}}@ xt‾wice< "t + 1"{@}\ {{}^{\mathrm{x}}\mathrm{\underline{t}wice}{<}}\ {\text{"t + 1"}}

spec/macros/hygiene-numbering.case

4"x:" u_se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"x:" u‾se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
5t := 5{\mathrm{t}}\ {\leftarrow}\ {5}t ← 5{\mathrm{t}}\ {\leftarrow}\ {5}
6@ x:t_wice< "t + 1"{@}\ {{}^{\mathrm{x}}\mathrm{\underline{t}wice}{<}}\ {\text{"t + 1"}}@ xt‾wice< "t + 1"{@}\ {{}^{\mathrm{x}}\mathrm{\underline{t}wice}{<}}\ {\text{"t + 1"}}
7@ x:t_wice< "t * 2"{@}\ {{}^{\mathrm{x}}\mathrm{\underline{t}wice}{<}}\ {\text{"t * 2"}}@ xt‾wice< "t * 2"{@}\ {{}^{\mathrm{x}}\mathrm{\underline{t}wice}{<}}\ {\text{"t * 2"}}

spec/macros/if.case

6x := -3{\mathrm{x}}\ {\leftarrow}\ {-3}x ← −3{\mathrm{x}}\ {\leftarrow}\ {-3}
7"x > 0" i_f< "1; -1"{\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}"x > 0" i‾f< "1; -1"{\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}
810 * "x > 0" i_f< "1; -1"{10}\ {\times}\ {\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}10 × "x > 0" i‾f< "1; -1"{10}\ {\times}\ {\text{"x > 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; -1"}}
9"x < 0" i_f< "0; 1 / 0"{\text{"x < 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"0; 1 / 0"}}"x < 0" i‾f< "0; 1 / 0"{\text{"x < 0"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"0; 1 / 0"}}

spec/macros/in-lambda.case

4u:f_ := { x -> "x = 0" u_nless< "p_rint! 1 / x"; x }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\text{"x = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 1 / x"}}{\diamond}\ {\mathrm{x}}\ {\}}uf‾ ← { x → "x = 0" u‾nless< "p_rint! 1 / x"⋄ x }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\text{"x = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 1 / x"}}{\diamond}\ {\mathrm{x}}\ {\}}
5u:f_ 2{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}uf‾ 2{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}
6u:f_ 0{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {0}uf‾ 0{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {0}

spec/macros/line.case

41 + 1{1}\ {+}\ {1}1 + 1{1}\ {+}\ {1}
5@ l_ine< @{@}\ {\mathrm{\underline{l}ine}{<}}\ {@}@ l‾ine< @{@}\ {\mathrm{\underline{l}ine}{<}}\ {@}

spec/macros/nested.case

4a := 1; b := 0{\mathrm{a}}\ {\leftarrow}\ {1}{\diamond}\ {\mathrm{b}}\ {\leftarrow}\ {0}a ← 1⋄ b ← 0{\mathrm{a}}\ {\leftarrow}\ {1}{\diamond}\ {\mathrm{b}}\ {\leftarrow}\ {0}
5"a b" e_ach< "\"$w = 0\" u_nless< \"p_rint! 10 / $w\""{\text{"a b"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"\textbackslash{}"\$w = 0\textbackslash{}" u\_nless< \textbackslash{}"p\_rint! 10 / \$w\textbackslash{}""}}"a b" e‾ach< "\"$w = 0\" u_nless< \"p_rint! 10 / $w\""{\text{"a b"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"\textbackslash{}"\$w = 0\textbackslash{}" u\_nless< \textbackslash{}"p\_rint! 10 / \$w\textbackslash{}""}}

spec/macros/panic-int.case

3u:s_ize := { k -> k > 3 ? @ p_anic< "bad grid size {k}"; k * 2 }{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {>}\ {3}\ {?}\ {@}\ {\mathrm{\underline{p}anic}{<}}\ {\text{"bad grid size \{k\}"}}{\diamond}\ {\mathrm{k}}\ {\times}\ {2}\ {\}}us‾ize ← { k → k > 3 ? @ p‾anic< "bad grid size {k}"⋄ k × 2 }{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {>}\ {3}\ {?}\ {@}\ {\mathrm{\underline{p}anic}{<}}\ {\text{"bad grid size \{k\}"}}{\diamond}\ {\mathrm{k}}\ {\times}\ {2}\ {\}}
4u:s_ize 2{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {2}us‾ize 2{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {2}
5u:s_ize 5{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {5}us‾ize 5{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {5}

spec/macros/panic.case

4u:s_ize := { k -> k > 3 ? @ p_anic< "bad grid size {k}"; k * 2 }{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {>}\ {3}\ {?}\ {@}\ {\mathrm{\underline{p}anic}{<}}\ {\text{"bad grid size \{k\}"}}{\diamond}\ {\mathrm{k}}\ {\times}\ {2}\ {\}}us‾ize ← { k → k > 3 ? @ p‾anic< "bad grid size {k}"⋄ k × 2 }{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {\mathrm{k}}\ {>}\ {3}\ {?}\ {@}\ {\mathrm{\underline{p}anic}{<}}\ {\text{"bad grid size \{k\}"}}{\diamond}\ {\mathrm{k}}\ {\times}\ {2}\ {\}}
5u:s_ize 2{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {2}us‾ize 2{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {2}
6c := "ok" c_at @ p_anic< "never here"{\mathrm{c}}\ {\leftarrow}\ {\text{"ok"}}\ {\mathrm{\underline{c}at}}\ {@}\ {\mathrm{\underline{p}anic}{<}}\ {\text{"never here"}}c ← "ok" c‾at @ p‾anic< "never here"{\mathrm{c}}\ {\leftarrow}\ {\text{"ok"}}\ {\mathrm{\underline{c}at}}\ {@}\ {\mathrm{\underline{p}anic}{<}}\ {\text{"never here"}}
7u:s_ize 5{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {5}us‾ize 5{{}^{\mathrm{u}}\mathrm{\underline{s}ize}}\ {5}

spec/macros/reject-assert-at.case

4@ a_ssert< "m"{@}\ {\mathrm{\underline{a}ssert}{<}}\ {\text{"m"}}@ a‾ssert< "m"{@}\ {\mathrm{\underline{a}ssert}{<}}\ {\text{"m"}}

spec/macros/reject-at-for-text.case

3@ i_f< "1; 2"{@}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; 2"}}@ i‾f< "1; 2"{@}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; 2"}}

spec/macros/reject-combinators-y-shape.case

4"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
5"u:f_" c:Y_< "{ s_elf -> 1 }"{\text{"u:f\_"}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}{<}}\ {\text{"\{ s\_elf -> 1 \}"}}"u:f_" cY‾< "{ s_elf -> 1 }"{\text{"u:f\_"}}\ {{}^{\mathrm{c}}\mathrm{\underline{Y}}{<}}\ {\text{"\{ s\_elf -> 1 \}"}}

spec/macros/reject-each-expression.case

31 + "a b" e_ach< "$w"{1}\ {+}\ {\text{"a b"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"\$w"}}1 + "a b" e‾ach< "$w"{1}\ {+}\ {\text{"a b"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"\$w"}}

spec/macros/reject-each-no-word.case

3"a b" e_ach< "u:x := 1"{\text{"a b"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"u:x := 1"}}"a b" e‾ach< "u:x := 1"{\text{"a b"}}\ {\mathrm{\underline{e}ach}{<}}\ {\text{"u:x := 1"}}

spec/macros/reject-format-empty.case

3@ f_ormat< "x = {}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x = \{\}"}}@ f‾ormat< "x = {}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x = \{\}"}}

spec/macros/reject-format-lone-brace.case

3@ f_ormat< "x } y"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x \} y"}}@ f‾ormat< "x } y"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x \} y"}}

spec/macros/reject-format-text-left.case

4"" f_ormat< "x"{\text{""}}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x"}}"" f‾ormat< "x"{\text{""}}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x"}}

spec/macros/reject-format-unclosed.case

3@ f_ormat< "x = {x"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x = \{x"}}@ f‾ormat< "x = {x"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"x = \{x"}}

spec/macros/reject-fresh-alias.case

3"g1:" u_se< "Stats"{\text{"g1:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"g1:" u‾se< "Stats"{\text{"g1:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}

spec/macros/reject-fresh-namespace.case

4g1:t := 2{{}^{\mathrm{g1}}\mathrm{t}}\ {\leftarrow}\ {2}g1t ← 2{{}^{\mathrm{g1}}\mathrm{t}}\ {\leftarrow}\ {2}

spec/macros/reject-hook-outside.case

4[]S_TATEMENT @{\square \mathrm{\underline{S}TATEMENT}}\ {@}□S‾TATEMENT @{\square \mathrm{\underline{S}TATEMENT}}\ {@}

spec/macros/reject-if-branches.case

3"1 = 1" i_f< "1; 2; 3"{\text{"1 = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; 2; 3"}}"1 = 1" i‾f< "1; 2; 3"{\text{"1 = 1"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; 2; 3"}}

spec/macros/reject-include-absolute.case

4@ i_nclude< "/etc/hosts"{@}\ {\mathrm{\underline{i}nclude}{<}}\ {\text{"/etc/hosts"}}@ i‾nclude< "/etc/hosts"{@}\ {\mathrm{\underline{i}nclude}{<}}\ {\text{"/etc/hosts"}}

spec/macros/reject-include-missing.case

3@ i_nclude< "no-such-file.txt"{@}\ {\mathrm{\underline{i}nclude}{<}}\ {\text{"no-such-file.txt"}}@ i‾nclude< "no-such-file.txt"{@}\ {\mathrm{\underline{i}nclude}{<}}\ {\text{"no-such-file.txt"}}

spec/macros/reject-macro-in-program.case

3u:f_< := { a b -> a }{{}^{\mathrm{u}}\mathrm{\underline{f}}{<}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\}}uf‾< ← { a b → a }{{}^{\mathrm{u}}\mathrm{\underline{f}}{<}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {\mathrm{a}}\ {\}}

spec/macros/reject-no-macro-library.case

4"a" y:u_nless< "b"{\text{"a"}}\ {{}^{\mathrm{y}}\mathrm{\underline{u}nless}{<}}\ {\text{"b"}}"a" yu‾nless< "b"{\text{"a"}}\ {{}^{\mathrm{y}}\mathrm{\underline{u}nless}{<}}\ {\text{"b"}}

spec/macros/reject-not-strings.case

3x := 1{\mathrm{x}}\ {\leftarrow}\ {1}x ← 1{\mathrm{x}}\ {\leftarrow}\ {1}
4x i_f< "1; 2"{\mathrm{x}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; 2"}}x i‾f< "1; 2"{\mathrm{x}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; 2"}}

spec/macros/reject-retry-text.case

4"1 d_iv 0" t_ry< "@ r_etry< \"e\""{\text{"1 d\_iv 0"}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ r\_etry< \textbackslash{}"e\textbackslash{}""}}"1 d_iv 0" t‾ry< "@ r_etry< \"e\""{\text{"1 d\_iv 0"}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ r\_etry< \textbackslash{}"e\textbackslash{}""}}

spec/macros/reject-s-is-not-system.case

4"s:" u_se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
5"a" s:i_f< "1; 2"{\text{"a"}}\ {{}^{\mathrm{s}}\mathrm{\underline{i}f}{<}}\ {\text{"1; 2"}}"a" si‾f< "1; 2"{\text{"a"}}\ {{}^{\mathrm{s}}\mathrm{\underline{i}f}{<}}\ {\text{"1; 2"}}

spec/macros/reject-strand.case

3"a" "x" i_f< "1; 2"{\text{"a"}}\ {\text{"x"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; 2"}}"a" "x" i‾f< "1; 2"{\text{"a"}}\ {\text{"x"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{"1; 2"}}

spec/macros/reject-text-for-at.case

4"" l_ine< @{\text{""}}\ {\mathrm{\underline{l}ine}{<}}\ {@}"" l‾ine< @{\text{""}}\ {\mathrm{\underline{l}ine}{<}}\ {@}

spec/macros/reject-try-at.case

4@ t_ry< "@ r_ecover< 0"{@}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ r\_ecover< 0"}}@ t‾ry< "@ r_ecover< 0"{@}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ r\_ecover< 0"}}

spec/macros/reject-unknown.case

4"a" x_yz< "b"{\text{"a"}}\ {\mathrm{\underline{x}yz}{<}}\ {\text{"b"}}"a" x‾yz< "b"{\text{"a"}}\ {\mathrm{\underline{x}yz}{<}}\ {\text{"b"}}

spec/macros/reject-user-not-exported.case

4"x:" u_se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"x:" u‾se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
5"a" x:n_ope< "b"{\text{"a"}}\ {{}^{\mathrm{x}}\mathrm{\underline{n}ope}{<}}\ {\text{"b"}}"a" xn‾ope< "b"{\text{"a"}}\ {{}^{\mathrm{x}}\mathrm{\underline{n}ope}{<}}\ {\text{"b"}}

spec/macros/retry-halt-continue.case

6n! := 0{\mathrm{n}!}\ {\leftarrow}\ {0}n! ← 0{\mathrm{n}!}\ {\leftarrow}\ {0}
7"10 + (0 []W_ARN \"empty\" \"nothing\")" t_ry< "@ c_ontinue< @"{\text{"10 + (0 []W\_ARN \textbackslash{}"empty\textbackslash{}" \textbackslash{}"nothing\textbackslash{}")"}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ c\_ontinue< @"}}"10 + (0 []W_ARN \"empty\" \"nothing\")" t‾ry< "@ c_ontinue< @"{\text{"10 + (0 []W\_ARN \textbackslash{}"empty\textbackslash{}" \textbackslash{}"nothing\textbackslash{}")"}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ c\_ontinue< @"}}
8"\"\\\"x\\\" []S_IGNAL \\\"y\\\"\" t_ry< \"n! := n! + 1; n! < 3 ? @ r_etry< @; @ h_alt< @\"" t_ry< "@ r_ecover< \"n!\""{\text{"\textbackslash{}"\textbackslash{}\textbackslash{}\textbackslash{}"x\textbackslash{}\textbackslash{}\textbackslash{}" []S\_IGNAL \textbackslash{}\textbackslash{}\textbackslash{}"y\textbackslash{}\textbackslash{}\textbackslash{}"\textbackslash{}" t\_ry< \textbackslash{}"n! := n! + 1; n! < 3 ? @ r\_etry< @; @ h\_alt< @\textbackslash{}""}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ r\_ecover< \textbackslash{}"n!\textbackslash{}""}}"\"\\\"x\\\" []S_IGNAL \\\"y\\\"\" t_ry< \"n! := n! + 1; n! < 3 ? @ r_etry< @; @ h_alt< @\"" t‾ry< "@ r_ecover< \"n!\""{\text{"\textbackslash{}"\textbackslash{}\textbackslash{}\textbackslash{}"x\textbackslash{}\textbackslash{}\textbackslash{}" []S\_IGNAL \textbackslash{}\textbackslash{}\textbackslash{}"y\textbackslash{}\textbackslash{}\textbackslash{}"\textbackslash{}" t\_ry< \textbackslash{}"n! := n! + 1; n! < 3 ? @ r\_etry< @; @ h\_alt< @\textbackslash{}""}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"@ r\_ecover< \textbackslash{}"n!\textbackslash{}""}}

spec/macros/s-alias.case

4"s:" u_se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
5s:m_ean 1 2 3{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}sm‾ean 1 2 3{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {1}\ {2}\ {3}

spec/macros/todo.case

4u:a_rea := { r -> r < 0 ? @ t_odo< "negative sizes"; r * r }{{}^{\mathrm{u}}\mathrm{\underline{a}rea}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {<}\ {0}\ {?}\ {@}\ {\mathrm{\underline{t}odo}{<}}\ {\text{"negative sizes"}}{\diamond}\ {\mathrm{r}}\ {\times}\ {\mathrm{r}}\ {\}}ua‾rea ← { r → r < 0 ? @ t‾odo< "negative sizes"⋄ r × r }{{}^{\mathrm{u}}\mathrm{\underline{a}rea}}\ {\leftarrow}\ {\{}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {<}\ {0}\ {?}\ {@}\ {\mathrm{\underline{t}odo}{<}}\ {\text{"negative sizes"}}{\diamond}\ {\mathrm{r}}\ {\times}\ {\mathrm{r}}\ {\}}
5u:a_rea 3{{}^{\mathrm{u}}\mathrm{\underline{a}rea}}\ {3}ua‾rea 3{{}^{\mathrm{u}}\mathrm{\underline{a}rea}}\ {3}
6u:a_rea -1{{}^{\mathrm{u}}\mathrm{\underline{a}rea}}\ {-1}ua‾rea −1{{}^{\mathrm{u}}\mathrm{\underline{a}rea}}\ {-1}

spec/macros/try.case

5"p_rint! 1; \"io\" []S_IGNAL \"gone\"" t_ry< "p_rint! []E_CODE e; @ r_ecover< \"0\""{\text{"p\_rint! 1; \textbackslash{}"io\textbackslash{}" []S\_IGNAL \textbackslash{}"gone\textbackslash{}""}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"p\_rint! []E\_CODE e; @ r\_ecover< \textbackslash{}"0\textbackslash{}""}}"p_rint! 1; \"io\" []S_IGNAL \"gone\"" t‾ry< "p_rint! []E_CODE e; @ r_ecover< \"0\""{\text{"p\_rint! 1; \textbackslash{}"io\textbackslash{}" []S\_IGNAL \textbackslash{}"gone\textbackslash{}""}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{"p\_rint! []E\_CODE e; @ r\_ecover< \textbackslash{}"0\textbackslash{}""}}

spec/macros/unless.case

4n := 4{\mathrm{n}}\ {\leftarrow}\ {4}n ← 4{\mathrm{n}}\ {\leftarrow}\ {4}
5"n = 0" u_nless< "p_rint! 100 / n"{\text{"n = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / n"}}"n = 0" u‾nless< "p_rint! 100 / n"{\text{"n = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / n"}}
6n := 0{\mathrm{n}}\ {\leftarrow}\ {0}n ← 0{\mathrm{n}}\ {\leftarrow}\ {0}
7"n = 0" u_nless< "p_rint! 100 / n"{\text{"n = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / n"}}"n = 0" u‾nless< "p_rint! 100 / n"{\text{"n = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / n"}}

spec/macros/user-in-expression.case

4"x:" u_se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"x:" u‾se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
5r := "4 = 2 + 2" x:c_heck< "addition"{\mathrm{r}}\ {\leftarrow}\ {\text{"4 = 2 + 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{c}heck}{<}}\ {\text{"addition"}}r ← "4 = 2 + 2" xc‾heck< "addition"{\mathrm{r}}\ {\leftarrow}\ {\text{"4 = 2 + 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{c}heck}{<}}\ {\text{"addition"}}
6r{\mathrm{r}}r{\mathrm{r}}

spec/macros/user-macros.case

6"x:" u_se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"x:" u‾se< "Macros"{\text{"x:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
7n := 4{\mathrm{n}}\ {\leftarrow}\ {4}n ← 4{\mathrm{n}}\ {\leftarrow}\ {4}
8"n != 0" x:w_hen< "p_rint! 100 / n"{\text{"n != 0"}}\ {{}^{\mathrm{x}}\mathrm{\underline{w}hen}{<}}\ {\text{"p\_rint! 100 / n"}}"n != 0" xw‾hen< "p_rint! 100 / n"{\text{"n != 0"}}\ {{}^{\mathrm{x}}\mathrm{\underline{w}hen}{<}}\ {\text{"p\_rint! 100 / n"}}
9"s_quare" x:d_ef< "_r * _r"{\text{"s\_quare"}}\ {{}^{\mathrm{x}}\mathrm{\underline{d}ef}{<}}\ {\text{"\_r * \_r"}}"s_quare" xd‾ef< "_r * _r"{\text{"s\_quare"}}\ {{}^{\mathrm{x}}\mathrm{\underline{d}ef}{<}}\ {\text{"\_r * \_r"}}
10u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}
11"4 = 2 + 2" x:c_heck< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{c}heck}{<}}\ {\text{"addition"}}"4 = 2 + 2" xc‾heck< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{c}heck}{<}}\ {\text{"addition"}}
12"5 = 2 * 2" x:c_heck< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{c}heck}{<}}\ {\text{"doubling"}}"5 = 2 * 2" xc‾heck< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{c}heck}{<}}\ {\text{"doubling"}}

spec/names/h-helpers-in-an-app.case

5h:h_alf := { _r / 2 }{{}^{\mathrm{h}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\div}\ {2}\ {\}}hh‾alf ← { _r ÷ 2 }{{}^{\mathrm{h}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\div}\ {2}\ {\}}
6h:limit := 8{{}^{\mathrm{h}}\mathrm{limit}}\ {\leftarrow}\ {8}hlimit ← 8{{}^{\mathrm{h}}\mathrm{limit}}\ {\leftarrow}\ {8}
7h:h_alf h:limit{{}^{\mathrm{h}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{h}}\mathrm{limit}}hh‾alf hlimit{{}^{\mathrm{h}}\mathrm{\underline{h}alf}}\ {{}^{\mathrm{h}}\mathrm{limit}}
8u:t_wice := { 2 * h:h_alf _r }{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\{}\ {2}\ {\times}\ {{}^{\mathrm{h}}\mathrm{\underline{h}alf}}\ {\_\mathrm{r}}\ {\}}ut‾wice ← { 2 × hh‾alf _r }{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\{}\ {2}\ {\times}\ {{}^{\mathrm{h}}\mathrm{\underline{h}alf}}\ {\_\mathrm{r}}\ {\}}
9u:t_wice 10{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {10}ut‾wice 10{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {10}

spec/names/reject-bare-function-in-app.case

4h_alf := { _r / 2 }{\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\div}\ {2}\ {\}}h‾alf ← { _r ÷ 2 }{\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\div}\ {2}\ {\}}

spec/names/reject-h-alias.case

4"h:" u_se< "Stats"{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"h:" u‾se< "Stats"{\text{"h:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}

spec/render/axes.case

3o_-_12 r__2{{\mathrm{\underline{o}}{-}}_{12}}\ {{\mathrm{\underline{r}}}_{2}}o‾−12 r‾2{{\mathrm{\underline{o}}{-}}_{12}}\ {{\mathrm{\underline{r}}}_{2}}

spec/render/comments.case

3x - -1 # a; b * c{\mathrm{x}}\ {-}\ {-1}x − −1{\mathrm{x}}\ {-}\ {-1}

spec/render/docs-input-table.case

3x r_ev r_/ o_-_12 u:s_quare c:K_ m:pi x^2 _r _l{\mathrm{x}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}}{/}}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {{}^{\mathrm{m}}\mathrm{pi}}\ {\mathrm{x}}^{2}\ {\_\mathrm{r}}\ {\_\mathrm{l}}x r‾ev r‾/ o‾−12 us‾quare cK‾ mpi x2 _r _l{\mathrm{x}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}}{/}}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {{}^{\mathrm{m}}\mathrm{pi}}\ {\mathrm{x}}^{2}\ {\_\mathrm{r}}\ {\_\mathrm{l}}

spec/render/exponents.case

4x^2 x^-1 2^10 x^0.5{\mathrm{x}}^{2}\ {\mathrm{x}}^{-1}\ {2}^{10}\ {\mathrm{x}}^{0.5}x2 x−1 210 x0.5{\mathrm{x}}^{2}\ {\mathrm{x}}^{-1}\ {2}^{10}\ {\mathrm{x}}^{0.5}

spec/render/lambda-args.case

5{ _r * _r }; { _l - _r }; { _r^2 }; { _l_ _r }{\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {\{}\ {\_\mathrm{r}}^{2}\ {\}}{\diamond}\ {\{}\ {\_\mathrm{l}\_}\ {\_\mathrm{r}}\ {\}}{ _r × _r }⋄ { _l − _r }⋄ { _r2 }⋄ { _l_ _r }{\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {\{}\ {\_\mathrm{r}}^{2}\ {\}}{\diamond}\ {\{}\ {\_\mathrm{l}\_}\ {\_\mathrm{r}}\ {\}}

spec/render/life.case

3u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}

spec/render/ligatures.case

3x := 3; { y -> y - 1 } a * b / c != d <= e >= f & g | h{\mathrm{x}}\ {\leftarrow}\ {3}{\diamond}\ {\{}\ {\mathrm{y}}\ {\to}\ {\mathrm{y}}\ {-}\ {1}\ {\}}\ {\mathrm{a}}\ {\times}\ {\mathrm{b}}\ {\div}\ {\mathrm{c}}\ {\neq}\ {\mathrm{d}}\ {\leq}\ {\mathrm{e}}\ {\geq}\ {\mathrm{f}}\ {\wedge}\ {\mathrm{g}}\ {\vee}\ {\mathrm{h}}x ← 3⋄ { y → y − 1 } a × b ÷ c ≠ d ≤ e ≥ f ∧ g ∨ h{\mathrm{x}}\ {\leftarrow}\ {3}{\diamond}\ {\{}\ {\mathrm{y}}\ {\to}\ {\mathrm{y}}\ {-}\ {1}\ {\}}\ {\mathrm{a}}\ {\times}\ {\mathrm{b}}\ {\div}\ {\mathrm{c}}\ {\neq}\ {\mathrm{d}}\ {\leq}\ {\mathrm{e}}\ {\geq}\ {\mathrm{f}}\ {\wedge}\ {\mathrm{g}}\ {\vee}\ {\mathrm{h}}

spec/render/namespaces.case

3u:s_quare c:K_ m:pi q:x{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {{}^{\mathrm{m}}\mathrm{pi}}\ {{}^{\mathrm{q}}\mathrm{x}}us‾quare cK‾ mpi qx{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {{}^{\mathrm{m}}\mathrm{pi}}\ {{}^{\mathrm{q}}\mathrm{x}}

spec/render/unchanged.case

3x count! + = < > ^ "a_b; *" @{\mathrm{x}}\ {\mathrm{count}!}\ {+}\ {=}\ {<}\ {>}\ {\mathbin{\hat{}}}\ {\text{"a\_b; *"}}\ {@}x count! + = < > ^ "a_b; *" @{\mathrm{x}}\ {\mathrm{count}!}\ {+}\ {=}\ {<}\ {>}\ {\mathbin{\hat{}}}\ {\text{"a\_b; *"}}\ {@}

spec/render/underline.case

3r_ev self_ u:s_quare{\mathrm{\underline{r}ev}}\ {\mathrm{sel\underline{f}}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}r‾ev self‾ us‾quare{\mathrm{\underline{r}ev}}\ {\mathrm{sel\underline{f}}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}

spec/syntax/apply-argument.case

3{ f_ x -> x f_ x }{\{}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}{ f‾ x → x f‾ x }{\{}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}

spec/syntax/apply-computed.case

3(s_wap '-)_ 3{(}{\mathrm{\underline{s}wap}}\ {\text{'}}{-}{)}{\_}\ {3}(s‾wap ’−)_ 3{(}{\mathrm{\underline{s}wap}}\ {\text{'}}{-}{)}{\_}\ {3}

spec/syntax/dyadic-left-is-one-value.case

3x f_ g_ y{\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{y}}x f‾ g‾ y{\mathrm{x}}\ {\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{y}}

spec/syntax/guards-multiline.case

3u:f_act := { n ->{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}uf‾act ← { n →{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\to}
4 n <= 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}  n ≤ 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}
5 n * u:f_act n - 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}  n × uf‾act n − 1\ \ {\mathrm{n}}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {\mathrm{n}}\ {-}\ {1}
6}{\}}}{\}}

spec/syntax/inner-two-operands.case

3A '+ '* i_nner B{\mathrm{A}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{B}}A ’+ ’× i‾nner B{\mathrm{A}}\ {\text{'}}{+}\ {\text{'}}{\times}\ {\mathrm{\underline{i}nner}}\ {\mathrm{B}}

spec/syntax/lambda-inline-dyadic.case

3S { (_l = 3) + _r } B{\mathrm{S}}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{B}}S { (_l = 3) + _r } B{\mathrm{S}}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{B}}

spec/syntax/lambda-innermost.case

3{ x -> { _r } x }{\{}\ {\mathrm{x}}\ {\to}\ {\{}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{x}}\ {\}}{ x → { _r } x }{\{}\ {\mathrm{x}}\ {\to}\ {\{}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{x}}\ {\}}

spec/syntax/lambda-lazy-guards.case

3{ ~s_elf n -> n <= 1 ? 1; n * s_elf n - 1 }{\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}{ ∼s‾elf n → n ≤ 1 ? 1⋄ n × s‾elf n − 1 }{\{}\ {\sim}{\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {\to}\ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}{\diamond}\ {\mathrm{n}}\ {\times}\ {\mathrm{\underline{s}elf}}\ {\mathrm{n}}\ {-}\ {1}\ {\}}

spec/syntax/lambda-left-right.case

3{ _l - _r }{\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{ _l − _r }{\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}

spec/syntax/lambda-niladic.case

3{ @ -> 42 }{\{}\ {@}\ {\to}\ {42}\ {\}}{ @ → 42 }{\{}\ {@}\ {\to}\ {42}\ {\}}

spec/syntax/lambda-right.case

3{ _r * _r }{\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}{ _r × _r }{\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}

spec/syntax/life.case

3u:l_ife := { ('+ r_/_12 -1 0 1 o_-_12 _r) { (_l = 3) + _r * _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}ul‾ife ← { (’+ r‾/12 −1 0 1 o‾−12 _r) { (_l = 3) + _r × _l = 4 } _r }{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\leftarrow}\ {\{}\ {(}{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {-1}\ {0}\ {1}\ {{\mathrm{\underline{o}}{-}}_{12}}\ {\_\mathrm{r}}{)}\ {\{}\ {(}{\_\mathrm{l}}\ {=}\ {3}{)}\ {+}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{l}}\ {=}\ {4}\ {\}}\ {\_\mathrm{r}}\ {\}}

spec/syntax/long-right-scope.case

3f_ g_ x{\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}f‾ g‾ x{\mathrm{\underline{f}}}\ {\mathrm{\underline{g}}}\ {\mathrm{x}}

spec/syntax/mutable-binding.case

3count! := count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}count! ← count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}

spec/syntax/newline-in-parens.case

3(1 +{(}{1}\ {+}(1 +{(}{1}\ {+}
4 2)\ {2}{)} 2)\ {2}{)}

spec/syntax/paren-exponent.case

3(1 2 3)^2{(}{1}\ {2}\ {3}{)}^{2}(1 2 3)2{(}{1}\ {2}\ {3}{)}^{2}

spec/syntax/power-quoted.case

3'n_eg^2 e_ach 1 2{\text{'}}{\mathrm{\underline{n}eg}}^{2}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}’n‾eg2 e‾ach 1 2{\text{'}}{\mathrm{\underline{n}eg}}^{2}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}

spec/syntax/power-spaced.case

3x ^ n + 1{\mathrm{x}}\ {\mathbin{\hat{}}}\ {\mathrm{n}}\ {+}\ {1}x ^ n + 1{\mathrm{x}}\ {\mathbin{\hat{}}}\ {\mathrm{n}}\ {+}\ {1}

spec/syntax/power.case

4n_eg^3 5{\mathrm{\underline{n}eg}}^{3}\ {5}n‾eg3 5{\mathrm{\underline{n}eg}}^{3}\ {5}

spec/syntax/quote-operand.case

3'+ r_/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’+ r‾/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}

spec/syntax/quote-value.case

3r_/ '+{\mathrm{\underline{r}}{/}}\ {\text{'}}{+}r‾/ ’+{\mathrm{\underline{r}}{/}}\ {\text{'}}{+}

spec/syntax/quoted-lambda-operand.case

3'{ x -> x * 2 } e_ach v{\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\times}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{v}}’{ x → x × 2 } e‾ach v{\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\times}\ {2}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{v}}

spec/syntax/reject-unit-parameter-value.case

3u:f_ := { @ r -> r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {@}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {+}\ {1}\ {\}}uf‾ ← { @ r → r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {@}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {+}\ {1}\ {\}}
41 u:f_ 2{1}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}1 uf‾ 2{1}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}

spec/syntax/right-to-left.case

3a f_ b g_ c{\mathrm{a}}\ {\mathrm{\underline{f}}}\ {\mathrm{b}}\ {\mathrm{\underline{g}}}\ {\mathrm{c}}a f‾ b g‾ c{\mathrm{a}}\ {\mathrm{\underline{f}}}\ {\mathrm{b}}\ {\mathrm{\underline{g}}}\ {\mathrm{c}}

spec/syntax/square.case

3u:s_quare := { _r * _r }; u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare ← { _r × _r }⋄ us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}

spec/syntax/statements.case

3x := 3; y := x + 1{\mathrm{x}}\ {\leftarrow}\ {3}{\diamond}\ {\mathrm{y}}\ {\leftarrow}\ {\mathrm{x}}\ {+}\ {1}x ← 3⋄ y ← x + 1{\mathrm{x}}\ {\leftarrow}\ {3}{\diamond}\ {\mathrm{y}}\ {\leftarrow}\ {\mathrm{x}}\ {+}\ {1}
4x + y{\mathrm{x}}\ {+}\ {\mathrm{y}}x + y{\mathrm{x}}\ {+}\ {\mathrm{y}}

spec/syntax/strand-exponent.case

31 2 3^2{1}\ {2}\ {3}^{2}1 2 32{1}\ {2}\ {3}^{2}

spec/syntax/strand-strings.case

5"ab" "cde"{\text{"ab"}}\ {\text{"cde"}}"ab" "cde"{\text{"ab"}}\ {\text{"cde"}}

spec/syntax/sub.case

3u:s_ub := { _l - _r }; 10 u:s_ub 3{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}us‾ub ← { _l − _r }⋄ 10 us‾ub 3{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}

spec/syntax/system-name.case

4"hi" []N_PUT "work/spec-system-name.txt"{\text{"hi"}}\ {\square \mathrm{\underline{N}PUT}}\ {\text{"work/spec-system-name.txt"}}"hi" □N‾PUT "work/spec-system-name.txt"{\text{"hi"}}\ {\square \mathrm{\underline{N}PUT}}\ {\text{"work/spec-system-name.txt"}}

spec/syntax/table-operand.case

3A '* t_able B{\mathrm{A}}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{B}}A ’× t‾able B{\mathrm{A}}\ {\text{'}}{\times}\ {\mathrm{\underline{t}able}}\ {\mathrm{B}}

spec/syntax/train-atop.case

3[n_eg a_bs] x{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {\mathrm{x}}[n‾eg a‾bs] x{[}{\mathrm{\underline{n}eg}}\ {\mathrm{\underline{a}bs}}{]}\ {\mathrm{x}}

spec/syntax/train-fork.case

3['+ r_/ / t_ally]{[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}[’+ r‾/ ÷ t‾ally]{[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\div}\ {\mathrm{\underline{t}ally}}{]}

spec/syntax/train-long.case

3[a_ b_ c_ d_ e_]{[}{\mathrm{\underline{a}}}\ {\mathrm{\underline{b}}}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{d}}}\ {\mathrm{\underline{e}}}{]}[a‾ b‾ c‾ d‾ e‾]{[}{\mathrm{\underline{a}}}\ {\mathrm{\underline{b}}}\ {\mathrm{\underline{c}}}\ {\mathrm{\underline{d}}}\ {\mathrm{\underline{e}}}{]}

spec/syntax/unit-parameter-normal.case

4{ @ r -> r }{\{}\ {@}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {\}}{ @ r → r }{\{}\ {@}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {\}}
5{ @ -> { r -> r } }{\{}\ {@}\ {\to}\ {\{}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {\}}\ {\}}{ @ → { r → r } }{\{}\ {@}\ {\to}\ {\{}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {\}}\ {\}}

spec/syntax/unit-parameter.case

5u:f_ := { @ r -> r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {@}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {+}\ {1}\ {\}}uf‾ ← { @ r → r + 1 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {@}\ {\mathrm{r}}\ {\to}\ {\mathrm{r}}\ {+}\ {1}\ {\}}
6@ u:f_ 2{@}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}@ uf‾ 2{@}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}

Literate documents · Live demo · Repository