X_eTaL in LaTeX

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

demos/apply.xtl · 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/dyadic.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/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/literate/tuples.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/errors/explain-binding.case · spec/errors/explain-literal.case · spec/errors/explain-parameter.case · spec/errors/explain-string.case · spec/errors/hint-condition.case · spec/errors/hint-disclose.case · spec/errors/hint-enclose.case · spec/errors/hint-float.case · spec/errors/hint-floor.case · spec/errors/hint-function-waiting.case · spec/errors/hint-too-many.case · spec/eval/add.case · spec/eval/amend.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/comparison-result-defaults.case · spec/eval/compose.case · spec/eval/condition-in-box.case · spec/eval/decode-any.case · spec/eval/discard.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/libm.case · spec/eval/literal-is-polymorphic.case · spec/eval/local-poly-literal.case · spec/eval/map.case · spec/eval/match.case · spec/eval/mix.case · spec/eval/multi-axis-polymorphic.case · spec/eval/multi-axis.case · spec/eval/mutable-number-in-function.case · spec/eval/mutation.case · spec/eval/mutual-recursion.case · spec/eval/n-wise.case · spec/eval/nested-equal.case · spec/eval/nested.case · spec/eval/never-stops.case · spec/eval/never.case · spec/eval/number-grid.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-bool-count.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/rank.case · spec/eval/rebind-mutable-parameter.case · spec/eval/reduce-empty.case · spec/eval/reduce.case · spec/eval/reject-amend-count.case · spec/eval/reject-amend-index.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-erase-in-file.case · spec/eval/reject-erase-not-literal.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-libm-domain-log1p.case · spec/eval/reject-libm-domain.case · spec/eval/reject-match-types.case · spec/eval/reject-mix-unboxed.case · spec/eval/reject-mutable-type-change.case · spec/eval/reject-n-wise-length.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-number-grid-chars.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-rank-count.case · spec/eval/reject-read-discard.case · spec/eval/reject-rebind-helper.case · spec/eval/reject-rebind-in-lambda.case · spec/eval/reject-rebind-parameter.case · spec/eval/reject-rebind.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-scale-range.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/require-shape-extents.case · spec/eval/require-shape-mismatch.case · spec/eval/require-shape.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/shadow-in-nested-scope.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/train-fork-of-forks.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/unused-param.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/code-strings.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/label.case · spec/lex/lambda-args.case · spec/lex/life.case · spec/lex/long-prefixes.case · spec/lex/negative-literals.case · spec/lex/pipe.case · spec/lex/power-spaced.case · spec/lex/quotes.case · spec/lex/raw-string-lines.case · spec/lex/raw-strings.case · spec/lex/reject-code-inside-char.case · spec/lex/reject-code-inside-string.case · spec/lex/square.case · spec/lex/strings.case · spec/lex/subtraction.case · spec/lex/symbols.case · spec/lex/trailing-marks.case · spec/lex/unused-param.case · spec/lex/variables.case · spec/macros/argument-error-located.case · spec/macros/assert-fails.case · spec/macros/assert.case · spec/macros/catch-halts.case · spec/macros/catch.case · spec/macros/cfg.case · spec/macros/check.case · spec/macros/code-body.case · spec/macros/code-on-text-side-lexes.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-markup.case · spec/macros/format.case · spec/macros/gensym-opt-in.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-check-at.case · spec/macros/reject-code-on-text-side.case · spec/macros/reject-code-pipe.case · spec/macros/reject-code-unclosed.case · spec/macros/reject-combinators-y-shape.case · spec/macros/reject-contract-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-gensym-outside.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-shadow-anaphor.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/unreachable-bare.case · spec/macros/unreachable-reached.case · spec/macros/unreachable.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/doc-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/render/unused-param.case · spec/spatial/macro-name-needs-underline.case · spec/spatial/reject-bracket-index.case · spec/spatial/reject-call-as-macro-argument.case · spec/spatial/reject-name-minus-one.case · spec/spatial/reject-plus-slash.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-label-in-code.case · spec/syntax/reject-pipe-in-code.case · spec/syntax/reject-unit-parameter-value.case · spec/syntax/reject-unused-read.case · spec/syntax/reject-unused-shorthand.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 · spec/syntax/unused-param.case · spec/tuples/any-types.case · spec/tuples/boxed-match.case · spec/tuples/boxed-print.case · spec/tuples/boxed-tall.case · spec/tuples/boxed.case · spec/tuples/condition-in-nested-tuple.case · spec/tuples/condition-in-tuple-guard.case · spec/tuples/condition-in-tuple.case · spec/tuples/eq-with-arrays.case · spec/tuples/lambda-body-tuple.case · spec/tuples/literal-arrays.case · spec/tuples/literal-grouping.case · spec/tuples/literal-pair.case · spec/tuples/match-shape.case · spec/tuples/match.case · spec/tuples/pattern-binding.case · spec/tuples/pattern-core-spacing.case · spec/tuples/pattern-core.case · spec/tuples/pattern-dyadic.case · spec/tuples/pattern-local.case · spec/tuples/pattern-nested.case · spec/tuples/pattern-parameter-core.case · spec/tuples/pattern-parameter.case · spec/tuples/pattern-wildcard.case · spec/tuples/plumbing.case · spec/tuples/power-m13.case · spec/tuples/power-state.case · spec/tuples/print-tall-last.case · spec/tuples/print-tall.case · spec/tuples/reject-arithmetic.case · spec/tuples/reject-array-builtin.case · spec/tuples/reject-boxed-equals.case · spec/tuples/reject-comma-outside.case · spec/tuples/reject-disclose-many.case · spec/tuples/reject-each-tuple.case · spec/tuples/reject-equals.case · spec/tuples/reject-pattern-literal.case · spec/tuples/reject-pattern-not-tuple.case · spec/tuples/reject-pattern-one-part.case · spec/tuples/reject-pattern-size.case · spec/tuples/reject-pattern-twice-params.case · spec/tuples/reject-pattern-twice.case · spec/tuples/reject-reshape-tuple.case · spec/tuples/reject-trailing-comma.case · spec/tuples/reject-tuple-items.case · spec/tuples/reject-tuple-strand.case · spec/tuples/reject-underscore-outside.case · spec/tuples/reject-wild-parameter.case

demos/apply.xtl

12u:f_ := { a b c d -> a + (10 * b) + (100 * c) + 1000 * d }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\mathrm{d}}\ {\to}\ {\mathrm{a}}\ {+}\ {(}{10}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {(}{100}\ {\times}\ {\mathrm{c}}{)}\ {+}\ {1000}\ {\times}\ {\mathrm{d}}\ {\}}uf‾ ← { a b c d → a + (10 × b) + (100 × c) + 1000 × d }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\mathrm{c}}\ {\mathrm{d}}\ {\to}\ {\mathrm{a}}\ {+}\ {(}{10}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {(}{100}\ {\times}\ {\mathrm{c}}{)}\ {+}\ {1000}\ {\times}\ {\mathrm{d}}\ {\}}
15((1 u:f_ 2)_ 3)_ 4{\underline{(}}{\underline{(}}{1}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}(‾(‾1 uf‾ 2)‾ 3)‾ 4{\underline{(}}{\underline{(}}{1}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}
20"ap:" u_se< "Apply"{\text{"ap:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Apply"}}"ap:" u‾se< "Apply"{\text{"ap:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Apply"}}
21c"u:f_" ap:a_pply< c"1; 2; 3; 4"{\text{c"}}{{}^{\mathrm{u}}\mathrm{\underline{f}}}{\text{"}}\ {{}^{\mathrm{ap}}\mathrm{\underline{a}pply}{<}}\ {\text{c"}}{1}{\diamond}\ {2}{\diamond}\ {3}{\diamond}\ {4}{\text{"}}c"uf‾" apa‾pply< c"1⋄ 2⋄ 3⋄ 4"{\text{c"}}{{}^{\mathrm{u}}\mathrm{\underline{f}}}{\text{"}}\ {{}^{\mathrm{ap}}\mathrm{\underline{a}pply}{<}}\ {\text{c"}}{1}{\diamond}\ {2}{\diamond}\ {3}{\diamond}\ {4}{\text{"}}
22c"u:f_" ap:a_pply< c"2 - 1; 2; 3; 4" # any expression is an argument{\text{c"}}{{}^{\mathrm{u}}\mathrm{\underline{f}}}{\text{"}}\ {{}^{\mathrm{ap}}\mathrm{\underline{a}pply}{<}}\ {\text{c"}}{2}\ {-}\ {1}{\diamond}\ {2}{\diamond}\ {3}{\diamond}\ {4}{\text{"}}c"uf‾" apa‾pply< c"2 − 1⋄ 2⋄ 3⋄ 4"{\text{c"}}{{}^{\mathrm{u}}\mathrm{\underline{f}}}{\text{"}}\ {{}^{\mathrm{ap}}\mathrm{\underline{a}pply}{<}}\ {\text{c"}}{2}\ {-}\ {1}{\diamond}\ {2}{\diamond}\ {3}{\diamond}\ {4}{\text{"}}
26u:g_ := { (a, b, c, d) -> a + (10 * b) + (100 * c) + 1000 * d }{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{,}\ {\mathrm{c}}{,}\ {\mathrm{d}}{)}\ {\to}\ {\mathrm{a}}\ {+}\ {(}{10}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {(}{100}\ {\times}\ {\mathrm{c}}{)}\ {+}\ {1000}\ {\times}\ {\mathrm{d}}\ {\}}ug‾ ← { (a, b, c, d) → a + (10 × b) + (100 × c) + 1000 × d }{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{,}\ {\mathrm{c}}{,}\ {\mathrm{d}}{)}\ {\to}\ {\mathrm{a}}\ {+}\ {(}{10}\ {\times}\ {\mathrm{b}}{)}\ {+}\ {(}{100}\ {\times}\ {\mathrm{c}}{)}\ {+}\ {1000}\ {\times}\ {\mathrm{d}}\ {\}}
27u:g_ (1, 2, 3, 4){{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {(}{1}{,}\ {2}{,}\ {3}{,}\ {4}{)}ug‾ (1, 2, 3, 4){{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {(}{1}{,}\ {2}{,}\ {3}{,}\ {4}{)}
32u:f_irstThree := (1 u:f_ 2)_ 3{{}^{\mathrm{u}}\mathrm{\underline{f}irstThree}}\ {\leftarrow}\ {\underline{(}}{1}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}{\underline{)}}\ {3}uf‾irstThree ← (‾1 uf‾ 2)‾ 3{{}^{\mathrm{u}}\mathrm{\underline{f}irstThree}}\ {\leftarrow}\ {\underline{(}}{1}\ {{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}{\underline{)}}\ {3}
33u:f_irstThree 4{{}^{\mathrm{u}}\mathrm{\underline{f}irstThree}}\ {4}uf‾irstThree 4{{}^{\mathrm{u}}\mathrm{\underline{f}irstThree}}\ {4}

demos/arrays.xtl

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}
16m{\mathrm{m}}m{\mathrm{m}}
17s_hape m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}s‾hape m{\mathrm{\underline{s}hape}}\ {\mathrm{m}}
182 s_elect m{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}2 s‾elect m{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{m}}
19-1 t_ake m{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{m}}−1 t‾ake m{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{m}}
20m * 10{\mathrm{m}}\ {\times}\ {10}m × 10{\mathrm{m}}\ {\times}\ {10}
21(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}
2210 ^ 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

13u: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}}}\ {\}}
15u: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}}}\ {\}}
17u: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}}{)}\ {\}}
19u: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}}}{)}\ {\}}
24u: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}}\ {\}}
25('u:I_ u:M_)_ 42{\underline{(}}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {{}^{\mathrm{u}}\mathrm{\underline{M}}}{\underline{)}}\ {42}(‾’uI‾ uM‾)‾ 42{\underline{(}}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {{}^{\mathrm{u}}\mathrm{\underline{M}}}{\underline{)}}\ {42}
30u: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}}}\ {\}}\ {\}}
33u: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}\ {\}}
34(u:Y_ 'u:F_)_ 5{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {5}(‾uY‾ ’uF‾)‾ 5{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {5}
38u: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}}\ {\}}\ {\}}\ {\}}
41u: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}\ {\}}
42(u:Z_ 'u:G_)_ 6{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Z}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{G}}}{\underline{)}}\ {6}(‾uZ‾ ’uG‾)‾ 6{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Z}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{G}}}{\underline{)}}\ {6}
45('u:U_ u:U_ 'u:F_)_ 4{\underline{(}}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {4}(‾’uU‾ uU‾ ’uF‾)‾ 4{\underline{(}}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {{}^{\mathrm{u}}\mathrm{\underline{U}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {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}}
16_ := []S_HOW []G_RID frames{\_}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{frames}}_ ← □S‾HOW □G‾RID frames{\_}\ {\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}}
26_ := []S_HOW []G_RID swim{\_}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{swim}}_ ← □S‾HOW □G‾RID swim{\_}\ {\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}}\ {\}}
30u: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}
31 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}}
32 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}}
33 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}}
34 s_tep := { (zr, zi, count) ->\ \ {\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{zr}}{,}\ {\mathrm{zi}}{,}\ {\mathrm{count}}{)}\ {\to}  s‾tep ← { (zr, zi, count) →\ \ {\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{zr}}{,}\ {\mathrm{zi}}{,}\ {\mathrm{count}}{)}\ {\to}
35 inside := 4 >= (zr * zr) + zi * zi\ \ \ \ {\mathrm{inside}}\ {\leftarrow}\ {4}\ {\geq}\ {(}{\mathrm{zr}}\ {\times}\ {\mathrm{zr}}{)}\ {+}\ {\mathrm{zi}}\ {\times}\ {\mathrm{zi}}    inside ← 4 ≥ (zr × zr) + zi × zi\ \ \ \ {\mathrm{inside}}\ {\leftarrow}\ {4}\ {\geq}\ {(}{\mathrm{zr}}\ {\times}\ {\mathrm{zr}}{)}\ {+}\ {\mathrm{zi}}\ {\times}\ {\mathrm{zi}}
36 keep := f_loat inside\ \ \ \ {\mathrm{keep}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {\mathrm{inside}}    keep ← f‾loat inside\ \ \ \ {\mathrm{keep}}\ {\leftarrow}\ {\mathrm{\underline{f}loat}}\ {\mathrm{inside}}
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 (a, b, count + inside)\ \ \ \ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{,}\ {\mathrm{count}}\ {+}\ {\mathrm{inside}}{)}    (a, b, count + inside)\ \ \ \ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{,}\ {\mathrm{count}}\ {+}\ {\mathrm{inside}}{)}
40 }\ \ {\}}  }\ \ {\}}
41 plane := (2 t_ake size) r_eshape 0.0\ \ {\mathrm{plane}}\ {\leftarrow}\ {(}{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{r}eshape}}\ {0.0}  plane ← (2 t‾ake size) r‾eshape 0.0\ \ {\mathrm{plane}}\ {\leftarrow}\ {(}{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{r}eshape}}\ {0.0}
42 (_, _, c) := n 's_tep p_ower (plane, plane, (2 t_ake size) r_eshape 0)\ \ {(}{\_}{,}\ {\_}{,}\ {\mathrm{c}}{)}\ {\leftarrow}\ {\mathrm{n}}\ {\text{'}}{\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{\mathrm{plane}}{,}\ {\mathrm{plane}}{,}\ {(}{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{r}eshape}}\ {0}{)}  (_, _, c) ← n ’s‾tep p‾ower (plane, plane, (2 t‾ake size) r‾eshape 0)\ \ {(}{\_}{,}\ {\_}{,}\ {\mathrm{c}}{)}\ {\leftarrow}\ {\mathrm{n}}\ {\text{'}}{\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{\mathrm{plane}}{,}\ {\mathrm{plane}}{,}\ {(}{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{size}}{)}\ {\mathrm{\underline{r}eshape}}\ {0}{)}
43 c * c < n\ \ {\mathrm{c}}\ {\times}\ {\mathrm{c}}\ {<}\ {\mathrm{n}}  c × c < n\ \ {\mathrm{c}}\ {\times}\ {\mathrm{c}}\ {<}\ {\mathrm{n}}
44}{\}}}{\}}
47still := []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}
52u: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}
53 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}}
54 t := 1 - shrink\ \ {\mathrm{t}}\ {\leftarrow}\ {1}\ {-}\ {\mathrm{shrink}}  t ← 1 − shrink\ \ {\mathrm{t}}\ {\leftarrow}\ {1}\ {-}\ {\mathrm{shrink}}
55 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}}
56 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}}
57}{\}}}{\}}
58u: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}}\ {\}}
59zoom := []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}
64u: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}\ {\}}
65u: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}}\ {\}}
66flyover := []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

9u: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}
10 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}}
11 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}}
12 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}}
13}{\}}}{\}}
16u:p_aint := { c t -> 1 = 4 s_elect []T_E @ ? ([]C_OLOR c) []F_G t; t }{{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{t}}\ {\to}\ {1}\ {=}\ {4}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{\underline{T}E}}\ {@}\ {?}\ {(}{\square \mathrm{\underline{C}OLOR}}\ {\mathrm{c}}{)}\ {\square \mathrm{\underline{F}G}}\ {\mathrm{t}}{\diamond}\ {\mathrm{t}}\ {\}}up‾aint ← { c t → 1 = 4 s‾elect □T‾E @ ? (□C‾OLOR c) □F‾G t⋄ t }{{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{t}}\ {\to}\ {1}\ {=}\ {4}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{\underline{T}E}}\ {@}\ {?}\ {(}{\square \mathrm{\underline{C}OLOR}}\ {\mathrm{c}}{)}\ {\square \mathrm{\underline{F}G}}\ {\mathrm{t}}{\diamond}\ {\mathrm{t}}\ {\}}
17u: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}
18 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"}}
19 (2 u:p_aint (1 t_ake r) r_eshape "*") c_at 8 u:p_aint (-1 t_ake r) r_eshape "o"\ \ {(}{2}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {(}{1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{"*"}}{)}\ {\mathrm{\underline{c}at}}\ {8}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {(}{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{"o"}}  (2 up‾aint (1 t‾ake r) r‾eshape "*") c‾at 8 up‾aint (−1 t‾ake r) r‾eshape "o"\ \ {(}{2}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {(}{1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{"*"}}{)}\ {\mathrm{\underline{c}at}}\ {8}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {(}{-1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {\text{"o"}}
20}{\}}}{\}}
21secret := 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}
24u: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}
25 _ := p_rint! @ f_ormat< "guess {n} (four digits, 1 to 6):"\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"guess \{n\} (four digits, 1 to 6):"}}  _ ← p‾rint! @ f‾ormat< "guess {n} (four digits, 1 to 6):"\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"guess \{n\} (four digits, 1 to 6):"}}
26 t := []R_EAD @\ \ {\mathrm{t}}\ {\leftarrow}\ {\square \mathrm{\underline{R}EAD}}\ {@}  t ← □R‾EAD @\ \ {\mathrm{t}}\ {\leftarrow}\ {\square \mathrm{\underline{R}EAD}}\ {@}
27 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}}
28 (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}}
29}{\}}}{\}}
32u: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}
33 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}}
34 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}}
35 _ := p_rint! @ f_ormat< "{g} {u:p_egs r}"\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"\{g\} \{u:p\_egs r\}"}}  _ ← p‾rint! @ f‾ormat< "{g} {u:p_egs r}"\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"\{g\} \{u:p\_egs r\}"}}
36 4 = f_irst r ? 3 u:p_aint @ f_ormat< "solved in {n}"\ \ {4}\ {=}\ {\mathrm{\underline{f}irst}}\ {\mathrm{r}}\ {?}\ {3}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"solved in \{n\}"}}  4 = f‾irst r ? 3 up‾aint @ f‾ormat< "solved in {n}"\ \ {4}\ {=}\ {\mathrm{\underline{f}irst}}\ {\mathrm{r}}\ {?}\ {3}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"solved in \{n\}"}}
37 n = 10 ? 2 u:p_aint @ f_ormat< "out of guesses: it was {secret}"\ \ {\mathrm{n}}\ {=}\ {10}\ {?}\ {2}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"out of guesses: it was \{secret\}"}}  n = 10 ? 2 up‾aint @ f‾ormat< "out of guesses: it was {secret}"\ \ {\mathrm{n}}\ {=}\ {10}\ {?}\ {2}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"out of guesses: it was \{secret\}"}}
38 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}
39}{\}}}{\}}
40u: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 -> _ := p_rint! text; st }{{}^{\mathrm{u}}\mathrm{\underline{s}ay}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{text}}\ {\to}\ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{text}}{\diamond}\ {\mathrm{st}}\ {\}}us‾ay! ← { st text → _ ← p‾rint! text⋄ st }{{}^{\mathrm{u}}\mathrm{\underline{s}ay}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{st}}\ {\mathrm{text}}\ {\to}\ {\_}\ {\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 _ := p_rint! " " c_at line\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {\mathrm{line}}  _ ← p‾rint! " " c‾at line\ \ {\_}\ {\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 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{\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 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{\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

12"c:" u_se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}"c:" u‾se< "Combinators"{\text{"c:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Combinators"}}
18u: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}\ {\}}
21u: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}\ {\}}
261 c:K_ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}1 cK‾ 2{1}\ {{}^{\mathrm{c}}\mathrm{\underline{K}}}\ {2}
3010 '- c:C_ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}10 ’− cC‾ 3{10}\ {\text{'}}{-}\ {{}^{\mathrm{c}}\mathrm{\underline{C}}}\ {3}
33'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}
36'* c:W_ 4{\text{'}}{\times}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {4}’× cW‾ 4{\text{'}}{\times}\ {{}^{\mathrm{c}}\mathrm{\underline{W}}}\ {4}
39'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}
43'u:d_ouble 'u:i_nc '+ c:P_hi 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\text{'}}{+}\ {{}^{\mathrm{c}}\mathrm{\underline{P}hi}}\ {3}’ud‾ouble ’ui‾nc ’+ cP‾hi 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {\text{'}}{+}\ {{}^{\mathrm{c}}\mathrm{\underline{P}hi}}\ {3}
473 'u:d_ouble '+ c:P_si 4{3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{+}\ {{}^{\mathrm{c}}\mathrm{\underline{P}si}}\ {4}3 ’ud‾ouble ’+ cP‾si 4{3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}\ {\text{'}}{+}\ {{}^{\mathrm{c}}\mathrm{\underline{P}si}}\ {4}
503 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}}
53(3 c:V_ 4)_ '+{\underline{(}}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{\underline{)}}\ {\text{'}}{+}(‾3 cV‾ 4)‾ ’+{\underline{(}}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{\underline{)}}\ {\text{'}}{+}
54(3 c:V_ 4)_ '*{\underline{(}}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{\underline{)}}\ {\text{'}}{\times}(‾3 cV‾ 4)‾ ’×{\underline{(}}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{\underline{)}}\ {\text{'}}{\times}
61u: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}\ {\}}
62'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}
65u:d_ouble^10 1{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{10}\ {1}ud‾ouble10 1{{}^{\mathrm{u}}\mathrm{\underline{d}ouble}}^{10}\ {1}

demos/dyadic.xtl

7u: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}}\ {\}}
810 u:s_ub 3{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}10 us‾ub 3{10}\ {{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {3}
10u: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}
11u:t_enMinus 3{{}^{\mathrm{u}}\mathrm{\underline{t}enMinus}}\ {3}ut‾enMinus 3{{}^{\mathrm{u}}\mathrm{\underline{t}enMinus}}\ {3}

demos/factorial.xtl

9u: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}
10 n <= 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}  n ≤ 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}
11 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}
12}{\}}}{\}}
13u:f_act 10{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}uf‾act 10{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}

demos/fixed-point.xtl

9u: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}}}\ {\}}\ {\}}
12u: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}\ {\}}
13(u:Y_ 'u:F_)_ 5{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {5}(‾uY‾ ’uF‾)‾ 5{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {5}

demos/hello-library.xtl

13"hi:" u_se< "Hello"{\text{"hi:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}"hi:" u‾se< "Hello"{\text{"hi:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}
14"g:" u_se< "Greetings"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Greetings"}}"g:" u‾se< "Greetings"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Greetings"}}
20hi:h_ello @{{}^{\mathrm{hi}}\mathrm{\underline{h}ello}}\ {@}hih‾ello @{{}^{\mathrm{hi}}\mathrm{\underline{h}ello}}\ {@}
23g:g_reet "hi"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"hi"}}gg‾reet "hi"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"hi"}}
24g: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

12v := 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}
13'+ r_/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’+ r‾/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
14'- r_/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’− r‾/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
15'+ s_\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}’+ s‾\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}
20m := 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}
21'+ r_/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
221 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}
23m '+ '* 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}
28u: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}\ {\}}
29'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}
301 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}
31'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}
322 '/ s_wap 1{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}2 ’÷ s‾wap 1{2}\ {\text{'}}{\div}\ {\mathrm{\underline{s}wap}}\ {1}
36s_ort v{\mathrm{\underline{s}ort}}\ {\mathrm{v}}s‾ort v{\mathrm{\underline{s}ort}}\ {\mathrm{v}}
37g_rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}g‾rade v{\mathrm{\underline{g}rade}}\ {\mathrm{v}}
38u_nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}u‾nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}
39v 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}
40w_here v > 2{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {2}w‾here v > 2{\mathrm{\underline{w}here}}\ {\mathrm{v}}\ {>}\ {2}

demos/keys.xtl

13x := 5 # typed: x := 5{\mathrm{x}}\ {\leftarrow}\ {5}x ← 5{\mathrm{x}}\ {\leftarrow}\ {5}
17count! := 0 # typed: count! := 0{\mathrm{count}!}\ {\leftarrow}\ {0}count! ← 0{\mathrm{count}!}\ {\leftarrow}\ {0}
18count! := count! + 1 # typed: count! := count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}count! ← count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}
22r_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}
27u: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}}\ {\}}
28u: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}
34M := 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}
39'+ r_/ M # typed: '+ r_/ M{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{M}}’+ r‾/ M{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{M}}
43'+ r_/_1 M # typed: '+ r_/_1 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{M}}’+ r‾/1 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{M}}
46'+ r_/_2 M # typed: '+ r_/_2 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}’+ r‾/2 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}
50'+ r_/_12 M # typed: '+ r_/_12 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{M}}’+ r‾/12 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{M}}
53'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}}
57'+ s_\ M # typed: '+ s_\ M{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{M}}’+ s‾\ M{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{M}}
60'+ 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}}
63'+ 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}}
671 o_- M # typed: 1 o_- M{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{M}}1 o‾− M{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{M}}
701 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}}
731 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}}
76-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}
79-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}
82r_ev M # typed: r_ev M{\mathrm{\underline{r}ev}}\ {\mathrm{M}}r‾ev M{\mathrm{\underline{r}ev}}\ {\mathrm{M}}
85r_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}}
88r_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}}
93x^2 # typed: x^2{\mathrm{x}}^{2}x2{\mathrm{x}}^{2}
97(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}
100x ^ 3 # typed: x ^ 3{\mathrm{x}}\ {\mathbin{\hat{}}}\ {3}x ^ 3{\mathrm{x}}\ {\mathbin{\hat{}}}\ {3}
104n_eg^3 5 # typed: n_eg^3 5{\mathrm{\underline{n}eg}}^{3}\ {5}n‾eg3 5{\mathrm{\underline{n}eg}}^{3}\ {5}
109-1 0 1 # typed: -1 0 1{-1}\ {0}\ {1}−1 0 1{-1}\ {0}\ {1}
1123 - 1 # typed: 3 - 1{3}\ {-}\ {1}3 − 1{3}\ {-}\ {1}
1163 -1 # typed: 3 -1{3}\ {-1}3 −1{3}\ {-1}
119x - -3 # typed: x - -3{\mathrm{x}}\ {-}\ {-3}x − −3{\mathrm{x}}\ {-}\ {-3}
1222.5 * 2 # typed: 2.5 * 2{2.5}\ {\times}\ {2}2.5 × 2{2.5}\ {\times}\ {2}
127x != 3 # typed: x != 3{\mathrm{x}}\ {\neq}\ {3}x ≠ 3{\mathrm{x}}\ {\neq}\ {3}
130x <= 5 # typed: x <= 5{\mathrm{x}}\ {\leq}\ {5}x ≤ 5{\mathrm{x}}\ {\leq}\ {5}
134(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}
135(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}
141u: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}}\ {\}}
1442 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}
149u: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}\ {\}}
151u: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}
155'{ _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}
159u: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}}{]}
160u: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}
166"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"}}
169t_ally @ # typed: t_ally @{\mathrm{\underline{t}ally}}\ {@}t‾ally @{\mathrm{\underline{t}ally}}\ {@}
1721 + 1; 2 + 2 # typed: 1 + 1; 2 + 2{1}\ {+}\ {1}{\diamond}\ {2}\ {+}\ {2}1 + 1⋄ 2 + 2{1}\ {+}\ {1}{\diamond}\ {2}\ {+}\ {2}
179"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"}}
1831 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}
186f_ormat 3.5 # typed: f_ormat 3.5{\mathrm{\underline{f}ormat}}\ {3.5}f‾ormat 3.5{\mathrm{\underline{f}ormat}}\ {3.5}
191"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

15u: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}}\ {\}}
20u: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}
21 _ := p_rint! x\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}  _ ← p‾rint! x\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}
22 _ := p_rint! ""\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}  _ ← p‾rint! ""\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}
23 n = 0 ? x\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {\mathrm{x}}  n = 0 ? x\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {\mathrm{x}}
24 (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}}
25}{\}}}{\}}
32blinker := 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}
33u:l_ife blinker{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{blinker}}ul‾ife blinker{{}^{\mathrm{u}}\mathrm{\underline{l}ife}}\ {\mathrm{blinker}}
34u: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}}
35(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}}
41glider := 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}
44last := 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

13x := -3{\mathrm{x}}\ {\leftarrow}\ {-3}x ← −3{\mathrm{x}}\ {\leftarrow}\ {-3}
14c"x > 0" i_f< c"1; -1"{\text{c"}}{\mathrm{x}}\ {>}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{1}{\diamond}\ {-1}{\text{"}}c"x > 0" i‾f< c"1⋄ −1"{\text{c"}}{\mathrm{x}}\ {>}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{1}{\diamond}\ {-1}{\text{"}}
1510 * c"x > 0" i_f< c"1; -1"{10}\ {\times}\ {\text{c"}}{\mathrm{x}}\ {>}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{1}{\diamond}\ {-1}{\text{"}}10 × c"x > 0" i‾f< c"1⋄ −1"{10}\ {\times}\ {\text{c"}}{\mathrm{x}}\ {>}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{1}{\diamond}\ {-1}{\text{"}}
16c"x < 0" i_f< c"0; 1 / 0"{\text{c"}}{\mathrm{x}}\ {<}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{0}{\diamond}\ {1}\ {\div}\ {0}{\text{"}}c"x < 0" i‾f< c"0⋄ 1 ÷ 0"{\text{c"}}{\mathrm{x}}\ {<}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{0}{\diamond}\ {1}\ {\div}\ {0}{\text{"}}
18c"x = 0" u_nless< c"p_rint! 100 / x"{\text{c"}}{\mathrm{x}}\ {=}\ {0}{\text{"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{c"}}{\mathrm{\underline{p}rint}{!}}\ {100}\ {\div}\ {\mathrm{x}}{\text{"}}c"x = 0" u‾nless< c"p‾rint! 100 ÷ x"{\text{c"}}{\mathrm{x}}\ {=}\ {0}{\text{"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{c"}}{\mathrm{\underline{p}rint}{!}}\ {100}\ {\div}\ {\mathrm{x}}{\text{"}}
22"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 \}"}}
23u: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}
24u: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" c_heck< "x is positive"{\text{"x > 0"}}\ {\mathrm{\underline{c}heck}{<}}\ {\text{"x is positive"}}"x > 0" c‾heck< "x is positive"{\text{"x > 0"}}\ {\mathrm{\underline{c}heck}{<}}\ {\text{"x is positive"}}
29@ c_fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}@ c‾fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}
36"m:" u_se< "Macros"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"m:" u‾se< "Macros"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
38"s_quare" m:d_ef< c"_r * _r"{\text{"s\_quare"}}\ {{}^{\mathrm{m}}\mathrm{\underline{d}ef}{<}}\ {\text{c"}}{\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}{\text{"}}"s_quare" md‾ef< c"_r × _r"{\text{"s\_quare"}}\ {{}^{\mathrm{m}}\mathrm{\underline{d}ef}{<}}\ {\text{c"}}{\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}{\text{"}}
39u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}
40c"4 = 2 + 2" m:t_est< "addition"{\text{c"}}{4}\ {=}\ {2}\ {+}\ {2}{\text{"}}\ {{}^{\mathrm{m}}\mathrm{\underline{t}est}{<}}\ {\text{"addition"}}c"4 = 2 + 2" mt‾est< "addition"{\text{c"}}{4}\ {=}\ {2}\ {+}\ {2}{\text{"}}\ {{}^{\mathrm{m}}\mathrm{\underline{t}est}{<}}\ {\text{"addition"}}
41c"5 = 2 * 2" m:t_est< "doubling"{\text{c"}}{5}\ {=}\ {2}\ {\times}\ {2}{\text{"}}\ {{}^{\mathrm{m}}\mathrm{\underline{t}est}{<}}\ {\text{"doubling"}}c"5 = 2 × 2" mt‾est< "doubling"{\text{c"}}{5}\ {=}\ {2}\ {\times}\ {2}{\text{"}}\ {{}^{\mathrm{m}}\mathrm{\underline{t}est}{<}}\ {\text{"doubling"}}

demos/magmas.xtl

17u: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}\ {\}}
19names := "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"}}
21t := (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}
22t # the Cayley table: 1 rock, 2 paper, 3 scissors{\mathrm{t}}t{\mathrm{t}}
23t 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}}
31u: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}}\ {\}}
33u: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}}\ {\}}
36u: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}
37 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}
38 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}}
39 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}}
40 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}}
41 '& 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}}
42}{\}}}{\}}
45u: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}
46 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}}
47 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}}
48 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}}
49}{\}}}{\}}
50'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}
51'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}
52'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}
53'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}
57'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}
58(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}
65u: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}\ {\}}
67u: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}\ {\}}
68'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}
69'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}
70'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}
71'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}
72'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}
81u: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}\ {\}}
83moves := "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"}}
85w := (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}
86w s_elect moves{\mathrm{w}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{moves}}w s‾elect moves{\mathrm{w}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{moves}}
88beats := 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}
89beats # row x: the moves x beats{\mathrm{beats}}beats{\mathrm{beats}}
90'+ r_/_2 beats # each beats two{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{beats}}’+ r‾/2 beats{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{beats}}
91'+ r_/ beats # and loses to two{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{beats}}’+ r‾/ beats{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{beats}}
92'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}
93'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}
94'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}
96shown := []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

10"m:" u_se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}"m:" u‾se< "Maybe"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Maybe"}}
16u: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}}\ {\}}
20-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}
21-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}
28u: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}\ {\}}
30u: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}\ {\}}
31-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}
36u: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}\ {\}}
37-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}
42-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}
450 '{ _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}
460 '{ _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

38l:dwell := 5.0{{}^{\mathrm{l}}\mathrm{dwell}}\ {\leftarrow}\ {5.0}ldwell ← 5.0{{}^{\mathrm{l}}\mathrm{dwell}}\ {\leftarrow}\ {5.0}
39l: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 -> ((i c_at l c_at l, 0 0 0, 0.0 0.0 0.0, 1 1 1), (0, 0.0 0.0, 0.0, 0.0), (l:idleBefore, 0.0, 0, 0)) }{{}^{\mathrm{l}}\mathrm{\underline{s}tart}}\ {\leftarrow}\ {\{}\ {\mathrm{i}}\ {\mathrm{l}}\ {\to}\ {(}{(}{\mathrm{i}}\ {\mathrm{\underline{c}at}}\ {\mathrm{l}}\ {\mathrm{\underline{c}at}}\ {\mathrm{l}}{,}\ {0}\ {0}\ {0}{,}\ {0.0}\ {0.0}\ {0.0}{,}\ {1}\ {1}\ {1}{)}{,}\ {(}{0}{,}\ {0.0}\ {0.0}{,}\ {0.0}{,}\ {0.0}{)}{,}\ {(}{{}^{\mathrm{l}}\mathrm{idleBefore}}{,}\ {0.0}{,}\ {0}{,}\ {0}{)}{)}\ {\}}ls‾tart ← { i l → ((i c‾at l c‾at l, 0 0 0, 0.0 0.0 0.0, 1 1 1), (0, 0.0 0.0, 0.0, 0.0), (lidleBefore, 0.0, 0, 0)) }{{}^{\mathrm{l}}\mathrm{\underline{s}tart}}\ {\leftarrow}\ {\{}\ {\mathrm{i}}\ {\mathrm{l}}\ {\to}\ {(}{(}{\mathrm{i}}\ {\mathrm{\underline{c}at}}\ {\mathrm{l}}\ {\mathrm{\underline{c}at}}\ {\mathrm{l}}{,}\ {0}\ {0}\ {0}{,}\ {0.0}\ {0.0}\ {0.0}{,}\ {1}\ {1}\ {1}{)}{,}\ {(}{0}{,}\ {0.0}\ {0.0}{,}\ {0.0}{,}\ {0.0}{)}{,}\ {(}{{}^{\mathrm{l}}\mathrm{idleBefore}}{,}\ {0.0}{,}\ {0}{,}\ {0}{)}{)}\ {\}}
50l:IDIOM := 1{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\leftarrow}\ {1}lIDIOM ← 1{{}^{\mathrm{l}}\mathrm{IDIOM}}\ {\leftarrow}\ {1}
51l:TOP := 2{{}^{\mathrm{l}}\mathrm{TOP}}\ {\leftarrow}\ {2}lTOP ← 2{{}^{\mathrm{l}}\mathrm{TOP}}\ {\leftarrow}\ {2}
52l:BOTTOM := 3{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\leftarrow}\ {3}lBOTTOM ← 3{{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {\leftarrow}\ {3}
57l:middle := 210.0{{}^{\mathrm{l}}\mathrm{middle}}\ {\leftarrow}\ {210.0}lmiddle ← 210.0{{}^{\mathrm{l}}\mathrm{middle}}\ {\leftarrow}\ {210.0}
58l: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}
64l:c_ount := { axis state -> ((c, _, _, _), _, _) := state; axis s_elect c }{{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\_}{,}\ {\_}{,}\ {\_}{)}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{axis}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{c}}\ {\}}lc‾ount ← { axis state → ((c, _, _, _), _, _) ← state⋄ axis s‾elect c }{{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\_}{,}\ {\_}{,}\ {\_}{)}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{axis}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{c}}\ {\}}
65l:s_teps := { axis state -> ((_, s, _, _), _, _) := state; axis s_elect s }{{}^{\mathrm{l}}\mathrm{\underline{s}teps}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{(}{\_}{,}\ {\mathrm{s}}{,}\ {\_}{,}\ {\_}{)}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{axis}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}\ {\}}ls‾teps ← { axis state → ((_, s, _, _), _, _) ← state⋄ axis s‾elect s }{{}^{\mathrm{l}}\mathrm{\underline{s}teps}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{(}{\_}{,}\ {\mathrm{s}}{,}\ {\_}{,}\ {\_}{)}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{axis}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}\ {\}}
66l:a_ngle := { axis state -> ((_, _, a, _), _, _) := state; axis s_elect a }{{}^{\mathrm{l}}\mathrm{\underline{a}ngle}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{(}{\_}{,}\ {\_}{,}\ {\mathrm{a}}{,}\ {\_}{)}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{axis}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{a}}\ {\}}la‾ngle ← { axis state → ((_, _, a, _), _, _) ← state⋄ axis s‾elect a }{{}^{\mathrm{l}}\mathrm{\underline{a}ngle}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{(}{\_}{,}\ {\_}{,}\ {\mathrm{a}}{,}\ {\_}{)}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{axis}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{a}}\ {\}}
67l:p_laying := { axis state -> ((_, _, _, p), _, _) := state; axis s_elect p }{{}^{\mathrm{l}}\mathrm{\underline{p}laying}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{(}{\_}{,}\ {\_}{,}\ {\_}{,}\ {\mathrm{p}}{)}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{axis}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}\ {\}}lp‾laying ← { axis state → ((_, _, _, p), _, _) ← state⋄ axis s‾elect p }{{}^{\mathrm{l}}\mathrm{\underline{p}laying}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{(}{\_}{,}\ {\_}{,}\ {\_}{,}\ {\mathrm{p}}{)}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{axis}}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}\ {\}}
70l:p_ointer := { state -> (_, q, _) := state; q }{{}^{\mathrm{l}}\mathrm{\underline{p}ointer}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{\_}{,}\ {\mathrm{q}}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{q}}\ {\}}lp‾ointer ← { state → (_, q, _) ← state⋄ q }{{}^{\mathrm{l}}\mathrm{\underline{p}ointer}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{\_}{,}\ {\mathrm{q}}{,}\ {\_}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{q}}\ {\}}
71l:c_lock := { state -> (_, _, k) := state; k }{{}^{\mathrm{l}}\mathrm{\underline{c}lock}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{\_}{,}\ {\_}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{k}}\ {\}}lc‾lock ← { state → (_, _, k) ← state⋄ k }{{}^{\mathrm{l}}\mathrm{\underline{c}lock}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{\_}{,}\ {\_}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {\mathrm{k}}\ {\}}
74h:s_et := { (k, x) v -> ((k - 1) t_ake v) c_at x c_at k d_rop v }{{}^{\mathrm{h}}\mathrm{\underline{s}et}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{k}}{,}\ {\mathrm{x}}{)}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{x}}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}\ {\}}hs‾et ← { (k, x) v → ((k − 1) t‾ake v) c‾at x c‾at k d‾rop v }{{}^{\mathrm{h}}\mathrm{\underline{s}et}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{k}}{,}\ {\mathrm{x}}{)}\ {\mathrm{v}}\ {\to}\ {(}{(}{\mathrm{k}}\ {-}\ {1}{)}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{x}}\ {\mathrm{\underline{c}at}}\ {\mathrm{k}}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}\ {\}}
77h:s_tepsTo := { (axis, n) state -> ((c, s, a, p), q, k) := state; ((c, (axis, n) h:s_et s, a, p), q, k) }{{}^{\mathrm{h}}\mathrm{\underline{s}tepsTo}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{n}}{)}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{(}{\mathrm{c}}{,}\ {(}{\mathrm{axis}}{,}\ {\mathrm{n}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}et}}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\}}hs‾tepsTo ← { (axis, n) state → ((c, s, a, p), q, k) ← state⋄ ((c, (axis, n) hs‾et s, a, p), q, k) }{{}^{\mathrm{h}}\mathrm{\underline{s}tepsTo}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{n}}{)}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{(}{\mathrm{c}}{,}\ {(}{\mathrm{axis}}{,}\ {\mathrm{n}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}et}}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\}}
78h:a_ngleTo := { (axis, x) state -> ((c, s, a, p), q, k) := state; ((c, s, (axis, x) h:s_et a, p), q, k) }{{}^{\mathrm{h}}\mathrm{\underline{a}ngleTo}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{x}}{)}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {(}{\mathrm{axis}}{,}\ {\mathrm{x}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}et}}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\}}ha‾ngleTo ← { (axis, x) state → ((c, s, a, p), q, k) ← state⋄ ((c, s, (axis, x) hs‾et a, p), q, k) }{{}^{\mathrm{h}}\mathrm{\underline{a}ngleTo}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{x}}{)}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {(}{\mathrm{axis}}{,}\ {\mathrm{x}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}et}}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\}}
79h:p_layingTo := { (axis, b) state -> ((c, s, a, p), q, k) := state; ((c, s, a, (axis, b) h:s_et p), q, k) }{{}^{\mathrm{h}}\mathrm{\underline{p}layingTo}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{b}}{)}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {(}{\mathrm{axis}}{,}\ {\mathrm{b}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}et}}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\}}hp‾layingTo ← { (axis, b) state → ((c, s, a, p), q, k) ← state⋄ ((c, s, a, (axis, b) hs‾et p), q, k) }{{}^{\mathrm{h}}\mathrm{\underline{p}layingTo}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{b}}{)}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {(}{\mathrm{axis}}{,}\ {\mathrm{b}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}et}}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\}}
82h:i_dleTo := { t state -> (axes, q, (_, since, b, i)) := state; (axes, q, (t, since, b, i)) }{{}^{\mathrm{h}}\mathrm{\underline{i}dleTo}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\_}{,}\ {\mathrm{since}}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\mathrm{t}}{,}\ {\mathrm{since}}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\}}hi‾dleTo ← { t state → (axes, q, (_, since, b, i)) ← state⋄ (axes, q, (t, since, b, i)) }{{}^{\mathrm{h}}\mathrm{\underline{i}dleTo}}\ {\leftarrow}\ {\{}\ {\mathrm{t}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\_}{,}\ {\mathrm{since}}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\mathrm{t}}{,}\ {\mathrm{since}}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\}}
85l: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}}\ {\}}
91l:c_urrent := { axis state -> (axis l:c_ount state) l:w_rap 1 + axis l:s_teps state }{{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{w}rap}}\ {1}\ {+}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{s}teps}}\ {\mathrm{state}}\ {\}}lc‾urrent ← { axis state → (axis lc‾ount state) lw‾rap 1 + axis ls‾teps state }{{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{w}rap}}\ {1}\ {+}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{s}teps}}\ {\mathrm{state}}\ {\}}
102l:s_tep := { (axis, d) state ->{{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{d}}{)}\ {\mathrm{state}}\ {\to}ls‾tep ← { (axis, d) state →{{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{d}}{)}\ {\mathrm{state}}\ {\to}
103 moved := (axis, d + axis l:s_teps state) h:s_tepsTo state\ \ {\mathrm{moved}}\ {\leftarrow}\ {(}{\mathrm{axis}}{,}\ {\mathrm{d}}\ {+}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{s}teps}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}tepsTo}}\ {\mathrm{state}}  moved ← (axis, d + axis ls‾teps state) hs‾tepsTo state\ \ {\mathrm{moved}}\ {\leftarrow}\ {(}{\mathrm{axis}}{,}\ {\mathrm{d}}\ {+}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{s}teps}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}tepsTo}}\ {\mathrm{state}}
104 axis = l:IDIOM ? moved\ \ {\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {?}\ {\mathrm{moved}}  axis = lIDIOM ? moved\ \ {\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {?}\ {\mathrm{moved}}
105 other := 5 - axis\ \ {\mathrm{other}}\ {\leftarrow}\ {5}\ {-}\ {\mathrm{axis}}  other ← 5 − axis\ \ {\mathrm{other}}\ {\leftarrow}\ {5}\ {-}\ {\mathrm{axis}}
106 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}}
107 c"clash" i_f< c"(axis, d) l:s_tep moved; moved"\ \ {\text{c"}}{\mathrm{clash}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{(}{\mathrm{axis}}{,}\ {\mathrm{d}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{moved}}{\diamond}\ {\mathrm{moved}}{\text{"}}  c"clash" i‾f< c"(axis, d) ls‾tep moved⋄ moved"\ \ {\text{c"}}{\mathrm{clash}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{(}{\mathrm{axis}}{,}\ {\mathrm{d}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{moved}}{\diamond}\ {\mathrm{moved}}{\text{"}}
108}{\}}}{\}}
119l:c_hoose := { (axis, k) state ->{{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{k}}{)}\ {\mathrm{state}}\ {\to}lc‾hoose ← { (axis, k) state →{{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{k}}{)}\ {\mathrm{state}}\ {\to}
120 n := axis l:c_ount state\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}  n ← axis lc‾ount state\ \ {\mathrm{n}}\ {\leftarrow}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}
121 d := (k - axis l:c_urrent state) m_od n\ \ {\mathrm{d}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {-}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}  d ← (k − axis lc‾urrent state) m‾od n\ \ {\mathrm{d}}\ {\leftarrow}\ {(}{\mathrm{k}}\ {-}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{m}od}}\ {\mathrm{n}}
122 short := c"(2 * d) > n" i_f< c"d - n; d"\ \ {\mathrm{short}}\ {\leftarrow}\ {\text{c"}}{(}{2}\ {\times}\ {\mathrm{d}}{)}\ {>}\ {\mathrm{n}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\mathrm{d}}\ {-}\ {\mathrm{n}}{\diamond}\ {\mathrm{d}}{\text{"}}  short ← c"(2 × d) > n" i‾f< c"d − n⋄ d"\ \ {\mathrm{short}}\ {\leftarrow}\ {\text{c"}}{(}{2}\ {\times}\ {\mathrm{d}}{)}\ {>}\ {\mathrm{n}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\mathrm{d}}\ {-}\ {\mathrm{n}}{\diamond}\ {\mathrm{d}}{\text{"}}
123 chosen := (axis, 0) h:p_layingTo (axis, short) l:s_tep state\ \ {\mathrm{chosen}}\ {\leftarrow}\ {(}{\mathrm{axis}}{,}\ {0}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{p}layingTo}}\ {(}{\mathrm{axis}}{,}\ {\mathrm{short}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  chosen ← (axis, 0) hp‾layingTo (axis, short) ls‾tep state\ \ {\mathrm{chosen}}\ {\leftarrow}\ {(}{\mathrm{axis}}{,}\ {0}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{p}layingTo}}\ {(}{\mathrm{axis}}{,}\ {\mathrm{short}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
124 axis = l:IDIOM ? chosen\ \ {\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {?}\ {\mathrm{chosen}}  axis = lIDIOM ? chosen\ \ {\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {?}\ {\mathrm{chosen}}
125 k = (5 - axis) l:c_urrent state ? state\ \ {\mathrm{k}}\ {=}\ {(}{5}\ {-}\ {\mathrm{axis}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{state}}\ {?}\ {\mathrm{state}}  k = (5 − axis) lc‾urrent state ? state\ \ {\mathrm{k}}\ {=}\ {(}{5}\ {-}\ {\mathrm{axis}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}urrent}}\ {\mathrm{state}}\ {?}\ {\mathrm{state}}
126 chosen\ \ {\mathrm{chosen}}  chosen\ \ {\mathrm{chosen}}
127}{\}}}{\}}
135l:e_ase := { (axis, dt) state ->{{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{dt}}{)}\ {\mathrm{state}}\ {\to}le‾ase ← { (axis, dt) state →{{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{dt}}{)}\ {\mathrm{state}}\ {\to}
136 angle := axis l:a_ngle state\ \ {\mathrm{angle}}\ {\leftarrow}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}  angle ← axis la‾ngle state\ \ {\mathrm{angle}}\ {\leftarrow}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}
137 target := 90.0 * f_loat axis l:s_teps state\ \ {\mathrm{target}}\ {\leftarrow}\ {90.0}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{s}teps}}\ {\mathrm{state}}  target ← 90.0 × f‾loat axis ls‾teps state\ \ {\mathrm{target}}\ {\leftarrow}\ {90.0}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{s}teps}}\ {\mathrm{state}}
138 gap := target - angle\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{target}}\ {-}\ {\mathrm{angle}}  gap ← target − angle\ \ {\mathrm{gap}}\ {\leftarrow}\ {\mathrm{target}}\ {-}\ {\mathrm{angle}}
139 moved := angle + gap * 1.0 m_in 2.0 * dt\ \ {\mathrm{moved}}\ {\leftarrow}\ {\mathrm{angle}}\ {+}\ {\mathrm{gap}}\ {\times}\ {1.0}\ {\mathrm{\underline{m}in}}\ {2.0}\ {\times}\ {\mathrm{dt}}  moved ← angle + gap × 1.0 m‾in 2.0 × dt\ \ {\mathrm{moved}}\ {\leftarrow}\ {\mathrm{angle}}\ {+}\ {\mathrm{gap}}\ {\times}\ {1.0}\ {\mathrm{\underline{m}in}}\ {2.0}\ {\times}\ {\mathrm{dt}}
140 near := c"0.5 > a_bs target - moved" i_f< c"target; moved"\ \ {\mathrm{near}}\ {\leftarrow}\ {\text{c"}}{0.5}\ {>}\ {\mathrm{\underline{a}bs}}\ {\mathrm{target}}\ {-}\ {\mathrm{moved}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\mathrm{target}}{\diamond}\ {\mathrm{moved}}{\text{"}}  near ← c"0.5 > a‾bs target − moved" i‾f< c"target⋄ moved"\ \ {\mathrm{near}}\ {\leftarrow}\ {\text{c"}}{0.5}\ {>}\ {\mathrm{\underline{a}bs}}\ {\mathrm{target}}\ {-}\ {\mathrm{moved}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\mathrm{target}}{\diamond}\ {\mathrm{moved}}{\text{"}}
141 (axis, near) h:a_ngleTo state\ \ {(}{\mathrm{axis}}{,}\ {\mathrm{near}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{a}ngleTo}}\ {\mathrm{state}}  (axis, near) ha‾ngleTo state\ \ {(}{\mathrm{axis}}{,}\ {\mathrm{near}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{a}ngleTo}}\ {\mathrm{state}}
142}{\}}}{\}}
149l:s_ettle := { state -> (l:BOTTOM, 9.0) l:e_ase (l:TOP, 9.0) l:e_ase (l:IDIOM, 9.0) l:e_ase state }{{}^{\mathrm{l}}\mathrm{\underline{s}ettle}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}{,}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}{,}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}{,}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\mathrm{state}}\ {\}}ls‾ettle ← { state → (lBOTTOM, 9.0) le‾ase (lTOP, 9.0) le‾ase (lIDIOM, 9.0) le‾ase state }{{}^{\mathrm{l}}\mathrm{\underline{s}ettle}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}{,}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}{,}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}{,}\ {9.0}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\mathrm{state}}\ {\}}
160l: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}
161 eased := (l:BOTTOM, dt) l:e_ase (l:TOP, dt) l:e_ase (l:IDIOM, dt) l:e_ase state\ \ {\mathrm{eased}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}{,}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}{,}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}{,}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\mathrm{state}}  eased ← (lBOTTOM, dt) le‾ase (lTOP, dt) le‾ase (lIDIOM, dt) le‾ase state\ \ {\mathrm{eased}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}{,}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}{,}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}{,}\ {\mathrm{dt}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{e}ase}}\ {\mathrm{state}}
162 (axes, q, (idle0, since0, b, i)) := eased\ \ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\mathrm{idle0}}{,}\ {\mathrm{since0}}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\leftarrow}\ {\mathrm{eased}}  (axes, q, (idle0, since0, b, i)) ← eased\ \ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\mathrm{idle0}}{,}\ {\mathrm{since0}}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\leftarrow}\ {\mathrm{eased}}
163 idle := dt + idle0\ \ {\mathrm{idle}}\ {\leftarrow}\ {\mathrm{dt}}\ {+}\ {\mathrm{idle0}}  idle ← dt + idle0\ \ {\mathrm{idle}}\ {\leftarrow}\ {\mathrm{dt}}\ {+}\ {\mathrm{idle0}}
164 since := dt + since0\ \ {\mathrm{since}}\ {\leftarrow}\ {\mathrm{dt}}\ {+}\ {\mathrm{since0}}  since ← dt + since0\ \ {\mathrm{since}}\ {\leftarrow}\ {\mathrm{dt}}\ {+}\ {\mathrm{since0}}
165 (idle < l:idleBefore) | since < l:dwell ? (axes, q, (idle, since, b, i))\ \ {(}{\mathrm{idle}}\ {<}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}{)}\ {\vee}\ {\mathrm{since}}\ {<}\ {{}^{\mathrm{l}}\mathrm{dwell}}\ {?}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}  (idle < lidleBefore) ∨ since < ldwell ? (axes, q, (idle, since, b, i))\ \ {(}{\mathrm{idle}}\ {<}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}{)}\ {\vee}\ {\mathrm{since}}\ {<}\ {{}^{\mathrm{l}}\mathrm{dwell}}\ {?}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}
166 l:a_ttract (axes, q, (idle, 0.0, b, i))\ \ {{}^{\mathrm{l}}\mathrm{\underline{a}ttract}}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\mathrm{idle}}{,}\ {0.0}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}  la‾ttract (axes, q, (idle, 0.0, b, i))\ \ {{}^{\mathrm{l}}\mathrm{\underline{a}ttract}}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\mathrm{idle}}{,}\ {0.0}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}
167}{\}}}{\}}
185l: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}
186 n := (l:TOP l:c_ount state) - 1\ \ {\mathrm{n}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}{)}\ {-}\ {1}  n ← (lTOP lc‾ount state) − 1\ \ {\mathrm{n}}\ {\leftarrow}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}{)}\ {-}\ {1}
187 m := l:IDIOM l:c_ount state\ \ {\mathrm{m}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}  m ← lIDIOM lc‾ount state\ \ {\mathrm{m}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}
188 (_, _, (idle, since, b0, i0)) := state\ \ {(}{\_}{,}\ {\_}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {\mathrm{b0}}{,}\ {\mathrm{i0}}{)}{)}\ {\leftarrow}\ {\mathrm{state}}  (_, _, (idle, since, b0, i0)) ← state\ \ {(}{\_}{,}\ {\_}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {\mathrm{b0}}{,}\ {\mathrm{i0}}{)}{)}\ {\leftarrow}\ {\mathrm{state}}
189 (axes1, q1, _) := l:BOTTOM l:p_lay state\ \ {(}{\mathrm{axes1}}{,}\ {\mathrm{q1}}{,}\ {\_}{)}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {\mathrm{state}}  (axes1, q1, _) ← lBOTTOM lp‾lay state\ \ {(}{\mathrm{axes1}}{,}\ {\mathrm{q1}}{,}\ {\_}{)}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {\mathrm{state}}
190 (1 + b0) < n ? (axes1, q1, (idle, since, 1 + b0, i0))\ \ {(}{1}\ {+}\ {\mathrm{b0}}{)}\ {<}\ {\mathrm{n}}\ {?}\ {(}{\mathrm{axes1}}{,}\ {\mathrm{q1}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {1}\ {+}\ {\mathrm{b0}}{,}\ {\mathrm{i0}}{)}{)}  (1 + b0) < n ? (axes1, q1, (idle, since, 1 + b0, i0))\ \ {(}{1}\ {+}\ {\mathrm{b0}}{)}\ {<}\ {\mathrm{n}}\ {?}\ {(}{\mathrm{axes1}}{,}\ {\mathrm{q1}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {1}\ {+}\ {\mathrm{b0}}{,}\ {\mathrm{i0}}{)}{)}
191 (axes2, q2, _) := l:IDIOM l:p_lay (axes1, q1, (idle, since, 0, i0))\ \ {(}{\mathrm{axes2}}{,}\ {\mathrm{q2}}{,}\ {\_}{)}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {(}{\mathrm{axes1}}{,}\ {\mathrm{q1}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {0}{,}\ {\mathrm{i0}}{)}{)}  (axes2, q2, _) ← lIDIOM lp‾lay (axes1, q1, (idle, since, 0, i0))\ \ {(}{\mathrm{axes2}}{,}\ {\mathrm{q2}}{,}\ {\_}{)}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {(}{\mathrm{axes1}}{,}\ {\mathrm{q1}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {0}{,}\ {\mathrm{i0}}{)}{)}
192 (1 + i0) < m ? (axes2, q2, (idle, since, 0, 1 + i0))\ \ {(}{1}\ {+}\ {\mathrm{i0}}{)}\ {<}\ {\mathrm{m}}\ {?}\ {(}{\mathrm{axes2}}{,}\ {\mathrm{q2}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {0}{,}\ {1}\ {+}\ {\mathrm{i0}}{)}{)}  (1 + i0) < m ? (axes2, q2, (idle, since, 0, 1 + i0))\ \ {(}{1}\ {+}\ {\mathrm{i0}}{)}\ {<}\ {\mathrm{m}}\ {?}\ {(}{\mathrm{axes2}}{,}\ {\mathrm{q2}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {0}{,}\ {1}\ {+}\ {\mathrm{i0}}{)}{)}
193 l:TOP l:p_lay (axes2, q2, (idle, since, 0, 0))\ \ {{}^{\mathrm{l}}\mathrm{TOP}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {(}{\mathrm{axes2}}{,}\ {\mathrm{q2}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {0}{,}\ {0}{)}{)}  lTOP lp‾lay (axes2, q2, (idle, since, 0, 0))\ \ {{}^{\mathrm{l}}\mathrm{TOP}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {(}{\mathrm{axes2}}{,}\ {\mathrm{q2}}{,}\ {(}{\mathrm{idle}}{,}\ {\mathrm{since}}{,}\ {0}{,}\ {0}{)}{)}
194}{\}}}{\}}
197l:p_lay := { axis state -> c"1 = axis l:p_laying state" i_f< c"(axis, 1) l:s_tep state; state" }{{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {\text{c"}}{1}\ {=}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}laying}}\ {\mathrm{state}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{(}{\mathrm{axis}}{,}\ {1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}{\diamond}\ {\mathrm{state}}{\text{"}}\ {\}}lp‾lay ← { axis state → c"1 = axis lp‾laying state" i‾f< c"(axis, 1) ls‾tep state⋄ state" }{{}^{\mathrm{l}}\mathrm{\underline{p}lay}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {\text{c"}}{1}\ {=}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}laying}}\ {\mathrm{state}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{(}{\mathrm{axis}}{,}\ {1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}{\diamond}\ {\mathrm{state}}{\text{"}}\ {\}}
200l:t_ouched := { state -> (axes, q, (_, _, b, i)) := state; (axes, q, (0.0, 0.0, b, i)) }{{}^{\mathrm{l}}\mathrm{\underline{t}ouched}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\_}{,}\ {\_}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{0.0}{,}\ {0.0}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\}}lt‾ouched ← { state → (axes, q, (_, _, b, i)) ← state⋄ (axes, q, (0.0, 0.0, b, i)) }{{}^{\mathrm{l}}\mathrm{\underline{t}ouched}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{\_}{,}\ {\_}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{\mathrm{axes}}{,}\ {\mathrm{q}}{,}\ {(}{0.0}{,}\ {0.0}{,}\ {\mathrm{b}}{,}\ {\mathrm{i}}{)}{)}\ {\}}
203l:r_esume := { state -> ((c, s, a, _), q, k) := state; ((c, s, a, 1 1 1), q, k) }{{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\_}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {1}\ {1}\ {1}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\}}lr‾esume ← { state → ((c, s, a, _), q, k) ← state⋄ ((c, s, a, 1 1 1), q, k) }{{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\leftarrow}\ {\{}\ {\mathrm{state}}\ {\to}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\_}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {1}\ {1}\ {1}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\}}
214l: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}
215 ((c, s, a, p), q, k) := state\ \ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}  ((c, s, a, p), q, k) ← state\ \ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {\mathrm{p}}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}
216 0 < '+ r_/ p ? ((c, s, a, 0 0 0), q, k)\ \ {0}\ {<}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{p}}\ {?}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {0}\ {0}\ {0}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}  0 < ’+ r‾/ p ? ((c, s, a, 0 0 0), q, k)\ \ {0}\ {<}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{p}}\ {?}\ {(}{(}{\mathrm{c}}{,}\ {\mathrm{s}}{,}\ {\mathrm{a}}{,}\ {0}\ {0}\ {0}{)}{,}\ {\mathrm{q}}{,}\ {\mathrm{k}}{)}
217 l:r_esume state\ \ {{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\mathrm{state}}  lr‾esume state\ \ {{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\mathrm{state}}
218}{\}}}{\}}
232l: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}
233 ((_, _, _, p), _, (idle, _, _, _)) := state\ \ {(}{(}{\_}{,}\ {\_}{,}\ {\_}{,}\ {\mathrm{p}}{)}{,}\ {\_}{,}\ {(}{\mathrm{idle}}{,}\ {\_}{,}\ {\_}{,}\ {\_}{)}{)}\ {\leftarrow}\ {\mathrm{state}}  ((_, _, _, p), _, (idle, _, _, _)) ← state\ \ {(}{(}{\_}{,}\ {\_}{,}\ {\_}{,}\ {\mathrm{p}}{)}{,}\ {\_}{,}\ {(}{\mathrm{idle}}{,}\ {\_}{,}\ {\_}{,}\ {\_}{)}{)}\ {\leftarrow}\ {\mathrm{state}}
234 paused := 1 - p\ \ {\mathrm{paused}}\ {\leftarrow}\ {1}\ {-}\ {\mathrm{p}}  paused ← 1 − p\ \ {\mathrm{paused}}\ {\leftarrow}\ {1}\ {-}\ {\mathrm{p}}
235 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"}}
236 names := paused r_eplicate "roll" "top" "bottom"\ \ {\mathrm{names}}\ {\leftarrow}\ {\mathrm{paused}}\ {\mathrm{\underline{r}eplicate}}\ {\text{"roll"}}\ {\text{"top"}}\ {\text{"bottom"}}  names ← paused r‾eplicate "roll" "top" "bottom"\ \ {\mathrm{names}}\ {\leftarrow}\ {\mathrm{paused}}\ {\mathrm{\underline{r}eplicate}}\ {\text{"roll"}}\ {\text{"top"}}\ {\text{"bottom"}}
237 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}}
238 l:idleBefore > idle ? "holding"\ \ {{}^{\mathrm{l}}\mathrm{idleBefore}}\ {>}\ {\mathrm{idle}}\ {?}\ {\text{"holding"}}  lidleBefore > idle ? "holding"\ \ {{}^{\mathrm{l}}\mathrm{idleBefore}}\ {>}\ {\mathrm{idle}}\ {?}\ {\text{"holding"}}
239 "touring"\ \ {\text{"touring"}}  "touring"\ \ {\text{"touring"}}
240}{\}}}{\}}
243l:t_oggle := { axis state -> (axis, 1 - axis l:p_laying state) h:p_layingTo state }{{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axis}}{,}\ {1}\ {-}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}laying}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{p}layingTo}}\ {\mathrm{state}}\ {\}}lt‾oggle ← { axis state → (axis, 1 − axis lp‾laying state) hp‾layingTo state }{{}^{\mathrm{l}}\mathrm{\underline{t}oggle}}\ {\leftarrow}\ {\{}\ {\mathrm{axis}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axis}}{,}\ {1}\ {-}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{p}laying}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{p}layingTo}}\ {\mathrm{state}}\ {\}}
255l: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}
256 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}}
257 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}}
258 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}}
259 at := []E_AT e\ \ {\mathrm{at}}\ {\leftarrow}\ {\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}  at ← □E‾AT e\ \ {\mathrm{at}}\ {\leftarrow}\ {\square \mathrm{\underline{E}AT}}\ {\mathrm{e}}
260 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}}
261 kind m_atch "down" ? at l:d_own touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"down"}}\ {?}\ {\mathrm{at}}\ {{}^{\mathrm{l}}\mathrm{\underline{d}own}}\ {\mathrm{touched}}  kind m‾atch "down" ? at ld‾own touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"down"}}\ {?}\ {\mathrm{at}}\ {{}^{\mathrm{l}}\mathrm{\underline{d}own}}\ {\mathrm{touched}}
262 kind m_atch "move" ? at l:m_ove touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"move"}}\ {?}\ {\mathrm{at}}\ {{}^{\mathrm{l}}\mathrm{\underline{m}ove}}\ {\mathrm{touched}}  kind m‾atch "move" ? at lm‾ove touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"move"}}\ {?}\ {\mathrm{at}}\ {{}^{\mathrm{l}}\mathrm{\underline{m}ove}}\ {\mathrm{touched}}
263 kind m_atch "up" ? at l:u_p touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"up"}}\ {?}\ {\mathrm{at}}\ {{}^{\mathrm{l}}\mathrm{\underline{u}p}}\ {\mathrm{touched}}  kind m‾atch "up" ? at lu‾p touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"up"}}\ {?}\ {\mathrm{at}}\ {{}^{\mathrm{l}}\mathrm{\underline{u}p}}\ {\mathrm{touched}}
264 kind m_atch "click" ? at l:c_lick touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"click"}}\ {?}\ {\mathrm{at}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\mathrm{touched}}  kind m‾atch "click" ? at lc‾lick touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"click"}}\ {?}\ {\mathrm{at}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\mathrm{touched}}
265 kind m_atch "choose" ? (f_loor 1 s_elect at, f_loor 2 s_elect at) l:c_hoose touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"choose"}}\ {?}\ {(}{\mathrm{\underline{f}loor}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{at}}{,}\ {\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{at}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{touched}}  kind m‾atch "choose" ? (f‾loor 1 s‾elect at, f‾loor 2 s‾elect at) lc‾hoose touched\ \ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{"choose"}}\ {?}\ {(}{\mathrm{\underline{f}loor}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{at}}{,}\ {\mathrm{\underline{f}loor}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{at}}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{c}hoose}}\ {\mathrm{touched}}
266 state\ \ {\mathrm{state}}  state\ \ {\mathrm{state}}
267}{\}}}{\}}
271l:h_alf := { xy -> c"(2 s_elect xy) < l:middle" i_f< c"l:TOP; l:BOTTOM" }{{}^{\mathrm{l}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\to}\ {\text{c"}}{(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {<}\ {{}^{\mathrm{l}}\mathrm{middle}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{{}^{\mathrm{l}}\mathrm{TOP}}{\diamond}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}{\text{"}}\ {\}}lh‾alf ← { xy → c"(2 s‾elect xy) < lmiddle" i‾f< c"lTOP⋄ lBOTTOM" }{{}^{\mathrm{l}}\mathrm{\underline{h}alf}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\to}\ {\text{c"}}{(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {<}\ {{}^{\mathrm{l}}\mathrm{middle}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{{}^{\mathrm{l}}\mathrm{TOP}}{\diamond}\ {{}^{\mathrm{l}}\mathrm{BOTTOM}}{\text{"}}\ {\}}
278l:d_own := { xy state -> (axes, _, k) := state; (axes, (-1, xy, 0.0, 0.0), k) }{{}^{\mathrm{l}}\mathrm{\underline{d}own}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axes}}{,}\ {\_}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{\mathrm{axes}}{,}\ {(}{-1}{,}\ {\mathrm{xy}}{,}\ {0.0}{,}\ {0.0}{)}{,}\ {\mathrm{k}}{)}\ {\}}ld‾own ← { xy state → (axes, _, k) ← state⋄ (axes, (−1, xy, 0.0, 0.0), k) }{{}^{\mathrm{l}}\mathrm{\underline{d}own}}\ {\leftarrow}\ {\{}\ {\mathrm{xy}}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axes}}{,}\ {\_}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}{\diamond}\ {(}{\mathrm{axes}}{,}\ {(}{-1}{,}\ {\mathrm{xy}}{,}\ {0.0}{,}\ {0.0}{)}{,}\ {\mathrm{k}}{)}\ {\}}
292l: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}
293 (axes, (held, was, moved0, last), k) := state\ \ {(}{\mathrm{axes}}{,}\ {(}{\mathrm{held}}{,}\ {\mathrm{was}}{,}\ {\mathrm{moved0}}{,}\ {\mathrm{last}}{)}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}  (axes, (held, was, moved0, last), k) ← state\ \ {(}{\mathrm{axes}}{,}\ {(}{\mathrm{held}}{,}\ {\mathrm{was}}{,}\ {\mathrm{moved0}}{,}\ {\mathrm{last}}{)}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}
294 held = 0 ? state\ \ {\mathrm{held}}\ {=}\ {0}\ {?}\ {\mathrm{state}}  held = 0 ? state\ \ {\mathrm{held}}\ {=}\ {0}\ {?}\ {\mathrm{state}}
295 dx := (1 s_elect xy) - 1 s_elect was\ \ {\mathrm{dx}}\ {\leftarrow}\ {(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {-}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{was}}  dx ← (1 s‾elect xy) − 1 s‾elect was\ \ {\mathrm{dx}}\ {\leftarrow}\ {(}{1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {-}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{was}}
296 dy := (2 s_elect xy) - 2 s_elect was\ \ {\mathrm{dy}}\ {\leftarrow}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {-}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{was}}  dy ← (2 s‾elect xy) − 2 s‾elect was\ \ {\mathrm{dy}}\ {\leftarrow}\ {(}{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{xy}}{)}\ {-}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{was}}
297 moved := (a_bs dx) + (a_bs dy) + moved0\ \ {\mathrm{moved}}\ {\leftarrow}\ {(}{\mathrm{\underline{a}bs}}\ {\mathrm{dx}}{)}\ {+}\ {(}{\mathrm{\underline{a}bs}}\ {\mathrm{dy}}{)}\ {+}\ {\mathrm{moved0}}  moved ← (a‾bs dx) + (a‾bs dy) + moved0\ \ {\mathrm{moved}}\ {\leftarrow}\ {(}{\mathrm{\underline{a}bs}}\ {\mathrm{dx}}{)}\ {+}\ {(}{\mathrm{\underline{a}bs}}\ {\mathrm{dy}}{)}\ {+}\ {\mathrm{moved0}}
298 placed := (axes, (held, xy, moved, last), k)\ \ {\mathrm{placed}}\ {\leftarrow}\ {(}{\mathrm{axes}}{,}\ {(}{\mathrm{held}}{,}\ {\mathrm{xy}}{,}\ {\mathrm{moved}}{,}\ {\mathrm{last}}{)}{,}\ {\mathrm{k}}{)}  placed ← (axes, (held, xy, moved, last), k)\ \ {\mathrm{placed}}\ {\leftarrow}\ {(}{\mathrm{axes}}{,}\ {(}{\mathrm{held}}{,}\ {\mathrm{xy}}{,}\ {\mathrm{moved}}{,}\ {\mathrm{last}}{)}{,}\ {\mathrm{k}}{)}
299 (held = -1) & moved <= 4.0 ? placed\ \ {(}{\mathrm{held}}\ {=}\ {-1}{)}\ {\wedge}\ {\mathrm{moved}}\ {\leq}\ {4.0}\ {?}\ {\mathrm{placed}}  (held = −1) ∧ moved ≤ 4.0 ? placed\ \ {(}{\mathrm{held}}\ {=}\ {-1}{)}\ {\wedge}\ {\mathrm{moved}}\ {\leq}\ {4.0}\ {?}\ {\mathrm{placed}}
300 axis := c"held = -1" i_f< c"\"(a_bs dx) >= a_bs dy\" i_f< \"l:h_alf xy; l:IDIOM\"; held"\ \ {\mathrm{axis}}\ {\leftarrow}\ {\text{c"}}{\mathrm{held}}\ {=}\ {-1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"(a\_bs dx) >= a\_bs dy\textbackslash{}"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{\textbackslash{}"l:h\_alf xy; l:IDIOM\textbackslash{}"}}{\diamond}\ {\mathrm{held}}{\text{"}}  axis ← c"held = −1" i‾f< c"\"(a_bs dx) >= a_bs dy\" i‾f< \"l:h_alf xy; l:IDIOM\"⋄ held"\ \ {\mathrm{axis}}\ {\leftarrow}\ {\text{c"}}{\mathrm{held}}\ {=}\ {-1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"(a\_bs dx) >= a\_bs dy\textbackslash{}"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{\textbackslash{}"l:h\_alf xy; l:IDIOM\textbackslash{}"}}{\diamond}\ {\mathrm{held}}{\text{"}}
301 along := c"axis = l:IDIOM" i_f< c"dy; dx"\ \ {\mathrm{along}}\ {\leftarrow}\ {\text{c"}}{\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\mathrm{dy}}{\diamond}\ {\mathrm{dx}}{\text{"}}  along ← c"axis = lIDIOM" i‾f< c"dy⋄ dx"\ \ {\mathrm{along}}\ {\leftarrow}\ {\text{c"}}{\mathrm{axis}}\ {=}\ {{}^{\mathrm{l}}\mathrm{IDIOM}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\mathrm{dy}}{\diamond}\ {\mathrm{dx}}{\text{"}}
302 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}}
303 (turned, _, _) := (axis, turn + axis l:a_ngle placed) h:a_ngleTo placed\ \ {(}{\mathrm{turned}}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {(}{\mathrm{axis}}{,}\ {\mathrm{turn}}\ {+}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ngle}}\ {\mathrm{placed}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{a}ngleTo}}\ {\mathrm{placed}}  (turned, _, _) ← (axis, turn + axis la‾ngle placed) ha‾ngleTo placed\ \ {(}{\mathrm{turned}}{,}\ {\_}{,}\ {\_}{)}\ {\leftarrow}\ {(}{\mathrm{axis}}{,}\ {\mathrm{turn}}\ {+}\ {\mathrm{axis}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ngle}}\ {\mathrm{placed}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{a}ngleTo}}\ {\mathrm{placed}}
304 (turned, (axis, xy, moved, turn), k)\ \ {(}{\mathrm{turned}}{,}\ {(}{\mathrm{axis}}{,}\ {\mathrm{xy}}{,}\ {\mathrm{moved}}{,}\ {\mathrm{turn}}{)}{,}\ {\mathrm{k}}{)}  (turned, (axis, xy, moved, turn), k)\ \ {(}{\mathrm{turned}}{,}\ {(}{\mathrm{axis}}{,}\ {\mathrm{xy}}{,}\ {\mathrm{moved}}{,}\ {\mathrm{turn}}{)}{,}\ {\mathrm{k}}{)}
305}{\}}}{\}}
316l: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}
317 (axes, (held, was, moved, last), k) := state\ \ {(}{\mathrm{axes}}{,}\ {(}{\mathrm{held}}{,}\ {\mathrm{was}}{,}\ {\mathrm{moved}}{,}\ {\mathrm{last}}{)}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}  (axes, (held, was, moved, last), k) ← state\ \ {(}{\mathrm{axes}}{,}\ {(}{\mathrm{held}}{,}\ {\mathrm{was}}{,}\ {\mathrm{moved}}{,}\ {\mathrm{last}}{)}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {\mathrm{state}}
318 held = 0 ? state\ \ {\mathrm{held}}\ {=}\ {0}\ {?}\ {\mathrm{state}}  held = 0 ? state\ \ {\mathrm{held}}\ {=}\ {0}\ {?}\ {\mathrm{state}}
319 released := (axes, (0, was, moved, last), k)\ \ {\mathrm{released}}\ {\leftarrow}\ {(}{\mathrm{axes}}{,}\ {(}{0}{,}\ {\mathrm{was}}{,}\ {\mathrm{moved}}{,}\ {\mathrm{last}}{)}{,}\ {\mathrm{k}}{)}  released ← (axes, (0, was, moved, last), k)\ \ {\mathrm{released}}\ {\leftarrow}\ {(}{\mathrm{axes}}{,}\ {(}{0}{,}\ {\mathrm{was}}{,}\ {\mathrm{moved}}{,}\ {\mathrm{last}}{)}{,}\ {\mathrm{k}}{)}
320 held = -1 ? xy l:c_lick released\ \ {\mathrm{held}}\ {=}\ {-1}\ {?}\ {\mathrm{xy}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\mathrm{released}}  held = −1 ? xy lc‾lick released\ \ {\mathrm{held}}\ {=}\ {-1}\ {?}\ {\mathrm{xy}}\ {{}^{\mathrm{l}}\mathrm{\underline{c}lick}}\ {\mathrm{released}}
321 flick := c"6.0 < a_bs last" i_f< c"45.0 * last / a_bs last; 0.0"\ \ {\mathrm{flick}}\ {\leftarrow}\ {\text{c"}}{6.0}\ {<}\ {\mathrm{\underline{a}bs}}\ {\mathrm{last}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{45.0}\ {\times}\ {\mathrm{last}}\ {\div}\ {\mathrm{\underline{a}bs}}\ {\mathrm{last}}{\diamond}\ {0.0}{\text{"}}  flick ← c"6.0 < a‾bs last" i‾f< c"45.0 × last ÷ a‾bs last⋄ 0.0"\ \ {\mathrm{flick}}\ {\leftarrow}\ {\text{c"}}{6.0}\ {<}\ {\mathrm{\underline{a}bs}}\ {\mathrm{last}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{45.0}\ {\times}\ {\mathrm{last}}\ {\div}\ {\mathrm{\underline{a}bs}}\ {\mathrm{last}}{\diamond}\ {0.0}{\text{"}}
322 angle := held l:a_ngle state\ \ {\mathrm{angle}}\ {\leftarrow}\ {\mathrm{held}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}  angle ← held la‾ngle state\ \ {\mathrm{angle}}\ {\leftarrow}\ {\mathrm{held}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}
323 (held, f_loor 0.5 + (angle + flick) / 90.0) h:s_tepsTo released\ \ {(}{\mathrm{held}}{,}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{angle}}\ {+}\ {\mathrm{flick}}{)}\ {\div}\ {90.0}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}tepsTo}}\ {\mathrm{released}}  (held, f‾loor 0.5 + (angle + flick) ÷ 90.0) hs‾tepsTo released\ \ {(}{\mathrm{held}}{,}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {(}{\mathrm{angle}}\ {+}\ {\mathrm{flick}}{)}\ {\div}\ {90.0}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{s}tepsTo}}\ {\mathrm{released}}
324}{\}}}{\}}
330l: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}}\ {\}}
334l: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}
335 k = []K_NAMED 1 ? (l:IDIOM, -1) l:s_tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {1}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}{,}\ {-1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  k = □K‾NAMED 1 ? (lIDIOM, −1) ls‾tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {1}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}{,}\ {-1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
336 k = []K_NAMED 2 ? (l:IDIOM, 1) l:s_tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {2}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}{,}\ {1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  k = □K‾NAMED 2 ? (lIDIOM, 1) ls‾tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {2}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{IDIOM}}{,}\ {1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
337 k = []K_NAMED 3 ? (l:TOP, -1) l:s_tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {3}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}{,}\ {-1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  k = □K‾NAMED 3 ? (lTOP, −1) ls‾tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {3}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}{,}\ {-1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
338 k = []K_NAMED 4 ? (l:TOP, 1) l:s_tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {4}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}{,}\ {1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  k = □K‾NAMED 4 ? (lTOP, 1) ls‾tep state\ \ {\mathrm{k}}\ {=}\ {\square \mathrm{\underline{K}NAMED}}\ {4}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{TOP}}{,}\ {1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
339 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}}
340 c m_atch "a" ? (l:BOTTOM, -1) l:s_tep state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"a"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}{,}\ {-1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  c m‾atch "a" ? (lBOTTOM, −1) ls‾tep state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"a"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}{,}\ {-1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
341 c m_atch "d" ? (l:BOTTOM, 1) l:s_tep state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"d"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}{,}\ {1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}  c m‾atch "d" ? (lBOTTOM, 1) ls‾tep state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"d"}}\ {?}\ {(}{{}^{\mathrm{l}}\mathrm{BOTTOM}}{,}\ {1}{)}\ {{}^{\mathrm{l}}\mathrm{\underline{s}tep}}\ {\mathrm{state}}
342 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}}
343 c m_atch "r" ? l:idleBefore h:i_dleTo l:r_esume state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"r"}}\ {?}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}\ {{}^{\mathrm{h}}\mathrm{\underline{i}dleTo}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\mathrm{state}}  c m‾atch "r" ? lidleBefore hi‾dleTo lr‾esume state\ \ {\mathrm{c}}\ {\mathrm{\underline{m}atch}}\ {\text{"r"}}\ {?}\ {{}^{\mathrm{l}}\mathrm{idleBefore}}\ {{}^{\mathrm{h}}\mathrm{\underline{i}dleTo}}\ {{}^{\mathrm{l}}\mathrm{\underline{r}esume}}\ {\mathrm{state}}
344 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}}
345 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}}
346 state\ \ {\mathrm{state}}  state\ \ {\mathrm{state}}
347}{\}}}{\}}

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 := h:j_oin '{ k -> k l:l_ine d_isclose k s_elect lines } m_ap r_ange t_ally lines\ \ {\mathrm{texts}}\ {\leftarrow}\ {{}^{\mathrm{h}}\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 ← hj‾oin ’{ k → k ll‾ine d‾isclose k s‾elect lines } m‾ap r‾ange t‾ally lines\ \ {\mathrm{texts}}\ {\leftarrow}\ {{}^{\mathrm{h}}\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 := c"k = 1" i_f< c"\"0.06\"; \"0.1\""\ \ {\mathrm{size}}\ {\leftarrow}\ {\text{c"}}{\mathrm{k}}\ {=}\ {1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"0.06\textbackslash{}"}}{\diamond}\ {\text{\textbackslash{}"0.1\textbackslash{}"}}{\text{"}}  size ← c"k = 1" i‾f< c"\"0.06\"⋄ \"0.1\""\ \ {\mathrm{size}}\ {\leftarrow}\ {\text{c"}}{\mathrm{k}}\ {=}\ {1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"0.06\textbackslash{}"}}{\diamond}\ {\text{\textbackslash{}"0.1\textbackslash{}"}}{\text{"}}
147 y := c"k = 1" i_f< c"0.13; 0.14 + 0.16 * f_loat k"\ \ {\mathrm{y}}\ {\leftarrow}\ {\text{c"}}{\mathrm{k}}\ {=}\ {1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{0.13}{\diamond}\ {0.14}\ {+}\ {0.16}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{\text{"}}  y ← c"k = 1" i‾f< c"0.13⋄ 0.14 + 0.16 × f‾loat k"\ \ {\mathrm{y}}\ {\leftarrow}\ {\text{c"}}{\mathrm{k}}\ {=}\ {1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{0.13}{\diamond}\ {0.14}\ {+}\ {0.16}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{\text{"}}
148 color := c"k = 1" i_f< c"\"#4b5563\"; \"#000000\""\ \ {\mathrm{color}}\ {\leftarrow}\ {\text{c"}}{\mathrm{k}}\ {=}\ {1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"\#4b5563\textbackslash{}"}}{\diamond}\ {\text{\textbackslash{}"\#000000\textbackslash{}"}}{\text{"}}  color ← c"k = 1" i‾f< c"\"#4b5563\"⋄ \"#000000\""\ \ {\mathrm{color}}\ {\leftarrow}\ {\text{c"}}{\mathrm{k}}\ {=}\ {1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"\#4b5563\textbackslash{}"}}{\diamond}\ {\text{\textbackslash{}"\#000000\textbackslash{}"}}{\text{"}}
149 weight := c"k = 1" i_f< c"\"500\"; \"700\""\ \ {\mathrm{weight}}\ {\leftarrow}\ {\text{c"}}{\mathrm{k}}\ {=}\ {1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"500\textbackslash{}"}}{\diamond}\ {\text{\textbackslash{}"700\textbackslash{}"}}{\text{"}}  weight ← c"k = 1" i‾f< c"\"500\"⋄ \"700\""\ \ {\mathrm{weight}}\ {\leftarrow}\ {\text{c"}}{\mathrm{k}}\ {=}\ {1}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"500\textbackslash{}"}}{\diamond}\ {\text{\textbackslash{}"700\textbackslash{}"}}{\text{"}}
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}}\ {\}}
158h:j_oin := { b ->{{}^{\mathrm{h}}\mathrm{\underline{j}oin}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}hj‾oin ← { b →{{}^{\mathrm{h}}\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 c"shaded" i_f< c"v:r_gb 3 r_eshape 40 + 200 * u:l_it f; \"none\""\ \ {\mathrm{fill}}\ {\leftarrow}\ {{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\text{c"}}{\mathrm{shaded}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{{}^{\mathrm{v}}\mathrm{\underline{r}gb}}\ {3}\ {\mathrm{\underline{r}eshape}}\ {40}\ {+}\ {200}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{l}it}}\ {\mathrm{f}}{\diamond}\ {\text{\textbackslash{}"none\textbackslash{}"}}{\text{"}}  fill ← vf‾ill c"shaded" i‾f< c"vr‾gb 3 r‾eshape 40 + 200 × ul‾it f⋄ \"none\""\ \ {\mathrm{fill}}\ {\leftarrow}\ {{}^{\mathrm{v}}\mathrm{\underline{f}ill}}\ {\text{c"}}{\mathrm{shaded}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{{}^{\mathrm{v}}\mathrm{\underline{r}gb}}\ {3}\ {\mathrm{\underline{r}eshape}}\ {40}\ {+}\ {200}\ {\times}\ {{}^{\mathrm{u}}\mathrm{\underline{l}it}}\ {\mathrm{f}}{\diamond}\ {\text{\textbackslash{}"none\textbackslash{}"}}{\text{"}}
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}
64_ := '{ a -> 0 u:f_rame a } e_ach angles{\_}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\to}\ {0}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\mathrm{a}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}_ ← ’{ a → 0 uf‾rame a } e‾ach angles{\_}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\to}\ {0}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\mathrm{a}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}
65_ := '{ a -> 1 u:f_rame a } e_ach angles{\_}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{a}}\ {\to}\ {1}\ {{}^{\mathrm{u}}\mathrm{\underline{f}rame}}\ {\mathrm{a}}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{angles}}_ ← ’{ a → 1 uf‾rame a } e‾ach angles{\_}\ {\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 := "data.toml"{\mathrm{data}}\ {\leftarrow}\ {\text{"data.toml"}}data ← "data.toml"{\mathrm{data}}\ {\leftarrow}\ {\text{"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 := c"0 = t_ally note" i_f< c"\"(no concise idiom)\"; note"\ \ {\mathrm{missing}}\ {\leftarrow}\ {\text{c"}}{0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{note}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"(no concise idiom)\textbackslash{}"}}{\diamond}\ {\mathrm{note}}{\text{"}}  missing ← c"0 = t‾ally note" i‾f< c"\"(no concise idiom)\"⋄ note"\ \ {\mathrm{missing}}\ {\leftarrow}\ {\text{c"}}{0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{note}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"(no concise idiom)\textbackslash{}"}}{\diamond}\ {\mathrm{note}}{\text{"}}
140 result := c"0 = t_ally out" i_f< c"\"\"; \"-> \" c_at u:o_neLine out"\ \ {\mathrm{result}}\ {\leftarrow}\ {\text{c"}}{0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{out}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"\textbackslash{}"}}{\diamond}\ {\text{\textbackslash{}"-> \textbackslash{}"}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}neLine}}\ {\mathrm{out}}{\text{"}}  result ← c"0 = t‾ally out" i‾f< c"\"\"⋄ \"-> \" c‾at uo‾neLine out"\ \ {\mathrm{result}}\ {\leftarrow}\ {\text{c"}}{0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{out}}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\text{\textbackslash{}"\textbackslash{}"}}{\diamond}\ {\text{\textbackslash{}"-> \textbackslash{}"}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{u}}\mathrm{\underline{o}neLine}}\ {\mathrm{out}}{\text{"}}
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 := { (axis, offset) state -> (axis cm:c_ount state) cm:w_rap 1 + offset + st:b_ase axis cm:a_ngle state }{{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{offset}}{)}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axis}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{w}rap}}\ {1}\ {+}\ {\mathrm{offset}}\ {+}\ {{}^{\mathrm{st}}\mathrm{\underline{b}ase}}\ {\mathrm{axis}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}\ {\}}ui‾tem ← { (axis, offset) state → (axis cmc‾ount state) cmw‾rap 1 + offset + stb‾ase axis cma‾ngle state }{{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{axis}}{,}\ {\mathrm{offset}}{)}\ {\mathrm{state}}\ {\to}\ {(}{\mathrm{axis}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}ount}}\ {\mathrm{state}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{w}rap}}\ {1}\ {+}\ {\mathrm{offset}}\ {+}\ {{}^{\mathrm{st}}\mathrm{\underline{b}ase}}\ {\mathrm{axis}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}\ {\}}
158u: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}
159 i := (cm:IDIOM, 0) u:i_tem state\ \ {\mathrm{i}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}{,}\ {0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}  i ← (cmIDIOM, 0) ui‾tem state\ \ {\mathrm{i}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}{,}\ {0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}
160 roll := cm:IDIOM cm:a_ngle state\ \ {\mathrm{roll}}\ {\leftarrow}\ {{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}  roll ← cmIDIOM cma‾ngle state\ \ {\mathrm{roll}}\ {\leftarrow}\ {{}^{\mathrm{cm}}\mathrm{IDIOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}
161 top := 1 st:r_ing (cm:TOP cm:a_ngle state) c_at roll\ \ {\mathrm{top}}\ {\leftarrow}\ {1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{roll}}  top ← 1 str‾ing (cmTOP cma‾ngle state) c‾at roll\ \ {\mathrm{top}}\ {\leftarrow}\ {1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{roll}}
162 bottom := -1 st:r_ing (cm:BOTTOM cm:a_ngle state) c_at roll\ \ {\mathrm{bottom}}\ {\leftarrow}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{roll}}  bottom ← −1 str‾ing (cmBOTTOM cma‾ngle state) c‾at roll\ \ {\mathrm{bottom}}\ {\leftarrow}\ {-1}\ {{}^{\mathrm{st}}\mathrm{\underline{r}ing}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{roll}}
163 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}}
164 c_apName := { k -> v:e_scape d_isclose ((cm:IDIOM, 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{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, 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{k}}\ {\mathrm{\underline{s}elect}}\ {{}^{\mathrm{st}}\mathrm{capOffsets}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{idiomNames}}\ {\}}
165 c_apText := { k ->\ \ {\mathrm{\underline{c}apText}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}  c‾apText ← { k →\ \ {\mathrm{\underline{c}apText}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}
166 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}
167 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}
168 ""\ \ \ \ {\text{""}}    ""\ \ \ \ {\text{""}}
169 }\ \ {\}}  }\ \ {\}}
170 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}}\ {\}}
171 t_opPanel := { k -> (e_nclose "#fdfcfa") c_at i u:f_ace (cm:TOP, 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{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, 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{k}}\ {\mathrm{\underline{s}elect}}\ {{}^{\mathrm{st}}\mathrm{ringOffsets}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}\ {\}}
172 b_ottomPanel := { k -> (e_nclose "#f4f1ec") c_at i u:f_ace (cm:BOTTOM, 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{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, 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{k}}\ {\mathrm{\underline{s}elect}}\ {{}^{\mathrm{st}}\mathrm{ringOffsets}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{state}}\ {\}}
173 l_ines := { k ->\ \ {\mathrm{\underline{l}ines}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}  l‾ines ← { k →\ \ {\mathrm{\underline{l}ines}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}
174 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}}
175 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}}
176 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}
177 c_ap k\ \ \ \ {\mathrm{\underline{c}ap}}\ {\mathrm{k}}    c‾ap k\ \ \ \ {\mathrm{\underline{c}ap}}\ {\mathrm{k}}
178 }\ \ {\}}  }\ \ {\}}
179 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}}\ {\}}
180 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}}
181 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}}
182 (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}}
183}{\}}}{\}}
185u: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}}\ {\}}
192u: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}
193 i := d_isclose ((cm:IDIOM, 0) u:i_tem s) s_elect idioms\ \ {\mathrm{i}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}{,}\ {0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{idioms}}  i ← d‾isclose ((cmIDIOM, 0) ui‾tem s) s‾elect idioms\ \ {\mathrm{i}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{IDIOM}}{,}\ {0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{idioms}}
194 t := d_isclose ((cm:TOP, 0) u:i_tem s) s_elect languages\ \ {\mathrm{t}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}  t ← d‾isclose ((cmTOP, 0) ui‾tem s) s‾elect languages\ \ {\mathrm{t}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}
195 b := d_isclose ((cm:BOTTOM, 0) u:i_tem s) s_elect languages\ \ {\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}{,}\ {0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}  b ← d‾isclose ((cmBOTTOM, 0) ui‾tem s) s‾elect languages\ \ {\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {(}{(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}{,}\ {0}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{i}tem}}\ {\mathrm{s}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{languages}}
196 "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}}
197}{\}}}{\}}
203u: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}
204 e := []E_VENT @\ \ {\mathrm{e}}\ {\leftarrow}\ {\square \mathrm{\underline{E}VENT}}\ {@}  e ← □E‾VENT @\ \ {\mathrm{e}}\ {\leftarrow}\ {\square \mathrm{\underline{E}VENT}}\ {@}
205 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}}
206 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}}
207 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}}
208 c"(u:w_here state) m_atch u:w_here next" u_nless< c"p_rint! u:w_here next"\ \ {\text{c"}}{(}{{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\mathrm{next}}{\text{"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{c"}}{\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\mathrm{next}}{\text{"}}  c"(uw‾here state) m‾atch uw‾here next" u‾nless< c"p‾rint! uw‾here next"\ \ {\text{c"}}{(}{{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\mathrm{next}}{\text{"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{c"}}{\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}here}}\ {\mathrm{next}}{\text{"}}
209 c"(cm:m_ode state) m_atch cm:m_ode next" u_nless< c"p_rint! \"mode \" c_at cm:m_ode next"\ \ {\text{c"}}{(}{{}^{\mathrm{cm}}\mathrm{\underline{m}ode}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{cm}}\mathrm{\underline{m}ode}}\ {\mathrm{next}}{\text{"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{c"}}{\mathrm{\underline{p}rint}{!}}\ {\text{\textbackslash{}"mode \textbackslash{}"}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{\underline{m}ode}}\ {\mathrm{next}}{\text{"}}  c"(cmm‾ode state) m‾atch cmm‾ode next" u‾nless< c"p‾rint! \"mode \" c‾at cmm‾ode next"\ \ {\text{c"}}{(}{{}^{\mathrm{cm}}\mathrm{\underline{m}ode}}\ {\mathrm{state}}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{cm}}\mathrm{\underline{m}ode}}\ {\mathrm{next}}{\text{"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{c"}}{\mathrm{\underline{p}rint}{!}}\ {\text{\textbackslash{}"mode \textbackslash{}"}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{cm}}\mathrm{\underline{m}ode}}\ {\mathrm{next}}{\text{"}}
210 c"n_ot kind m_atch \"tick\"" u_nless< c"[]S_HOW u:s_tone next"\ \ {\text{c"}}{\mathrm{\underline{n}ot}}\ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{\textbackslash{}"tick\textbackslash{}"}}{\text{"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{c"}}{\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tone}}\ {\mathrm{next}}{\text{"}}  c"n‾ot kind m‾atch \"tick\"" u‾nless< c"□S‾HOW us‾tone next"\ \ {\text{c"}}{\mathrm{\underline{n}ot}}\ {\mathrm{kind}}\ {\mathrm{\underline{m}atch}}\ {\text{\textbackslash{}"tick\textbackslash{}"}}{\text{"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{c"}}{\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{s}tone}}\ {\mathrm{next}}{\text{"}}
211 u:l_oop! next\ \ {{}^{\mathrm{u}}\mathrm{\underline{l}oop}{!}}\ {\mathrm{next}}  ul‾oop! next\ \ {{}^{\mathrm{u}}\mathrm{\underline{l}oop}{!}}\ {\mathrm{next}}
212}{\}}}{\}}
217start := cm:r_esume cm:s_ettle (cm:BOTTOM, 2) 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}}{,}\ {2}{)}\ {{}^{\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, 2) 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}}{,}\ {2}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{idioms}}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tart}}\ {\mathrm{\underline{t}ally}}\ {\mathrm{languages}}
218shown := 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}}
219mode := 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}}
220u: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

11u: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}
12 n = 0 ? n\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {\mathrm{n}}  n = 0 ? n\ \ {\mathrm{n}}\ {=}\ {0}\ {?}\ {\mathrm{n}}
13 _ := p_rint! b\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{b}}  _ ← p‾rint! b\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{b}}
14 _ := p_rint! ""\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}  _ ← p‾rint! ""\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}
15 (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}}
16}{\}}}{\}}
18arrow := 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{".\#.......\#\#.....\#\#\#.....\#\#......\#......................."}}
20shown := 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

6u: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}}\ {\}}
7u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}

demos/stats.xtl

10"s:" u_se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}"s:" u‾se< "Stats"{\text{"s:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Stats"}}
13v := 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}
14s:m_ean v # 5.0{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {\mathrm{v}}sm‾ean v{{}^{\mathrm{s}}\mathrm{\underline{m}ean}}\ {\mathrm{v}}
15s: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}}
16s: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}}
17s:s_pread v # largest minus smallest: 7{{}^{\mathrm{s}}\mathrm{\underline{s}pread}}\ {\mathrm{v}}ss‾pread v{{}^{\mathrm{s}}\mathrm{\underline{s}pread}}\ {\mathrm{v}}
18s: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/tour.xtl

1742 # an Int{42}42{42}
18-3 2.5 # a negative literal; a strand has one type (Float){-3}\ {2.5}−3 2.5{-3}\ {2.5}
20x := 3 # `:=` binds; `=` is always equality{\mathrm{x}}\ {\leftarrow}\ {3}x ← 3{\mathrm{x}}\ {\leftarrow}\ {3}
21x^2 # a literal exponent touches its value: superscript{\mathrm{x}}^{2}x2{\mathrm{x}}^{2}
224^-1 # a negative exponent gives a Float (a literal base){4}^{-1}4−1{4}^{-1}
232 ^ 10 # spaced `^` is the power function (computed exponents){2}\ {\mathbin{\hat{}}}\ {10}2 ^ 10{2}\ {\mathbin{\hat{}}}\ {10}
247 / 2 # `/` always gives a Float{7}\ {\div}\ {2}7 ÷ 2{7}\ {\div}\ {2}
257 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}
26(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}
27(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}
28(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}
29f_loat 3 # Int to Float{\mathrm{\underline{f}loat}}\ {3}f‾loat 3{\mathrm{\underline{f}loat}}\ {3}
30s_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}
31a_tan 1 # and c_os{\mathrm{\underline{a}tan}}\ {1}a‾tan 1{\mathrm{\underline{a}tan}}\ {1}
35count! := 0 # only names ending in ! (like `count!`) may be reassigned{\mathrm{count}!}\ {\leftarrow}\ {0}count! ← 0{\mathrm{count}!}\ {\leftarrow}\ {0}
36count! := count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}count! ← count! + 1{\mathrm{count}!}\ {\leftarrow}\ {\mathrm{count}!}\ {+}\ {1}
37count!{\mathrm{count}!}count!{\mathrm{count}!}
40"hello"{\text{"hello"}}"hello"{\text{"hello"}}
41"abc" = "abd" # item by item{\text{"abc"}}\ {=}\ {\text{"abd"}}"abc" = "abd"{\text{"abc"}}\ {=}\ {\text{"abd"}}
423 t_ake "hello"{3}\ {\mathrm{\underline{t}ake}}\ {\text{"hello"}}3 t‾ake "hello"{3}\ {\mathrm{\underline{t}ake}}\ {\text{"hello"}}
43"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"}}
47m := 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}
48m{\mathrm{m}}m{\mathrm{m}}
49s_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}}
50m * 10 # a scalar extends to every item{\mathrm{m}}\ {\times}\ {10}m × 10{\mathrm{m}}\ {\times}\ {10}
512 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}}
52-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}}
53(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}
54m 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}
551 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}
5610 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}
5724 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}
58r_avel m{\mathrm{\underline{r}avel}}\ {\mathrm{m}}r‾avel m{\mathrm{\underline{r}avel}}\ {\mathrm{m}}
5910 ^ 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}
63u: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}}\ {\}}
64u: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}
66u: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}}\ {\}}
6710 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}
69u: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}\ {\}}
703 u:h_yp 4{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {4}3 uh‾yp 4{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}yp}}\ {4}
72u: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}\ {\}}
74u: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}
75 n <= 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}  n ≤ 1 ? 1\ \ {\mathrm{n}}\ {\leq}\ {1}\ {?}\ {1}
76 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}
77}{\}}}{\}}
78u:f_act 10 # recursion{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}uf‾act 10{{}^{\mathrm{u}}\mathrm{\underline{f}act}}\ {10}
80u: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}\ {\}}
81u:t_wo @{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {@}ut‾wo @{{}^{\mathrm{u}}\mathrm{\underline{t}wo}}\ {@}
84u:k_eep := { a ~_u -> a } # `_u` is a parameter nothing reads; the{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{a}}\ {\}}uk‾eep ← { a ∼_u → a }{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{a}}\ {\}}
857 u:k_eep 1 / 0 # tilde makes it lazy: 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}
86(u:s_ub 100)_ 1 # `(expr)_` applies a function value{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {100}{\underline{)}}\ {1}(‾us‾ub 100)‾ 1{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {100}{\underline{)}}\ {1}
88u: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}}\ {\}}
89'{ _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}
90'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}
93'+ 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}
94'- 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}
95'+ 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}
96'+ r_/ m # the leading axis: column sums{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
97'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}
981 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}
991 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}
100m '+ '* 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}
101'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}
1022 '/ 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}
104'{ _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}
108u: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}}{]}
109u: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}
110{ 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}
111[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}
1123 [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}
113[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}
1141 2 [+ * -] 3 4 # dyadic fork: `(x + y) * (x - y)`{1}\ {2}\ {[}{+}\ {\times}\ {-}{]}\ {3}\ {4}1 2 [+ × −] 3 4{1}\ {2}\ {[}{+}\ {\times}\ {-}{]}\ {3}\ {4}
115[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}
116'[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"}}
1191 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}
120r_ev "stressed"{\mathrm{\underline{r}ev}}\ {\text{"stressed"}}r‾ev "stressed"{\mathrm{\underline{r}ev}}\ {\text{"stressed"}}
124'+ r_/ m # implicit: axis 1, so column sums{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}’+ r‾/ m{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{m}}
125'+ r_/_1 m # the same, explicit{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{m}}’+ r‾/1 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{m}}
126'+ r_/_2 m # axis 2: row sums{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}’+ r‾/2 m{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{m}}
127'+ 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}}
1281 o_- m # rotate the rows (axis 1){1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{m}}1 o‾− m{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{m}}
1291 o_-_1 m # the same, explicit{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{m}}1 o‾−1 m{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{m}}
1301 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}}
131r_ev_2 m # reverse each row{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{m}}r‾ev2 m{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{m}}
132'+ 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}}
133-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}
134s_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}}
135o_\ m # transpose: rows become columns{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}o‾\ m{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{m}}
137a := 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}
138s_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}}
139s_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}}
140s_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}}
144v := 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}
145s_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}}
146u_nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}u‾nique v{\mathrm{\underline{u}nique}}\ {\mathrm{v}}
147v 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}
1482 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}}
149w_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}
153n := "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"}}
154n # nested values print framed (APL2's DISPLAY){\mathrm{n}}n{\mathrm{n}}
155t_ally n{\mathrm{\underline{t}ally}}\ {\mathrm{n}}t‾ally n{\mathrm{\underline{t}ally}}\ {\mathrm{n}}
156d_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}}
158s := "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"}}
159(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}}
160'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}
161d_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}}
164r_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}
165r_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}
166r_oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}r‾oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}
167p_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"}}
17415 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}
177"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"}}
178s: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}
179s: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}
180s:s_pread 3 1 4 1 5 # largest minus smallest{{}^{\mathrm{s}}\mathrm{\underline{s}pread}}\ {3}\ {1}\ {4}\ {1}\ {5}ss‾pread 3 1 4 1 5{{}^{\mathrm{s}}\mathrm{\underline{s}pread}}\ {3}\ {1}\ {4}\ {1}\ {5}
181"hi:" u_se< "Hello" # a library of your own, found in userlibs/{\text{"hi:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}"hi:" u‾se< "Hello"{\text{"hi:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}
182hi:h_ello @ # niladic: called with Unit{{}^{\mathrm{hi}}\mathrm{\underline{h}ello}}\ {@}hih‾ello @{{}^{\mathrm{hi}}\mathrm{\underline{h}ello}}\ {@}
185"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"}}
1861 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}
18710 '- 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}
188'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}
189'* 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}
192u: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}\ {\}}
193'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}
194n_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}
197(1 2 3, 4.5, "abc") # a tuple: several values of their own types side by side{(}{1}\ {2}\ {3}{,}\ {4.5}{,}\ {\text{"abc"}}{)}(1 2 3, 4.5, "abc"){(}{1}\ {2}\ {3}{,}\ {4.5}{,}\ {\text{"abc"}}{)}
199u:s_wapped := { (a, b) -> (b, a) }{{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\to}\ {(}{\mathrm{b}}{,}\ {\mathrm{a}}{)}\ {\}}us‾wapped ← { (a, b) → (b, a) }{{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\to}\ {(}{\mathrm{b}}{,}\ {\mathrm{a}}{)}\ {\}}
200u:s_wapped (1, "x"){{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {(}{1}{,}\ {\text{"x"}}{)}us‾wapped (1, "x"){{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {(}{1}{,}\ {\text{"x"}}{)}
201(n, (x, _)) := (3, (2.5, "unused")) # a pattern binds names; _ ignores a part{(}{\mathrm{n}}{,}\ {(}{\mathrm{x}}{,}\ {\_}{)}{)}\ {\leftarrow}\ {(}{3}{,}\ {(}{2.5}{,}\ {\text{"unused"}}{)}{)}(n, (x, _)) ← (3, (2.5, "unused")){(}{\mathrm{n}}{,}\ {(}{\mathrm{x}}{,}\ {\_}{)}{)}\ {\leftarrow}\ {(}{3}{,}\ {(}{2.5}{,}\ {\text{"unused"}}{)}{)}
202x * f_loat n{\mathrm{x}}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}x × f‾loat n{\mathrm{x}}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}
204u:s_tep := { (w, k) -> (w * 0.5, k + 1) }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{w}}{,}\ {\mathrm{k}}{)}\ {\to}\ {(}{\mathrm{w}}\ {\times}\ {0.5}{,}\ {\mathrm{k}}\ {+}\ {1}{)}\ {\}}us‾tep ← { (w, k) → (w × 0.5, k + 1) }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{w}}{,}\ {\mathrm{k}}{)}\ {\to}\ {(}{\mathrm{w}}\ {\times}\ {0.5}{,}\ {\mathrm{k}}\ {+}\ {1}{)}\ {\}}
2053 'u:s_tep p_ower (8.0 4.0, 0){3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{8.0}\ {4.0}{,}\ {0}{)}3 ’us‾tep p‾ower (8.0 4.0, 0){3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{8.0}\ {4.0}{,}\ {0}{)}
206(1, 2.5) m_atch (1, 2.5) # m_atch compares tuples part by part{(}{1}{,}\ {2.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}{,}\ {2.5}{)}(1, 2.5) m‾atch (1, 2.5){(}{1}{,}\ {2.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}{,}\ {2.5}{)}
207'{ k -> (k, f_loat k) } m_ap 1 2 # boxed tuples: an array of tuples{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}’{ k → (k, f‾loat k) } m‾ap 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}
213u: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}}\ {\}}
214u: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

8"t:" u_se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}"t:" u‾se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}
16v := 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"}}
19m := (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}}
20t_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}}
26u: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}
27 _ := p_rint! "your move (1 to 9):"\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"your move (1 to 9):"}}  _ ← p‾rint! "your move (1 to 9):"\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"your move (1 to 9):"}}
28 t := []R_EAD @\ \ {\mathrm{t}}\ {\leftarrow}\ {\square \mathrm{\underline{R}EAD}}\ {@}  t ← □R‾EAD @\ \ {\mathrm{t}}\ {\leftarrow}\ {\square \mathrm{\underline{R}EAD}}\ {@}
29 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{" "}}
30 (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}}
31}{\}}}{\}}
35u: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}
36 played := s t:a_fter u:a_sk! s\ \ {\mathrm{played}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}{!}}\ {\mathrm{s}}  played ← s ta‾fter ua‾sk! s\ \ {\mathrm{played}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {{}^{\mathrm{u}}\mathrm{\underline{a}sk}{!}}\ {\mathrm{s}}
37 _ := p_rint! t:s_how played\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {\mathrm{played}}  _ ← p‾rint! ts‾how played\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {\mathrm{played}}
38 _ := p_rint! ""\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}  _ ← p‾rint! ""\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}
39 0 = t:o_utcome played ? u:m_e! played; played\ \ {0}\ {=}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {\mathrm{played}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{m}e}{!}}\ {\mathrm{played}}{\diamond}\ {\mathrm{played}}  0 = to‾utcome played ? um‾e! played⋄ played\ \ {0}\ {=}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {\mathrm{played}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{m}e}{!}}\ {\mathrm{played}}{\diamond}\ {\mathrm{played}}
40}{\}}}{\}}
43u: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}
44 played := s t:a_fter m t:c_hoose s\ \ {\mathrm{played}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}  played ← s ta‾fter m tc‾hoose s\ \ {\mathrm{played}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{t}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {{}^{\mathrm{t}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}
45 _ := p_rint! t:s_how played\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {\mathrm{played}}  _ ← p‾rint! ts‾how played\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {{}^{\mathrm{t}}\mathrm{\underline{s}how}}\ {\mathrm{played}}
46 _ := p_rint! ""\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}  _ ← p‾rint! ""\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{""}}
47 0 = t:o_utcome played ? u:y_ou! played; played\ \ {0}\ {=}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {\mathrm{played}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{y}ou}{!}}\ {\mathrm{played}}{\diamond}\ {\mathrm{played}}  0 = to‾utcome played ? uy‾ou! played⋄ played\ \ {0}\ {=}\ {{}^{\mathrm{t}}\mathrm{\underline{o}utcome}}\ {\mathrm{played}}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{y}ou}{!}}\ {\mathrm{played}}{\diamond}\ {\mathrm{played}}
48}{\}}}{\}}
52u:p_aint := { c t -> 1 = 4 s_elect []T_E @ ? ([]C_OLOR c) []F_G t; t }{{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{t}}\ {\to}\ {1}\ {=}\ {4}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{\underline{T}E}}\ {@}\ {?}\ {(}{\square \mathrm{\underline{C}OLOR}}\ {\mathrm{c}}{)}\ {\square \mathrm{\underline{F}G}}\ {\mathrm{t}}{\diamond}\ {\mathrm{t}}\ {\}}up‾aint ← { c t → 1 = 4 s‾elect □T‾E @ ? (□C‾OLOR c) □F‾G t⋄ t }{{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{t}}\ {\to}\ {1}\ {=}\ {4}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{\underline{T}E}}\ {@}\ {?}\ {(}{\square \mathrm{\underline{C}OLOR}}\ {\mathrm{c}}{)}\ {\square \mathrm{\underline{F}G}}\ {\mathrm{t}}{\diamond}\ {\mathrm{t}}\ {\}}
55u:v_erdict := { w -> w = 1 ? 3 u:p_aint "you win"; w = -1 ? 2 u:p_aint "it wins"; "a draw" }{{}^{\mathrm{u}}\mathrm{\underline{v}erdict}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\to}\ {\mathrm{w}}\ {=}\ {1}\ {?}\ {3}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {\text{"you win"}}{\diamond}\ {\mathrm{w}}\ {=}\ {-1}\ {?}\ {2}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {\text{"it wins"}}{\diamond}\ {\text{"a draw"}}\ {\}}uv‾erdict ← { w → w = 1 ? 3 up‾aint "you win"⋄ w = −1 ? 2 up‾aint "it wins"⋄ "a draw" }{{}^{\mathrm{u}}\mathrm{\underline{v}erdict}}\ {\leftarrow}\ {\{}\ {\mathrm{w}}\ {\to}\ {\mathrm{w}}\ {=}\ {1}\ {?}\ {3}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {\text{"you win"}}{\diamond}\ {\mathrm{w}}\ {=}\ {-1}\ {?}\ {2}\ {{}^{\mathrm{u}}\mathrm{\underline{p}aint}}\ {\text{"it wins"}}{\diamond}\ {\text{"a draw"}}\ {\}}
57u: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

8"t:" u_se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}"t:" u‾se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}
11m := 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}}
1450 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}}
18(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

12"t:" u_se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}"t:" u‾se< "TTTML"{\text{"t:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"TTTML"}}
17t: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}
20t: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}
21t: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}
24t: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}
25t: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}
30m := 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}}
32t_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}}
3650 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}}
4050 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}}
43t: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

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

demos/user-macros.xtl

11"r:" u_se< "Repeat"{\text{"r:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Repeat"}}"r:" u‾se< "Repeat"{\text{"r:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Repeat"}}
12"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{}""}}
13"hooray"{\text{"hooray"}}"hooray"{\text{"hooray"}}
18x! := 1{\mathrm{x}!}\ {\leftarrow}\ {1}x! ← 1{\mathrm{x}!}\ {\leftarrow}\ {1}
20"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"}}
21x!{\mathrm{x}!}x!{\mathrm{x}!}

lib/Combinators.xtl

25l: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}}\ {\}}
32l:K_ := { x _u -> x } # Kestrel{{}^{\mathrm{l}}\mathrm{\underline{K}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {\}}lK‾ ← { x _u → x }{{}^{\mathrm{l}}\mathrm{\underline{K}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {\}}
38l: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}}\ {\}}
44l: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}}\ {\}}
51l: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}}\ {\}}
59l: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}}\ {\}}
62l: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}}\ {\}}
65l: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}}}\ {\underline{(}}{\mathrm{z}}\ {\mathrm{\underline{y}}}\ {\mathrm{w}}{\underline{)}}\ {\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}}}\ {\underline{(}}{\mathrm{z}}\ {\mathrm{\underline{y}}}\ {\mathrm{w}}{\underline{)}}\ {\mathrm{v}}\ {\}}
68l: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}}\ {\}}
75l: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}}\ {\}}
78l: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}}\ {\}}
81l: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}\ {\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\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}\ {\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{\underline{w}}}\ {\mathrm{v}}\ {\}}
85l: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}}\ {\}}
88l: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}}\ {\}}
91l: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}}\ {\}}
100l: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}}\ {\}}
103l: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}}\ {\}}
106l:H_ := { x_ y z -> (y x_ z)_ y } # Hummingbird{{}^{\mathrm{l}}\mathrm{\underline{H}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\to}\ {\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{y}}\ {\}}lH‾ ← { x‾ y z → (‾y x‾ z)‾ y }{{}^{\mathrm{l}}\mathrm{\underline{H}}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\to}\ {\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{y}}\ {\}}
109l: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}}\ {\}}
112l: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}}}\ {\}}
119l: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}}\ {\}}
122l: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}}\ {\}}
125l: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}}\ {\}}
128l: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}}\ {\}}
131l: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}}\ {\}}
137l: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}}\ {\}}
143l: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}}\ {\}}
150l: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}}\ {\}}
160l:P_hi := { x_ y_ z_ w -> (y_ w) x_ z_ w } # Phoenix: a fork{{}^{\mathrm{l}}\mathrm{\underline{P}hi}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{\underline{y}}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\}}lP‾hi ← { x‾ y‾ z‾ w → (y‾ w) x‾ z‾ w }{{}^{\mathrm{l}}\mathrm{\underline{P}hi}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{\underline{y}}}\ {\mathrm{w}}{)}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{z}}}\ {\mathrm{w}}\ {\}}
167l:P_si := { x_ y_ z w -> (y_ z) x_ y_ w } # Psi: on{{}^{\mathrm{l}}\mathrm{\underline{P}si}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{\underline{y}}}\ {\mathrm{z}}{)}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{w}}\ {\}}lP‾si ← { x‾ y‾ z w → (y‾ z) x‾ y‾ w }{{}^{\mathrm{l}}\mathrm{\underline{P}si}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{z}}\ {\mathrm{w}}\ {\to}\ {(}{\mathrm{\underline{y}}}\ {\mathrm{z}}{)}\ {\mathrm{\underline{x}}}\ {\mathrm{\underline{y}}}\ {\mathrm{w}}\ {\}}
172l: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}\ {\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{\underline{)}}\ {\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}\ {\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{\underline{)}}\ {\mathrm{z}}\ {\}}
175l: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}\ {\underline{(}}{\mathrm{z}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{\underline{)}}\ {\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}\ {\underline{(}}{\mathrm{z}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{\underline{)}}\ {\mathrm{y}}\ {\}}
178l: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}\ {\underline{(}}{\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\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}\ {\underline{(}}{\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{y}}\ {\}}
181l: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}\ {\underline{(}}{\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}{\underline{)}}\ {\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}\ {\underline{(}}{\mathrm{w}}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}{\underline{)}}\ {\mathrm{z}}\ {\}}
184l:W_s := { x_ y z -> (y x_ z)_ z }{{}^{\mathrm{l}}\mathrm{\underline{W}s}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{x}}}\ {\mathrm{y}}\ {\mathrm{z}}\ {\to}\ {\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\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}\ {\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{z}}\ {\}}
189l: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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{v}}{\underline{)}}\ {\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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{v}}{\underline{)}}\ {\mathrm{w}}\ {\}}
192l: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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{\underline{)}}\ {\mathrm{v}}{\underline{)}}\ {\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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{w}}{\underline{)}}\ {\mathrm{v}}{\underline{)}}\ {\mathrm{z}}\ {\}}
195l: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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}{\underline{)}}\ {\mathrm{w}}{\underline{)}}\ {\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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}{\underline{)}}\ {\mathrm{w}}{\underline{)}}\ {\mathrm{z}}\ {\}}
198l: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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}{\underline{)}}\ {\mathrm{z}}{\underline{)}}\ {\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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{v}}{\underline{)}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{w}}\ {\}}
201l: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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{w}}{\underline{)}}\ {\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}\ {\underline{(}}{\underline{(}}{\mathrm{y}}\ {\mathrm{\underline{x}}}\ {\mathrm{z}}{\underline{)}}\ {\mathrm{w}}{\underline{)}}\ {\mathrm{w}}\ {\}}
212l: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

11h:r_adians := { (f_loat _r) * (p_i @) / 180 } # private{{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{\underline{f}loat}}\ {\_\mathrm{r}}{)}\ {\times}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {180}\ {\}}hr‾adians ← { (f‾loat _r) × (p‾i @) ÷ 180 }{{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{\underline{f}loat}}\ {\_\mathrm{r}}{)}\ {\times}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {180}\ {\}}
21l: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}
22 c := c_os h:r_adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}  c ← c‾os hr‾adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}
23 s := s_in h:r_adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}  s ← s‾in hr‾adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}
24 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}}
25}{\}}}{\}}
33l: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}
34 c := c_os h:r_adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}  c ← c‾os hr‾adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}
35 s := s_in h:r_adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}  s ← s‾in hr‾adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}
36 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}}
37}{\}}}{\}}
45l: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}
46 c := c_os h:r_adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}  c ← c‾os hr‾adians d\ \ {\mathrm{c}}\ {\leftarrow}\ {\mathrm{\underline{c}os}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}
47 s := s_in h:r_adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}  s ← s‾in hr‾adians d\ \ {\mathrm{s}}\ {\leftarrow}\ {\mathrm{\underline{s}in}}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\mathrm{d}}
48 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}
49}{\}}}{\}}
59l: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}}\ {\}}
70l: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}
71 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}}
72 (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}}
73}{\}}}{\}}
80l: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}}\ {\}}
87l: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}}\ {\}}
97l: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}
98 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}
99 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}
100}{\}}}{\}}
107l: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}\ {\}}
116l: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}}\ {\}}
123l: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

19l:n_othing := { n _u -> n }{{}^{\mathrm{l}}\mathrm{\underline{n}othing}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{n}}\ {\}}ln‾othing ← { n _u → n }{{}^{\mathrm{l}}\mathrm{\underline{n}othing}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{n}}\ {\}}
26l:j_ust := { x _u j_ -> j_ x }{{}^{\mathrm{l}}\mathrm{\underline{j}ust}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\mathrm{\underline{j}}}\ {\to}\ {\mathrm{\underline{j}}}\ {\mathrm{x}}\ {\}}lj‾ust ← { x _u j‾ → j‾ x }{{}^{\mathrm{l}}\mathrm{\underline{j}ust}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\mathrm{\underline{j}}}\ {\to}\ {\mathrm{\underline{j}}}\ {\mathrm{x}}\ {\}}
31l: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}}}\ {\}}
34l:o_r := { d m_ -> d m_ 'i_d }{{}^{\mathrm{l}}\mathrm{\underline{o}r}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\to}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\mathrm{\underline{i}d}}\ {\}}lo‾r ← { d m‾ → d m‾ ’i‾d }{{}^{\mathrm{l}}\mathrm{\underline{o}r}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\to}\ {\mathrm{d}}\ {\mathrm{\underline{m}}}\ {\text{'}}{\mathrm{\underline{i}d}}\ {\}}
37l: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}}\ {\}}\ {\}}
41l: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

14l: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}}{]}{]}
17h:s_quare := { _r * _r } # private: not visible outside{{}^{\mathrm{h}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}hs‾quare ← { _r × _r }{{}^{\mathrm{h}}\mathrm{\underline{s}quare}}\ {\leftarrow}\ {\{}\ {\_\mathrm{r}}\ {\times}\ {\_\mathrm{r}}\ {\}}
19h:d_eviations := [f_loat - l:m_ean]{{}^{\mathrm{h}}\mathrm{\underline{d}eviations}}\ {\leftarrow}\ {[}{\mathrm{\underline{f}loat}}\ {-}\ {{}^{\mathrm{l}}\mathrm{\underline{m}ean}}{]}hd‾eviations ← [f‾loat − lm‾ean]{{}^{\mathrm{h}}\mathrm{\underline{d}eviations}}\ {\leftarrow}\ {[}{\mathrm{\underline{f}loat}}\ {-}\ {{}^{\mathrm{l}}\mathrm{\underline{m}ean}}{]}
27l:v_ariance := [l:m_ean [h:s_quare h:d_eviations]]{{}^{\mathrm{l}}\mathrm{\underline{v}ariance}}\ {\leftarrow}\ {[}{{}^{\mathrm{l}}\mathrm{\underline{m}ean}}\ {[}{{}^{\mathrm{h}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{h}}\mathrm{\underline{d}eviations}}{]}{]}lv‾ariance ← [lm‾ean [hs‾quare hd‾eviations]]{{}^{\mathrm{l}}\mathrm{\underline{v}ariance}}\ {\leftarrow}\ {[}{{}^{\mathrm{l}}\mathrm{\underline{m}ean}}\ {[}{{}^{\mathrm{h}}\mathrm{\underline{s}quare}}\ {{}^{\mathrm{h}}\mathrm{\underline{d}eviations}}{]}{]}
33l: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}\ {\}}
39l:s_pread := ['m_ax r_/ - 'm_in r_/]{{}^{\mathrm{l}}\mathrm{\underline{s}pread}}\ {\leftarrow}\ {[}{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {-}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}ls‾pread ← [’m‾ax r‾/ − ’m‾in r‾/]{{}^{\mathrm{l}}\mathrm{\underline{s}pread}}\ {\leftarrow}\ {[}{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {-}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}

lib/Svg.xtl

18l: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{}""}}\ {\}}
31l: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}
32 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}}
33 h:j_oin 'h:e_sc m_ap t\ \ {{}^{\mathrm{h}}\mathrm{\underline{j}oin}}\ {\text{'}}{{}^{\mathrm{h}}\mathrm{\underline{e}sc}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{t}}  hj‾oin ’he‾sc m‾ap t\ \ {{}^{\mathrm{h}}\mathrm{\underline{j}oin}}\ {\text{'}}{{}^{\mathrm{h}}\mathrm{\underline{e}sc}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{t}}
34}{\}}}{\}}
40l: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}}\ {\}}
47l: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}
48 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}}
49 "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{")"}}
50}{\}}}{\}}
56l: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{}""}}\ {\}}
65l:p_olygon := { attrs points -> "<polygon points=\"" c_at (h: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{h}}\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 (hp‾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{h}}\mathrm{\underline{p}airs}}\ {\mathrm{points}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{"/>"}}\ {\}}
71l:p_olyline := { attrs points -> "<polyline points=\"" c_at (h: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{h}}\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 (hp‾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{h}}\mathrm{\underline{p}airs}}\ {\mathrm{points}}{)}\ {\mathrm{\underline{c}at}}\ {\text{"\textbackslash{}""}}\ {\mathrm{\underline{c}at}}\ {\mathrm{attrs}}\ {\mathrm{\underline{c}at}}\ {\text{"/>"}}\ {\}}
77l: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}}\ {\}}
84l: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>"}}\ {\}}
91l: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>"}}\ {\}}
98l: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>"}}\ {\}}
105l: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>"}}\ {\}}
114l: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>"}}\ {\}}
120l: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{")"}}\ {\}}
127l: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{")"}}\ {\}}
137l: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}
138 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}}
139 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}}
140 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}}
141 "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{")"}}
142}{\}}}{\}}
148l: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{")"}}\ {\}}
158l: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>"}}\ {\}}
164l: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}}\ {\}}
171l: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}
172 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}}
173 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}}
174 "<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>"}}
175}{\}}}{\}}
185l: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}
186 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}}
187 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}}
188 "<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>"}}
189}{\}}}{\}}
197l: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}}\ {\}}
203l:GRAY := []S_CALE 1{{}^{\mathrm{l}}\mathrm{GRAY}}\ {\leftarrow}\ {\square \mathrm{\underline{S}CALE}}\ {1}lGRAY ← □S‾CALE 1{{}^{\mathrm{l}}\mathrm{GRAY}}\ {\leftarrow}\ {\square \mathrm{\underline{S}CALE}}\ {1}
207l:HEAT := []S_CALE 2{{}^{\mathrm{l}}\mathrm{HEAT}}\ {\leftarrow}\ {\square \mathrm{\underline{S}CALE}}\ {2}lHEAT ← □S‾CALE 2{{}^{\mathrm{l}}\mathrm{HEAT}}\ {\leftarrow}\ {\square \mathrm{\underline{S}CALE}}\ {2}
214l:DIVERGING := []S_CALE 3{{}^{\mathrm{l}}\mathrm{DIVERGING}}\ {\leftarrow}\ {\square \mathrm{\underline{S}CALE}}\ {3}lDIVERGING ← □S‾CALE 3{{}^{\mathrm{l}}\mathrm{DIVERGING}}\ {\leftarrow}\ {\square \mathrm{\underline{S}CALE}}\ {3}
219h:e_sc := { c -> c = f_irst "&" ? "&amp;"; c = f_irst "<" ? "&lt;"; c = f_irst ">" ? "&gt;"; c = f_irst "\"" ? "&quot;"; c }{{}^{\mathrm{h}}\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}}\ {\}}he‾sc ← { c → c = f‾irst "&" ? "&amp;"⋄ c = f‾irst "<" ? "&lt;"⋄ c = f‾irst ">" ? "&gt;"⋄ c = f‾irst "\"" ? "&quot;"⋄ c }{{}^{\mathrm{h}}\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}}\ {\}}
222h:j_oin := { b ->{{}^{\mathrm{h}}\mathrm{\underline{j}oin}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}hj‾oin ← { b →{{}^{\mathrm{h}}\mathrm{\underline{j}oin}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\to}
223 0 = t_ally b ? ""\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{b}}\ {?}\ {\text{""}}  0 = t‾ally b ? ""\ \ {0}\ {=}\ {\mathrm{\underline{t}ally}}\ {\mathrm{b}}\ {?}\ {\text{""}}
224 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}}
225}{\}}}{\}}
228h:p_airs := { points ->{{}^{\mathrm{h}}\mathrm{\underline{p}airs}}\ {\leftarrow}\ {\{}\ {\mathrm{points}}\ {\to}hp‾airs ← { points →{{}^{\mathrm{h}}\mathrm{\underline{p}airs}}\ {\leftarrow}\ {\{}\ {\mathrm{points}}\ {\to}
229 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}}
230 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}}
231 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}}
232 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}}
233}{\}}}{\}}

lib/TTTML.xtl

22l: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"}}\ {\}}
26l: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}
37l: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}
38 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}}
39 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}
40}{\}}}{\}}
46l: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}
55l: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}}\ {\}}
62l: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}
69l: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}\ {\}}
75l: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}}\ {\}}
82l: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}}\ {\}}
88l: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}
89 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}
90 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}}
91 (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}}
92}{\}}}{\}}
97h:p_ick! := { m s ->{{}^{\mathrm{h}}\mathrm{\underline{p}ick}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{s}}\ {\to}hp‾ick! ← { m s →{{}^{\mathrm{h}}\mathrm{\underline{p}ick}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{s}}\ {\to}
98 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}
99 (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}}
100}{\}}}{\}}
103h:p_lay! := { m g ->{{}^{\mathrm{h}}\mathrm{\underline{p}lay}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}hp‾lay! ← { m g →{{}^{\mathrm{h}}\mathrm{\underline{p}lay}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}
104 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}}
105 played := g c_at 1 9 r_eshape s l:a_fter m h:p_ick! s\ \ {\mathrm{played}}\ {\leftarrow}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{p}ick}{!}}\ {\mathrm{s}}  played ← g c‾at 1 9 r‾eshape s la‾fter m hp‾ick! s\ \ {\mathrm{played}}\ {\leftarrow}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{p}ick}{!}}\ {\mathrm{s}}
106 0 = l:o_utcome (t_ally played) s_elect played ? m h:p_lay! played; played\ \ {0}\ {=}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{played}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{played}}\ {?}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{p}lay}{!}}\ {\mathrm{played}}{\diamond}\ {\mathrm{played}}  0 = lo‾utcome (t‾ally played) s‾elect played ? m hp‾lay! played⋄ played\ \ {0}\ {=}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{played}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{played}}\ {?}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{p}lay}{!}}\ {\mathrm{played}}{\diamond}\ {\mathrm{played}}
107}{\}}}{\}}
110l:g_ame! := { m -> m h:p_lay! 1 9 r_eshape 0 }{{}^{\mathrm{l}}\mathrm{\underline{g}ame}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{p}lay}{!}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}lg‾ame! ← { m → m hp‾lay! 1 9 r‾eshape 0 }{{}^{\mathrm{l}}\mathrm{\underline{g}ame}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{p}lay}{!}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}
116h:r_esult := { g j ->{{}^{\mathrm{h}}\mathrm{\underline{r}esult}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{j}}\ {\to}hr‾esult ← { g j →{{}^{\mathrm{h}}\mathrm{\underline{r}esult}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{j}}\ {\to}
117 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}}
118 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}}
119 (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}
120}{\}}}{\}}
124h:t_arget := { g m j ->{{}^{\mathrm{h}}\mathrm{\underline{t}arget}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{m}}\ {\mathrm{j}}\ {\to}ht‾arget ← { g m j →{{}^{\mathrm{h}}\mathrm{\underline{t}arget}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{m}}\ {\mathrm{j}}\ {\to}
125 j >= (t_ally g) - 2 ? g h: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{h}}\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 hr‾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{h}}\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}}
126}{\}}}{\}}
129h:b_ack := { g m j ->{{}^{\mathrm{h}}\mathrm{\underline{b}ack}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{m}}\ {\mathrm{j}}\ {\to}hb‾ack ← { g m j →{{}^{\mathrm{h}}\mathrm{\underline{b}ack}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\mathrm{m}}\ {\mathrm{j}}\ {\to}
130 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}}
131 d := 0.2 * ((g h:t_arget m)_ j) - m l:v_alue (j + 1) s_elect g\ \ {\mathrm{d}}\ {\leftarrow}\ {0.2}\ {\times}\ {(}{\underline{(}}{\mathrm{g}}\ {{}^{\mathrm{h}}\mathrm{\underline{t}arget}}\ {\mathrm{m}}{\underline{)}}\ {\mathrm{j}}{)}\ {-}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alue}}\ {(}{\mathrm{j}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  d ← 0.2 × ((‾g ht‾arget m)‾ j) − m lv‾alue (j + 1) s‾elect g\ \ {\mathrm{d}}\ {\leftarrow}\ {0.2}\ {\times}\ {(}{\underline{(}}{\mathrm{g}}\ {{}^{\mathrm{h}}\mathrm{\underline{t}arget}}\ {\mathrm{m}}{\underline{)}}\ {\mathrm{j}}{)}\ {-}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{v}alue}}\ {(}{\mathrm{j}}\ {+}\ {1}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
132 learned := m + (0.0 c_at d) '* t_able f_loat (r_ange t_ally 1 s_elect m) = k\ \ {\mathrm{learned}}\ {\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}}  learned ← m + (0.0 c‾at d) ’× t‾able f‾loat (r‾ange t‾ally 1 s‾elect m) = k\ \ {\mathrm{learned}}\ {\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}}
133 j = 1 ? learned; (g h:b_ack learned)_ j - 1\ \ {\mathrm{j}}\ {=}\ {1}\ {?}\ {\mathrm{learned}}{\diamond}\ {\underline{(}}{\mathrm{g}}\ {{}^{\mathrm{h}}\mathrm{\underline{b}ack}}\ {\mathrm{learned}}{\underline{)}}\ {\mathrm{j}}\ {-}\ {1}  j = 1 ? learned⋄ (‾g hb‾ack learned)‾ j − 1\ \ {\mathrm{j}}\ {=}\ {1}\ {?}\ {\mathrm{learned}}{\diamond}\ {\underline{(}}{\mathrm{g}}\ {{}^{\mathrm{h}}\mathrm{\underline{b}ack}}\ {\mathrm{learned}}{\underline{)}}\ {\mathrm{j}}\ {-}\ {1}
134}{\}}}{\}}
137h:m_eet := { m g ->{{}^{\mathrm{h}}\mathrm{\underline{m}eet}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}hm‾eet ← { m g →{{}^{\mathrm{h}}\mathrm{\underline{m}eet}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}
138 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}}
139 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}}
140 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}}
141 (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}}
142}{\}}}{\}}
149l:l_earn := { m g -> (g h:b_ack m h:m_eet g)_ (t_ally g) - 1 }{{}^{\mathrm{l}}\mathrm{\underline{l}earn}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}\ {\underline{(}}{\mathrm{g}}\ {{}^{\mathrm{h}}\mathrm{\underline{b}ack}}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{m}eet}}\ {\mathrm{g}}{\underline{)}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {-}\ {1}\ {\}}ll‾earn ← { m g → (‾g hb‾ack m hm‾eet g)‾ (t‾ally g) − 1 }{{}^{\mathrm{l}}\mathrm{\underline{l}earn}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}\ {\underline{(}}{\mathrm{g}}\ {{}^{\mathrm{h}}\mathrm{\underline{b}ack}}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{m}eet}}\ {\mathrm{g}}{\underline{)}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{g}}{)}\ {-}\ {1}\ {\}}
160h:r_ound! := { m -> m l:l_earn l:g_ame! m }{{}^{\mathrm{h}}\mathrm{\underline{r}ound}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{l}earn}}\ {{}^{\mathrm{l}}\mathrm{\underline{g}ame}{!}}\ {\mathrm{m}}\ {\}}hr‾ound! ← { m → m ll‾earn lg‾ame! m }{{}^{\mathrm{h}}\mathrm{\underline{r}ound}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{l}}\mathrm{\underline{l}earn}}\ {{}^{\mathrm{l}}\mathrm{\underline{g}ame}{!}}\ {\mathrm{m}}\ {\}}
163h:l_oop! := { n m ->{{}^{\mathrm{h}}\mathrm{\underline{l}oop}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}hl‾oop! ← { n m →{{}^{\mathrm{h}}\mathrm{\underline{l}oop}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}
164 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}}
165 trained := k 'h:r_ound! p_ower m\ \ {\mathrm{trained}}\ {\leftarrow}\ {\mathrm{k}}\ {\text{'}}{{}^{\mathrm{h}}\mathrm{\underline{r}ound}{!}}\ {\mathrm{\underline{p}ower}}\ {\mathrm{m}}  trained ← k ’hr‾ound! p‾ower m\ \ {\mathrm{trained}}\ {\leftarrow}\ {\mathrm{k}}\ {\text{'}}{{}^{\mathrm{h}}\mathrm{\underline{r}ound}{!}}\ {\mathrm{\underline{p}ower}}\ {\mathrm{m}}
166 _ := p_rint! (n - k) c_at t_ally 1 s_elect trained\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{trained}}  _ ← p‾rint! (n − k) c‾at t‾ally 1 s‾elect trained\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{k}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{t}ally}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{trained}}
167 n = k ? trained; (n - k) h:l_oop! trained\ \ {\mathrm{n}}\ {=}\ {\mathrm{k}}\ {?}\ {\mathrm{trained}}{\diamond}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{k}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{l}oop}{!}}\ {\mathrm{trained}}  n = k ? trained⋄ (n − k) hl‾oop! trained\ \ {\mathrm{n}}\ {=}\ {\mathrm{k}}\ {?}\ {\mathrm{trained}}{\diamond}\ {(}{\mathrm{n}}\ {-}\ {\mathrm{k}}{)}\ {{}^{\mathrm{h}}\mathrm{\underline{l}oop}{!}}\ {\mathrm{trained}}
168}{\}}}{\}}
173l: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}
174 _ := p_rint! "games to go, positions known:"\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"games to go, positions known:"}}  _ ← p‾rint! "games to go, positions known:"\ \ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\text{"games to go, positions known:"}}
175 n h:l_oop! m\ \ {\mathrm{n}}\ {{}^{\mathrm{h}}\mathrm{\underline{l}oop}{!}}\ {\mathrm{m}}  n hl‾oop! m\ \ {\mathrm{n}}\ {{}^{\mathrm{h}}\mathrm{\underline{l}oop}{!}}\ {\mathrm{m}}
176}{\}}}{\}}
183h:t_urn! := { m side s ->{{}^{\mathrm{h}}\mathrm{\underline{t}urn}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{s}}\ {\to}ht‾urn! ← { m side s →{{}^{\mathrm{h}}\mathrm{\underline{t}urn}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{s}}\ {\to}
184 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}
185 (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}}
186}{\}}}{\}}
189h:v_ersus! := { m side s ->{{}^{\mathrm{h}}\mathrm{\underline{v}ersus}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{s}}\ {\to}hv‾ersus! ← { m side s →{{}^{\mathrm{h}}\mathrm{\underline{v}ersus}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{s}}\ {\to}
190 played := s l:a_fter ((m h:t_urn! side)_ s)\ \ {\mathrm{played}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {(}{\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{t}urn}{!}}\ {\mathrm{side}}{\underline{)}}\ {\mathrm{s}}{)}  played ← s la‾fter ((‾m ht‾urn! side)‾ s)\ \ {\mathrm{played}}\ {\leftarrow}\ {\mathrm{s}}\ {{}^{\mathrm{l}}\mathrm{\underline{a}fter}}\ {(}{\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{t}urn}{!}}\ {\mathrm{side}}{\underline{)}}\ {\mathrm{s}}{)}
191 w := l:o_utcome played\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {\mathrm{played}}  w ← lo‾utcome played\ \ {\mathrm{w}}\ {\leftarrow}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {\mathrm{played}}
192 w = 0 ? ((m h:v_ersus! side)_ played); w\ \ {\mathrm{w}}\ {=}\ {0}\ {?}\ {(}{\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{v}ersus}{!}}\ {\mathrm{side}}{\underline{)}}\ {\mathrm{played}}{)}{\diamond}\ {\mathrm{w}}  w = 0 ? ((‾m hv‾ersus! side)‾ played)⋄ w\ \ {\mathrm{w}}\ {=}\ {0}\ {?}\ {(}{\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{v}ersus}{!}}\ {\mathrm{side}}{\underline{)}}\ {\mathrm{played}}{)}{\diamond}\ {\mathrm{w}}
193}{\}}}{\}}
196h:c_ount! := { m side n ->{{}^{\mathrm{h}}\mathrm{\underline{c}ount}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{n}}\ {\to}hc‾ount! ← { m side n →{{}^{\mathrm{h}}\mathrm{\underline{c}ount}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{side}}\ {\mathrm{n}}\ {\to}
197 w := '{ _u -> ((m h:v_ersus! side)_ 9 r_eshape 0) } e_ach r_ange n\ \ {\mathrm{w}}\ {\leftarrow}\ {\text{'}}{\{}\ {\_\mathrm{u}}\ {\to}\ {(}{\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{v}ersus}{!}}\ {\mathrm{side}}{\underline{)}}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  w ← ’{ _u → ((‾m hv‾ersus! side)‾ 9 r‾eshape 0) } e‾ach r‾ange n\ \ {\mathrm{w}}\ {\leftarrow}\ {\text{'}}{\{}\ {\_\mathrm{u}}\ {\to}\ {(}{\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{v}ersus}{!}}\ {\mathrm{side}}{\underline{)}}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}{)}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
198 '+ 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}
199}{\}}}{\}}
202l:t_rial! := { n m -> 2 3 r_eshape ((m h:c_ount! 1)_ n) c_at (m h:c_ount! -1)_ n }{{}^{\mathrm{l}}\mathrm{\underline{t}rial}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {(}{\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{c}ount}{!}}\ {1}{\underline{)}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{c}ount}{!}}\ {-1}{\underline{)}}\ {\mathrm{n}}\ {\}}lt‾rial! ← { n m → 2 3 r‾eshape ((‾m hc‾ount! 1)‾ n) c‾at (‾m hc‾ount! −1)‾ n }{{}^{\mathrm{l}}\mathrm{\underline{t}rial}{!}}\ {\leftarrow}\ {\{}\ {\mathrm{n}}\ {\mathrm{m}}\ {\to}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {(}{\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{c}ount}{!}}\ {1}{\underline{)}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {\underline{(}}{\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{c}ount}{!}}\ {-1}{\underline{)}}\ {\mathrm{n}}\ {\}}
208h:g_reedy := { m g ->{{}^{\mathrm{h}}\mathrm{\underline{g}reedy}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}hg‾reedy ← { m g →{{}^{\mathrm{h}}\mathrm{\underline{g}reedy}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\mathrm{g}}\ {\to}
209 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}}
210 played := g c_at 1 9 r_eshape s l:a_fter m l:c_hoose s\ \ {\mathrm{played}}\ {\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}}  played ← g c‾at 1 9 r‾eshape s la‾fter m lc‾hoose s\ \ {\mathrm{played}}\ {\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}}
211 0 = l:o_utcome (t_ally played) s_elect played ? m h:g_reedy played; played\ \ {0}\ {=}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{played}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{played}}\ {?}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{g}reedy}}\ {\mathrm{played}}{\diamond}\ {\mathrm{played}}  0 = lo‾utcome (t‾ally played) s‾elect played ? m hg‾reedy played⋄ played\ \ {0}\ {=}\ {{}^{\mathrm{l}}\mathrm{\underline{o}utcome}}\ {(}{\mathrm{\underline{t}ally}}\ {\mathrm{played}}{)}\ {\mathrm{\underline{s}elect}}\ {\mathrm{played}}\ {?}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{g}reedy}}\ {\mathrm{played}}{\diamond}\ {\mathrm{played}}
212}{\}}}{\}}
215l:b_est := { m -> m h:g_reedy 1 9 r_eshape 0 }{{}^{\mathrm{l}}\mathrm{\underline{b}est}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{g}reedy}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}lb‾est ← { m → m hg‾reedy 1 9 r‾eshape 0 }{{}^{\mathrm{l}}\mathrm{\underline{b}est}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{g}reedy}}\ {1}\ {9}\ {\mathrm{\underline{r}eshape}}\ {0}\ {\}}
219l: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}
220 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}}
221 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}
222 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}
223 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}
224 (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 "}}
225}{\}}}{\}}
229h:o_pening! := { @ -> 2 9 r_eshape (9 r_eshape 0) c_at 1 * (r_ange 9) = r_oll! 9 }{{}^{\mathrm{h}}\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}\ {\}}ho‾pening! ← { @ → 2 9 r‾eshape (9 r‾eshape 0) c‾at 1 × (r‾ange 9) = r‾oll! 9 }{{}^{\mathrm{h}}\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}\ {\}}
231h:f_inal := { g -> l:o_utcome (t_ally g) s_elect g }{{}^{\mathrm{h}}\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}}\ {\}}hf‾inal ← { g → lo‾utcome (t‾ally g) s‾elect g }{{}^{\mathrm{h}}\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}}\ {\}}
237l: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}
238 w := '{ _u -> h:f_inal m h:g_reedy h:o_pening! @ } e_ach r_ange n\ \ {\mathrm{w}}\ {\leftarrow}\ {\text{'}}{\{}\ {\_\mathrm{u}}\ {\to}\ {{}^{\mathrm{h}}\mathrm{\underline{f}inal}}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{g}reedy}}\ {{}^{\mathrm{h}}\mathrm{\underline{o}pening}{!}}\ {@}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}  w ← ’{ _u → hf‾inal m hg‾reedy ho‾pening! @ } e‾ach r‾ange n\ \ {\mathrm{w}}\ {\leftarrow}\ {\text{'}}{\{}\ {\_\mathrm{u}}\ {\to}\ {{}^{\mathrm{h}}\mathrm{\underline{f}inal}}\ {\mathrm{m}}\ {{}^{\mathrm{h}}\mathrm{\underline{g}reedy}}\ {{}^{\mathrm{h}}\mathrm{\underline{o}pening}{!}}\ {@}\ {\}}\ {\mathrm{\underline{e}ach}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{n}}
239 '+ 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}
240}{\}}}{\}}

lib/Terminal.xtl

13l: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}
16l: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}
19l: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}
22l: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}
25l: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}
28l: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}
31l: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}
34l: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}
39l: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}
42l: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}
45l: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}
48l: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}
51l: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}
54l: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}
57l: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}
60l: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}
63l: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}
66l: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}
69l: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

11h:r_adians := { (f_loat _r) * (p_i @) / 180 } # private{{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{\underline{f}loat}}\ {\_\mathrm{r}}{)}\ {\times}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {180}\ {\}}hr‾adians ← { (f‾loat _r) × (p‾i @) ÷ 180 }{{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{\underline{f}loat}}\ {\_\mathrm{r}}{)}\ {\times}\ {(}{\mathrm{\underline{p}i}}\ {@}{)}\ {\div}\ {180}\ {\}}
22l: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}
23 h := h:r_adians '+ s_\ turns\ \ {\mathrm{h}}\ {\leftarrow}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{turns}}  h ← hr‾adians ’+ s‾\ turns\ \ {\mathrm{h}}\ {\leftarrow}\ {{}^{\mathrm{h}}\mathrm{\underline{r}adians}}\ {\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{turns}}
24 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}}
25 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}}
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}{\}}}{\}}
34l: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}}\ {\}}
43l: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}}\ {\}}
50l: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

8h:n_ame := { @ -> "X̲ᵉTᵃL" } # private{{}^{\mathrm{h}}\mathrm{\underline{n}ame}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\text{"\underline{X}ᵉTᵃL"}}\ {\}}hn‾ame ← { @ → "X‾ᵉTᵃL" }{{}^{\mathrm{h}}\mathrm{\underline{n}ame}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {\text{"\underline{X}ᵉTᵃL"}}\ {\}}
15l:g_reet := { g -> g c_at " " c_at h: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{h}}\mathrm{\underline{n}ame}}\ {@}\ {\}}lg‾reet ← { g → g c‾at " " c‾at hn‾ame @ }{{}^{\mathrm{l}}\mathrm{\underline{g}reet}}\ {\leftarrow}\ {\{}\ {\mathrm{g}}\ {\to}\ {\mathrm{g}}\ {\mathrm{\underline{c}at}}\ {\text{" "}}\ {\mathrm{\underline{c}at}}\ {{}^{\mathrm{h}}\mathrm{\underline{n}ame}}\ {@}\ {\}}

userlibs/Hello.xtl

12l: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)_ '+{\underline{(}}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{\underline{)}}\ {\text{'}}{+}(‾3 cV‾ 4)‾ ’+{\underline{(}}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{\underline{)}}\ {\text{'}}{+}
141(3 c:V_ 4)_ 'u:a_b{\underline{(}}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}(‾3 cV‾ 4)‾ ’ua‾b{\underline{(}}{3}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {4}{\underline{)}}\ {\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{\underline{(}}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {{}^{\mathrm{u}}\mathrm{\underline{M}}}{\underline{)}}\ {42}(‾’uI‾ uM‾)‾ 42{\underline{(}}{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{I}}}\ {{}^{\mathrm{u}}\mathrm{\underline{M}}}{\underline{)}}\ {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{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {5}(‾uY‾ ’uF‾)‾ 5{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {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}{\}}}{\}}
323_ := []S_HOW []G_RID (4 r_eshape 1) u:p_lay 4 u:h_anoi 1 3 2{\_}\ {\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}_ ← □S‾HOW □G‾RID (4 r‾eshape 1) up‾lay 4 uh‾anoi 1 3 2{\_}\ {\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}
348edges := 4 4 r_eshape 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0{\mathrm{edges}}\ {\leftarrow}\ {4}\ {4}\ {\mathrm{\underline{r}eshape}}\ {0}\ {1}\ {0}\ {0}\ \ {0}\ {0}\ {1}\ {0}\ \ {0}\ {0}\ {0}\ {1}\ \ {0}\ {0}\ {0}\ {0}edges ← 4 4 r‾eshape 0 1 0 0  0 0 1 0  0 0 0 1  0 0 0 0{\mathrm{edges}}\ {\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 edges{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{edges}}uc‾losure edges{{}^{\mathrm{u}}\mathrm{\underline{c}losure}}\ {\mathrm{edges}}
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}
395_ := []S_HOW []G_RID g u:w_arshallSteps 1{\_}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{g}}\ {{}^{\mathrm{u}}\mathrm{\underline{w}arshallSteps}}\ {1}_ ← □S‾HOW □G‾RID g uw‾arshallSteps 1{\_}\ {\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}}
531_ := []S_HOW []G_RID tall{\_}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{tall}}_ ← □S‾HOW □G‾RID tall{\_}\ {\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}
758size := 1 s_elect 1 d_rop s_hape arrowhead{\mathrm{size}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{arrowhead}}size ← 1 s‾elect 1 d‾rop s‾hape arrowhead{\mathrm{size}}\ {\leftarrow}\ {1}\ {\mathrm{\underline{s}elect}}\ {1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{\underline{s}hape}}\ {\mathrm{arrowhead}}
759u:u_pTo := { k -> ((f_loor k * size / 24) m_in r_ange size) s_elect_2 arrowhead }{{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{f}loor}}\ {\mathrm{k}}\ {\times}\ {\mathrm{size}}\ {\div}\ {24}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{size}}{)}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{arrowhead}}\ {\}}uu‾pTo ← { k → ((f‾loor k × size ÷ 24) m‾in r‾ange size) s‾elect2 arrowhead }{{}^{\mathrm{u}}\mathrm{\underline{u}pTo}}\ {\leftarrow}\ {\{}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{f}loor}}\ {\mathrm{k}}\ {\times}\ {\mathrm{size}}\ {\div}\ {24}{)}\ {\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}ange}}\ {\mathrm{size}}{)}\ {{\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}{\}}}{\}}
764size{\mathrm{size}}size{\mathrm{size}}
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}}
104_ := []S_HOW []G_RID frames{\_}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{frames}}_ ← □S‾HOW □G‾RID frames{\_}\ {\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}}
212_ := []S_HOW []G_RID swim{\_}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {\square \mathrm{\underline{G}RID}}\ {\mathrm{swim}}_ ← □S‾HOW □G‾RID swim{\_}\ {\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}\ {\underline{(}}{\underline{(}}{(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\mathrm{from}}{\underline{)}}\ {\mathrm{via}}{\underline{)}}\ {\mathrm{to}}  a ← (‾(‾(n − 1) uh‾ from)‾ via)‾ to\ \ {\mathrm{a}}\ {\leftarrow}\ {\underline{(}}{\underline{(}}{(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\mathrm{from}}{\underline{)}}\ {\mathrm{via}}{\underline{)}}\ {\mathrm{to}}
109 b := (((n - 1) u:h_ via)_ to)_ from\ \ {\mathrm{b}}\ {\leftarrow}\ {\underline{(}}{\underline{(}}{(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\mathrm{via}}{\underline{)}}\ {\mathrm{to}}{\underline{)}}\ {\mathrm{from}}  b ← (‾(‾(n − 1) uh‾ via)‾ to)‾ from\ \ {\mathrm{b}}\ {\leftarrow}\ {\underline{(}}{\underline{(}}{(}{\mathrm{n}}\ {-}\ {1}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {\mathrm{via}}{\underline{)}}\ {\mathrm{to}}{\underline{)}}\ {\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{\underline{(}}{\underline{(}}{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {1}{\underline{)}}\ {3}{\underline{)}}\ {2}(‾(‾3 uh‾ 1)‾ 3)‾ 2{\underline{(}}{\underline{(}}{3}\ {{}^{\mathrm{u}}\mathrm{\underline{h}}}\ {1}{\underline{)}}\ {3}{\underline{)}}\ {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{(}{\underline{(}}{\underline{(}}{6}\ {{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {1}{\underline{)}}\ {3}{\underline{)}}\ {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{(}{\underline{(}}{\underline{(}}{6}\ {{}^{\mathrm{u}}\mathrm{\underline{h}c}}\ {1}{\underline{)}}\ {3}{\underline{)}}\ {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"hi:" u_se< "Hello"{\text{"hi:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}"hi:" u‾se< "Hello"{\text{"hi:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}
47hi:h_ello @{{}^{\mathrm{hi}}\mathrm{\underline{h}ello}}\ {@}hih‾ello @{{}^{\mathrm{hi}}\mathrm{\underline{h}ello}}\ {@}
118"g:" u_se< "Greetings"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Greetings"}}"g:" u‾se< "Greetings"{\text{"g:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Greetings"}}
119g:g_reet "hi"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"hi"}}gg‾reet "hi"{{}^{\mathrm{g}}\mathrm{\underline{g}reet}}\ {\text{"hi"}}
120g: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:s_pread 3 9 1 7{{}^{\mathrm{s}}\mathrm{\underline{s}pread}}\ {3}\ {9}\ {1}\ {7}ss‾pread 3 9 1 7{{}^{\mathrm{s}}\mathrm{\underline{s}pread}}\ {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\}\}"}}
200@ c_fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}@ c‾fg< "cli"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"cli"}}
201@ c_fg< "web"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"web"}}@ c‾fg< "web"{@}\ {\mathrm{\underline{c}fg}{<}}\ {\text{"web"}}
234"m:" u_se< "Macros"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}"m:" u‾se< "Macros"{\text{"m:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Macros"}}
235"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"}}
236u:s_quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}us‾quare 7{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {7}
237"4 = 2 + 2" m:t_est< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{t}est}{<}}\ {\text{"addition"}}"4 = 2 + 2" mt‾est< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{t}est}{<}}\ {\text{"addition"}}
238"5 = 2 * 2" m:t_est< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{t}est}{<}}\ {\text{"doubling"}}"5 = 2 * 2" mt‾est< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{m}}\mathrm{\underline{t}est}{<}}\ {\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}}
118_ := []S_HOW u:p_icture rest{\_}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{rest}}_ ← □S‾HOW up‾icture rest{\_}\ {\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}
144_ := []S_HOW u:p_icture turned{\_}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{turned}}_ ← □S‾HOW up‾icture turned{\_}\ {\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}
161_ := []S_HOW u:p_icture rolled{\_}\ {\leftarrow}\ {\square \mathrm{\underline{S}HOW}}\ {{}^{\mathrm{u}}\mathrm{\underline{p}icture}}\ {\mathrm{rolled}}_ ← □S‾HOW up‾icture rolled{\_}\ {\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}}
213"cm:" u_se< "Comparison"{\text{"cm:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Comparison"}}"cm:" u‾se< "Comparison"{\text{"cm:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Comparison"}}
214s0 := 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}
215s0{\mathrm{s0}}s0{\mathrm{s0}}
237chosen := (cm:TOP, 7) cm:c_hoose s0{\mathrm{chosen}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {7}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s0}}chosen ← (cmTOP, 7) cmc‾hoose s0{\mathrm{chosen}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {7}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s0}}
238cm: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}}
239cm:TOP cm:s_teps chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}teps}}\ {\mathrm{chosen}}cmTOP cms‾teps chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}teps}}\ {\mathrm{chosen}}
240cm:TOP cm:a_ngle chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{chosen}}cmTOP cma‾ngle chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {\mathrm{chosen}}
241cm:TOP cm:a_ngle 0.1 cm:t_ick chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{chosen}}cmTOP cma‾ngle 0.1 cmt‾ick chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{chosen}}
242cm:TOP cm:a_ngle 0.1 cm:t_ick 0.1 cm:t_ick chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{chosen}}cmTOP cma‾ngle 0.1 cmt‾ick 0.1 cmt‾ick chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {\mathrm{chosen}}
243cm:TOP cm:a_ngle cm:s_ettle chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}ettle}}\ {\mathrm{chosen}}cmTOP cma‾ngle cms‾ettle chosen{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}ettle}}\ {\mathrm{chosen}}
271stepped := (cm:BOTTOM, 1) cm:s_tep (cm:TOP, 2) cm:c_hoose s0{\mathrm{stepped}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}{,}\ {1}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tep}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {2}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s0}}stepped ← (cmBOTTOM, 1) cms‾tep (cmTOP, 2) cmc‾hoose s0{\mathrm{stepped}}\ {\leftarrow}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}{,}\ {1}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tep}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {2}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s0}}
272cm: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}}
273cm:BOTTOM cm:c_urrent (cm:BOTTOM, 2) cm:c_hoose stepped{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}{,}\ {2}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{stepped}}cmBOTTOM cmc‾urrent (cmBOTTOM, 2) cmc‾hoose stepped{{}^{\mathrm{cm}}\mathrm{BOTTOM}}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}urrent}}\ {(}{{}^{\mathrm{cm}}\mathrm{BOTTOM}}{,}\ {2}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{stepped}}
301u: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}}\ {\}}
302u: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}}\ {\}}
303u: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}}\ {\}}
3048 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 ~_u -> a } # `_u` is a parameter nothing reads; the{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{a}}\ {\}}uk‾eep ← { a ∼_u → a }{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{a}}\ {\}}
4987 u:k_eep 1 / 0 # tilde makes it lazy: 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{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {100}{\underline{)}}\ {1}(‾us‾ub 100)‾ 1{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {100}{\underline{)}}\ {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:s_pread 3 1 4 1 5 # largest minus smallest{{}^{\mathrm{s}}\mathrm{\underline{s}pread}}\ {3}\ {1}\ {4}\ {1}\ {5}ss‾pread 3 1 4 1 5{{}^{\mathrm{s}}\mathrm{\underline{s}pread}}\ {3}\ {1}\ {4}\ {1}\ {5}
1259"hi:" u_se< "Hello" # a library of your own, found in userlibs/{\text{"hi:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}"hi:" u‾se< "Hello"{\text{"hi:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Hello"}}
1260hi:h_ello @ # niladic: called with Unit{{}^{\mathrm{hi}}\mathrm{\underline{h}ello}}\ {@}hih‾ello @{{}^{\mathrm{hi}}\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}
1363(1 2 3, 4.5, "abc") # a tuple: several values of their own types side by side{(}{1}\ {2}\ {3}{,}\ {4.5}{,}\ {\text{"abc"}}{)}(1 2 3, 4.5, "abc"){(}{1}\ {2}\ {3}{,}\ {4.5}{,}\ {\text{"abc"}}{)}
1380u:s_wapped := { (a, b) -> (b, a) }{{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\to}\ {(}{\mathrm{b}}{,}\ {\mathrm{a}}{)}\ {\}}us‾wapped ← { (a, b) → (b, a) }{{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\to}\ {(}{\mathrm{b}}{,}\ {\mathrm{a}}{)}\ {\}}
1381u:s_wapped (1, "x"){{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {(}{1}{,}\ {\text{"x"}}{)}us‾wapped (1, "x"){{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {(}{1}{,}\ {\text{"x"}}{)}
1393(n, (x, _)) := (3, (2.5, "unused")) # a pattern binds names; _ ignores a part{(}{\mathrm{n}}{,}\ {(}{\mathrm{x}}{,}\ {\_}{)}{)}\ {\leftarrow}\ {(}{3}{,}\ {(}{2.5}{,}\ {\text{"unused"}}{)}{)}(n, (x, _)) ← (3, (2.5, "unused")){(}{\mathrm{n}}{,}\ {(}{\mathrm{x}}{,}\ {\_}{)}{)}\ {\leftarrow}\ {(}{3}{,}\ {(}{2.5}{,}\ {\text{"unused"}}{)}{)}
1394x * f_loat n{\mathrm{x}}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}x × f‾loat n{\mathrm{x}}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}
1411u:s_tep := { (w, k) -> (w * 0.5, k + 1) }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{w}}{,}\ {\mathrm{k}}{)}\ {\to}\ {(}{\mathrm{w}}\ {\times}\ {0.5}{,}\ {\mathrm{k}}\ {+}\ {1}{)}\ {\}}us‾tep ← { (w, k) → (w × 0.5, k + 1) }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{w}}{,}\ {\mathrm{k}}{)}\ {\to}\ {(}{\mathrm{w}}\ {\times}\ {0.5}{,}\ {\mathrm{k}}\ {+}\ {1}{)}\ {\}}
14123 'u:s_tep p_ower (8.0 4.0, 0){3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{8.0}\ {4.0}{,}\ {0}{)}3 ’us‾tep p‾ower (8.0 4.0, 0){3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{8.0}\ {4.0}{,}\ {0}{)}
1428(1, 2.5) m_atch (1, 2.5) # m_atch compares tuples part by part{(}{1}{,}\ {2.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}{,}\ {2.5}{)}(1, 2.5) m‾atch (1, 2.5){(}{1}{,}\ {2.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}{,}\ {2.5}{)}
1429'{ k -> (k, f_loat k) } m_ap 1 2 # boxed tuples: an array of tuples{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}’{ k → (k, f‾loat k) } m‾ap 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}
1453u: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}}\ {\}}
1454u: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}
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 '+ c:P_hi 1 2 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{+}\ {{}^{\mathrm{c}}\mathrm{\underline{P}hi}}\ {1}\ {2}\ {3}’us‾quare ’n‾eg ’+ cP‾hi 1 2 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}quare}}\ {\text{'}}{\mathrm{\underline{n}eg}}\ {\text{'}}{+}\ {{}^{\mathrm{c}}\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}
253[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}
268[[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/literate/tuples.org

27(1 2 3, 4.5, "abc"){(}{1}\ {2}\ {3}{,}\ {4.5}{,}\ {\text{"abc"}}{)}(1 2 3, 4.5, "abc"){(}{1}\ {2}\ {3}{,}\ {4.5}{,}\ {\text{"abc"}}{)}
45(n, (x, _)) := (3, (2.5, "unused")){(}{\mathrm{n}}{,}\ {(}{\mathrm{x}}{,}\ {\_}{)}{)}\ {\leftarrow}\ {(}{3}{,}\ {(}{2.5}{,}\ {\text{"unused"}}{)}{)}(n, (x, _)) ← (3, (2.5, "unused")){(}{\mathrm{n}}{,}\ {(}{\mathrm{x}}{,}\ {\_}{)}{)}\ {\leftarrow}\ {(}{3}{,}\ {(}{2.5}{,}\ {\text{"unused"}}{)}{)}
46x * f_loat n{\mathrm{x}}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}x × f‾loat n{\mathrm{x}}\ {\times}\ {\mathrm{\underline{f}loat}}\ {\mathrm{n}}
47u:s_wapped := { (a, b) -> (b, a) }{{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\to}\ {(}{\mathrm{b}}{,}\ {\mathrm{a}}{)}\ {\}}us‾wapped ← { (a, b) → (b, a) }{{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\to}\ {(}{\mathrm{b}}{,}\ {\mathrm{a}}{)}\ {\}}
48u:s_wapped (1, "x"){{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {(}{1}{,}\ {\text{"x"}}{)}us‾wapped (1, "x"){{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {(}{1}{,}\ {\text{"x"}}{)}
73target1 := 1.0 2.0 3.0{\mathrm{target1}}\ {\leftarrow}\ {1.0}\ {2.0}\ {3.0}target1 ← 1.0 2.0 3.0{\mathrm{target1}}\ {\leftarrow}\ {1.0}\ {2.0}\ {3.0}
74target2 := 2 2 r_eshape 0.5 -0.5 0.25 -0.25{\mathrm{target2}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0.5}\ {-0.5}\ {0.25}\ {-0.25}target2 ← 2 2 r‾eshape 0.5 −0.5 0.25 −0.25{\mathrm{target2}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0.5}\ {-0.5}\ {0.25}\ {-0.25}
75u:g_rad := { W1 W2 -> (e_nclose 2.0 * W1 - target1) c_at e_nclose 2.0 * W2 - target2 }{{}^{\mathrm{u}}\mathrm{\underline{g}rad}}\ {\leftarrow}\ {\{}\ {\mathrm{W1}}\ {\mathrm{W2}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {2.0}\ {\times}\ {\mathrm{W1}}\ {-}\ {\mathrm{target1}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {2.0}\ {\times}\ {\mathrm{W2}}\ {-}\ {\mathrm{target2}}\ {\}}ug‾rad ← { W1 W2 → (e‾nclose 2.0 × W1 − target1) c‾at e‾nclose 2.0 × W2 − target2 }{{}^{\mathrm{u}}\mathrm{\underline{g}rad}}\ {\leftarrow}\ {\{}\ {\mathrm{W1}}\ {\mathrm{W2}}\ {\to}\ {(}{\mathrm{\underline{e}nclose}}\ {2.0}\ {\times}\ {\mathrm{W1}}\ {-}\ {\mathrm{target1}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {2.0}\ {\times}\ {\mathrm{W2}}\ {-}\ {\mathrm{target2}}\ {\}}
76lr := 0.1{\mathrm{lr}}\ {\leftarrow}\ {0.1}lr ← 0.1{\mathrm{lr}}\ {\leftarrow}\ {0.1}
77u:r_ound := { a -> (f_loat f_loor 0.5 + 1000.0 * a) / 1000.0 }{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\to}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {1000.0}\ {\times}\ {\mathrm{a}}{)}\ {\div}\ {1000.0}\ {\}}ur‾ound ← { a → (f‾loat f‾loor 0.5 + 1000.0 × a) ÷ 1000.0 }{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\to}\ {(}{\mathrm{\underline{f}loat}}\ {\mathrm{\underline{f}loor}}\ {0.5}\ {+}\ {1000.0}\ {\times}\ {\mathrm{a}}{)}\ {\div}\ {1000.0}\ {\}}
113u:m_oveBy := { mv k -> ((d_isclose 1 s_elect mv) / 1.0 - 0.9 ^ k) / 0.00000001 + ((d_isclose 2 s_elect mv) / 1.0 - 0.999 ^ k) ^ 0.5 }{{}^{\mathrm{u}}\mathrm{\underline{m}oveBy}}\ {\leftarrow}\ {\{}\ {\mathrm{mv}}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{mv}}{)}\ {\div}\ {1.0}\ {-}\ {0.9}\ {\mathbin{\hat{}}}\ {\mathrm{k}}{)}\ {\div}\ {0.00000001}\ {+}\ {(}{(}{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{mv}}{)}\ {\div}\ {1.0}\ {-}\ {0.999}\ {\mathbin{\hat{}}}\ {\mathrm{k}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}um‾oveBy ← { mv k → ((d‾isclose 1 s‾elect mv) ÷ 1.0 − 0.9 ^ k) ÷ 0.00000001 + ((d‾isclose 2 s‾elect mv) ÷ 1.0 − 0.999 ^ k) ^ 0.5 }{{}^{\mathrm{u}}\mathrm{\underline{m}oveBy}}\ {\leftarrow}\ {\{}\ {\mathrm{mv}}\ {\mathrm{k}}\ {\to}\ {(}{(}{\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{mv}}{)}\ {\div}\ {1.0}\ {-}\ {0.9}\ {\mathbin{\hat{}}}\ {\mathrm{k}}{)}\ {\div}\ {0.00000001}\ {+}\ {(}{(}{\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{mv}}{)}\ {\div}\ {1.0}\ {-}\ {0.999}\ {\mathbin{\hat{}}}\ {\mathrm{k}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}
114u:p_acked := { s ->{{}^{\mathrm{u}}\mathrm{\underline{p}acked}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}up‾acked ← { s →{{}^{\mathrm{u}}\mathrm{\underline{p}acked}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}
115 W1 := d_isclose 1 s_elect s\ \ {\mathrm{W1}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}  W1 ← d‾isclose 1 s‾elect s\ \ {\mathrm{W1}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}
116 W2 := d_isclose 2 s_elect s\ \ {\mathrm{W2}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}  W2 ← d‾isclose 2 s‾elect s\ \ {\mathrm{W2}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}
117 k := 1.0 + d_isclose 7 s_elect s\ \ {\mathrm{k}}\ {\leftarrow}\ {1.0}\ {+}\ {\mathrm{\underline{d}isclose}}\ {7}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}  k ← 1.0 + d‾isclose 7 s‾elect s\ \ {\mathrm{k}}\ {\leftarrow}\ {1.0}\ {+}\ {\mathrm{\underline{d}isclose}}\ {7}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}
118 g := W1 u:g_rad W2\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{W1}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}rad}}\ {\mathrm{W2}}  g ← W1 ug‾rad W2\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{W1}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}rad}}\ {\mathrm{W2}}
119 G1 := d_isclose 1 s_elect g\ \ {\mathrm{G1}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  G1 ← d‾isclose 1 s‾elect g\ \ {\mathrm{G1}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
120 G2 := d_isclose 2 s_elect g\ \ {\mathrm{G2}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}  G2 ← d‾isclose 2 s‾elect g\ \ {\mathrm{G2}}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}
121 M1 := (0.9 * d_isclose 3 s_elect s) + 0.1 * G1\ \ {\mathrm{M1}}\ {\leftarrow}\ {(}{0.9}\ {\times}\ {\mathrm{\underline{d}isclose}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}{)}\ {+}\ {0.1}\ {\times}\ {\mathrm{G1}}  M1 ← (0.9 × d‾isclose 3 s‾elect s) + 0.1 × G1\ \ {\mathrm{M1}}\ {\leftarrow}\ {(}{0.9}\ {\times}\ {\mathrm{\underline{d}isclose}}\ {3}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}{)}\ {+}\ {0.1}\ {\times}\ {\mathrm{G1}}
122 M2 := (0.9 * d_isclose 4 s_elect s) + 0.1 * G2\ \ {\mathrm{M2}}\ {\leftarrow}\ {(}{0.9}\ {\times}\ {\mathrm{\underline{d}isclose}}\ {4}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}{)}\ {+}\ {0.1}\ {\times}\ {\mathrm{G2}}  M2 ← (0.9 × d‾isclose 4 s‾elect s) + 0.1 × G2\ \ {\mathrm{M2}}\ {\leftarrow}\ {(}{0.9}\ {\times}\ {\mathrm{\underline{d}isclose}}\ {4}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}{)}\ {+}\ {0.1}\ {\times}\ {\mathrm{G2}}
123 V1 := (0.999 * d_isclose 5 s_elect s) + 0.001 * G1 * G1\ \ {\mathrm{V1}}\ {\leftarrow}\ {(}{0.999}\ {\times}\ {\mathrm{\underline{d}isclose}}\ {5}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}{)}\ {+}\ {0.001}\ {\times}\ {\mathrm{G1}}\ {\times}\ {\mathrm{G1}}  V1 ← (0.999 × d‾isclose 5 s‾elect s) + 0.001 × G1 × G1\ \ {\mathrm{V1}}\ {\leftarrow}\ {(}{0.999}\ {\times}\ {\mathrm{\underline{d}isclose}}\ {5}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}{)}\ {+}\ {0.001}\ {\times}\ {\mathrm{G1}}\ {\times}\ {\mathrm{G1}}
124 V2 := (0.999 * d_isclose 6 s_elect s) + 0.001 * G2 * G2\ \ {\mathrm{V2}}\ {\leftarrow}\ {(}{0.999}\ {\times}\ {\mathrm{\underline{d}isclose}}\ {6}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}{)}\ {+}\ {0.001}\ {\times}\ {\mathrm{G2}}\ {\times}\ {\mathrm{G2}}  V2 ← (0.999 × d‾isclose 6 s‾elect s) + 0.001 × G2 × G2\ \ {\mathrm{V2}}\ {\leftarrow}\ {(}{0.999}\ {\times}\ {\mathrm{\underline{d}isclose}}\ {6}\ {\mathrm{\underline{s}elect}}\ {\mathrm{s}}{)}\ {+}\ {0.001}\ {\times}\ {\mathrm{G2}}\ {\times}\ {\mathrm{G2}}
125 N1 := W1 - lr * ((e_nclose M1) c_at e_nclose V1) u:m_oveBy k\ \ {\mathrm{N1}}\ {\leftarrow}\ {\mathrm{W1}}\ {-}\ {\mathrm{lr}}\ {\times}\ {(}{(}{\mathrm{\underline{e}nclose}}\ {\mathrm{M1}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{V1}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}oveBy}}\ {\mathrm{k}}  N1 ← W1 − lr × ((e‾nclose M1) c‾at e‾nclose V1) um‾oveBy k\ \ {\mathrm{N1}}\ {\leftarrow}\ {\mathrm{W1}}\ {-}\ {\mathrm{lr}}\ {\times}\ {(}{(}{\mathrm{\underline{e}nclose}}\ {\mathrm{M1}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{V1}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}oveBy}}\ {\mathrm{k}}
126 N2 := W2 - lr * ((e_nclose M2) c_at e_nclose V2) u:m_oveBy k\ \ {\mathrm{N2}}\ {\leftarrow}\ {\mathrm{W2}}\ {-}\ {\mathrm{lr}}\ {\times}\ {(}{(}{\mathrm{\underline{e}nclose}}\ {\mathrm{M2}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{V2}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}oveBy}}\ {\mathrm{k}}  N2 ← W2 − lr × ((e‾nclose M2) c‾at e‾nclose V2) um‾oveBy k\ \ {\mathrm{N2}}\ {\leftarrow}\ {\mathrm{W2}}\ {-}\ {\mathrm{lr}}\ {\times}\ {(}{(}{\mathrm{\underline{e}nclose}}\ {\mathrm{M2}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{V2}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}oveBy}}\ {\mathrm{k}}
127 (e_nclose N1) c_at (e_nclose N2) c_at (e_nclose M1) c_at (e_nclose M2) c_at (e_nclose V1) c_at (e_nclose V2) c_at e_nclose k\ \ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{N1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{N2}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{M1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{M2}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{V1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{V2}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{k}}  (e‾nclose N1) c‾at (e‾nclose N2) c‾at (e‾nclose M1) c‾at (e‾nclose M2) c‾at (e‾nclose V1) c‾at (e‾nclose V2) c‾at e‾nclose k\ \ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{N1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{N2}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{M1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{M2}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{V1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{V2}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {\mathrm{k}}
128}{\}}}{\}}
129z1 := 0.0 0.0 0.0{\mathrm{z1}}\ {\leftarrow}\ {0.0}\ {0.0}\ {0.0}z1 ← 0.0 0.0 0.0{\mathrm{z1}}\ {\leftarrow}\ {0.0}\ {0.0}\ {0.0}
130z2 := 2 2 r_eshape 0.0{\mathrm{z2}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0.0}z2 ← 2 2 r‾eshape 0.0{\mathrm{z2}}\ {\leftarrow}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {0.0}
131p0 := (e_nclose z1) c_at (e_nclose z2) c_at (e_nclose z1) c_at (e_nclose z2) c_at (e_nclose z1) c_at (e_nclose z2) c_at e_nclose 0.0{\mathrm{p0}}\ {\leftarrow}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z2}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z2}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z2}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {0.0}p0 ← (e‾nclose z1) c‾at (e‾nclose z2) c‾at (e‾nclose z1) c‾at (e‾nclose z2) c‾at (e‾nclose z1) c‾at (e‾nclose z2) c‾at e‾nclose 0.0{\mathrm{p0}}\ {\leftarrow}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z2}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z2}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z1}}{)}\ {\mathrm{\underline{c}at}}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{z2}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {0.0}
132p := 200 'u:p_acked p_ower p0{\mathrm{p}}\ {\leftarrow}\ {200}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{p}acked}}\ {\mathrm{\underline{p}ower}}\ {\mathrm{p0}}p ← 200 ’up‾acked p‾ower p0{\mathrm{p}}\ {\leftarrow}\ {200}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{p}acked}}\ {\mathrm{\underline{p}ower}}\ {\mathrm{p0}}
133u:r_ound d_isclose 1 s_elect p{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}ur‾ound d‾isclose 1 s‾elect p{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
165u:m_ove := { (m, v) k -> (m / 1.0 - 0.9 ^ k) / 0.00000001 + (v / 1.0 - 0.999 ^ k) ^ 0.5 }{{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{m}}{,}\ {\mathrm{v}}{)}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{m}}\ {\div}\ {1.0}\ {-}\ {0.9}\ {\mathbin{\hat{}}}\ {\mathrm{k}}{)}\ {\div}\ {0.00000001}\ {+}\ {(}{\mathrm{v}}\ {\div}\ {1.0}\ {-}\ {0.999}\ {\mathbin{\hat{}}}\ {\mathrm{k}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}um‾ove ← { (m, v) k → (m ÷ 1.0 − 0.9 ^ k) ÷ 0.00000001 + (v ÷ 1.0 − 0.999 ^ k) ^ 0.5 }{{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{m}}{,}\ {\mathrm{v}}{)}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{m}}\ {\div}\ {1.0}\ {-}\ {0.9}\ {\mathbin{\hat{}}}\ {\mathrm{k}}{)}\ {\div}\ {0.00000001}\ {+}\ {(}{\mathrm{v}}\ {\div}\ {1.0}\ {-}\ {0.999}\ {\mathbin{\hat{}}}\ {\mathrm{k}}{)}\ {\mathbin{\hat{}}}\ {0.5}\ {\}}
166u:a_dam := { (W1, W2, M1, M2, V1, V2, k) ->{{}^{\mathrm{u}}\mathrm{\underline{a}dam}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{W1}}{,}\ {\mathrm{W2}}{,}\ {\mathrm{M1}}{,}\ {\mathrm{M2}}{,}\ {\mathrm{V1}}{,}\ {\mathrm{V2}}{,}\ {\mathrm{k}}{)}\ {\to}ua‾dam ← { (W1, W2, M1, M2, V1, V2, k) →{{}^{\mathrm{u}}\mathrm{\underline{a}dam}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{W1}}{,}\ {\mathrm{W2}}{,}\ {\mathrm{M1}}{,}\ {\mathrm{M2}}{,}\ {\mathrm{V1}}{,}\ {\mathrm{V2}}{,}\ {\mathrm{k}}{)}\ {\to}
167 t := 1 + k\ \ {\mathrm{t}}\ {\leftarrow}\ {1}\ {+}\ {\mathrm{k}}  t ← 1 + k\ \ {\mathrm{t}}\ {\leftarrow}\ {1}\ {+}\ {\mathrm{k}}
168 g := W1 u:g_rad W2\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{W1}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}rad}}\ {\mathrm{W2}}  g ← W1 ug‾rad W2\ \ {\mathrm{g}}\ {\leftarrow}\ {\mathrm{W1}}\ {{}^{\mathrm{u}}\mathrm{\underline{g}rad}}\ {\mathrm{W2}}
169 (G1, G2) := (d_isclose 1 s_elect g, d_isclose 2 s_elect g)\ \ {(}{\mathrm{G1}}{,}\ {\mathrm{G2}}{)}\ {\leftarrow}\ {(}{\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}{,}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}{)}  (G1, G2) ← (d‾isclose 1 s‾elect g, d‾isclose 2 s‾elect g)\ \ {(}{\mathrm{G1}}{,}\ {\mathrm{G2}}{)}\ {\leftarrow}\ {(}{\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}{,}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{g}}{)}
170 m1 := (0.9 * M1) + 0.1 * G1\ \ {\mathrm{m1}}\ {\leftarrow}\ {(}{0.9}\ {\times}\ {\mathrm{M1}}{)}\ {+}\ {0.1}\ {\times}\ {\mathrm{G1}}  m1 ← (0.9 × M1) + 0.1 × G1\ \ {\mathrm{m1}}\ {\leftarrow}\ {(}{0.9}\ {\times}\ {\mathrm{M1}}{)}\ {+}\ {0.1}\ {\times}\ {\mathrm{G1}}
171 m2 := (0.9 * M2) + 0.1 * G2\ \ {\mathrm{m2}}\ {\leftarrow}\ {(}{0.9}\ {\times}\ {\mathrm{M2}}{)}\ {+}\ {0.1}\ {\times}\ {\mathrm{G2}}  m2 ← (0.9 × M2) + 0.1 × G2\ \ {\mathrm{m2}}\ {\leftarrow}\ {(}{0.9}\ {\times}\ {\mathrm{M2}}{)}\ {+}\ {0.1}\ {\times}\ {\mathrm{G2}}
172 v1 := (0.999 * V1) + 0.001 * G1 * G1\ \ {\mathrm{v1}}\ {\leftarrow}\ {(}{0.999}\ {\times}\ {\mathrm{V1}}{)}\ {+}\ {0.001}\ {\times}\ {\mathrm{G1}}\ {\times}\ {\mathrm{G1}}  v1 ← (0.999 × V1) + 0.001 × G1 × G1\ \ {\mathrm{v1}}\ {\leftarrow}\ {(}{0.999}\ {\times}\ {\mathrm{V1}}{)}\ {+}\ {0.001}\ {\times}\ {\mathrm{G1}}\ {\times}\ {\mathrm{G1}}
173 v2 := (0.999 * V2) + 0.001 * G2 * G2\ \ {\mathrm{v2}}\ {\leftarrow}\ {(}{0.999}\ {\times}\ {\mathrm{V2}}{)}\ {+}\ {0.001}\ {\times}\ {\mathrm{G2}}\ {\times}\ {\mathrm{G2}}  v2 ← (0.999 × V2) + 0.001 × G2 × G2\ \ {\mathrm{v2}}\ {\leftarrow}\ {(}{0.999}\ {\times}\ {\mathrm{V2}}{)}\ {+}\ {0.001}\ {\times}\ {\mathrm{G2}}\ {\times}\ {\mathrm{G2}}
174 (W1 - lr * (m1, v1) u:m_ove f_loat t, W2 - lr * (m2, v2) u:m_ove f_loat t, m1, m2, v1, v2, t)\ \ {(}{\mathrm{W1}}\ {-}\ {\mathrm{lr}}\ {\times}\ {(}{\mathrm{m1}}{,}\ {\mathrm{v1}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{t}}{,}\ {\mathrm{W2}}\ {-}\ {\mathrm{lr}}\ {\times}\ {(}{\mathrm{m2}}{,}\ {\mathrm{v2}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{t}}{,}\ {\mathrm{m1}}{,}\ {\mathrm{m2}}{,}\ {\mathrm{v1}}{,}\ {\mathrm{v2}}{,}\ {\mathrm{t}}{)}  (W1 − lr × (m1, v1) um‾ove f‾loat t, W2 − lr × (m2, v2) um‾ove f‾loat t, m1, m2, v1, v2, t)\ \ {(}{\mathrm{W1}}\ {-}\ {\mathrm{lr}}\ {\times}\ {(}{\mathrm{m1}}{,}\ {\mathrm{v1}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{t}}{,}\ {\mathrm{W2}}\ {-}\ {\mathrm{lr}}\ {\times}\ {(}{\mathrm{m2}}{,}\ {\mathrm{v2}}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{m}ove}}\ {\mathrm{\underline{f}loat}}\ {\mathrm{t}}{,}\ {\mathrm{m1}}{,}\ {\mathrm{m2}}{,}\ {\mathrm{v1}}{,}\ {\mathrm{v2}}{,}\ {\mathrm{t}}{)}
175}{\}}}{\}}
176s0 := (z1, z2, z1, z2, z1, z2, 0){\mathrm{s0}}\ {\leftarrow}\ {(}{\mathrm{z1}}{,}\ {\mathrm{z2}}{,}\ {\mathrm{z1}}{,}\ {\mathrm{z2}}{,}\ {\mathrm{z1}}{,}\ {\mathrm{z2}}{,}\ {0}{)}s0 ← (z1, z2, z1, z2, z1, z2, 0){\mathrm{s0}}\ {\leftarrow}\ {(}{\mathrm{z1}}{,}\ {\mathrm{z2}}{,}\ {\mathrm{z1}}{,}\ {\mathrm{z2}}{,}\ {\mathrm{z1}}{,}\ {\mathrm{z2}}{,}\ {0}{)}
177(w1, w2, _, _, _, _, steps) := 200 'u:a_dam p_ower s0{(}{\mathrm{w1}}{,}\ {\mathrm{w2}}{,}\ {\_}{,}\ {\_}{,}\ {\_}{,}\ {\_}{,}\ {\mathrm{steps}}{)}\ {\leftarrow}\ {200}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}dam}}\ {\mathrm{\underline{p}ower}}\ {\mathrm{s0}}(w1, w2, _, _, _, _, steps) ← 200 ’ua‾dam p‾ower s0{(}{\mathrm{w1}}{,}\ {\mathrm{w2}}{,}\ {\_}{,}\ {\_}{,}\ {\_}{,}\ {\_}{,}\ {\mathrm{steps}}{)}\ {\leftarrow}\ {200}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}dam}}\ {\mathrm{\underline{p}ower}}\ {\mathrm{s0}}
178u:r_ound w1{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{w1}}ur‾ound w1{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{w1}}
179steps{\mathrm{steps}}steps{\mathrm{steps}}
197(u:r_ound w1) m_atch u:r_ound d_isclose 1 s_elect p{(}{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{w1}}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}(ur‾ound w1) m‾atch ur‾ound d‾isclose 1 s‾elect p{(}{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{w1}}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{\underline{d}isclose}}\ {1}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
198(u:r_ound w2) m_atch u:r_ound d_isclose 2 s_elect p{(}{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{w2}}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}(ur‾ound w2) m‾atch ur‾ound d‾isclose 2 s‾elect p{(}{{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{w2}}{)}\ {\mathrm{\underline{m}atch}}\ {{}^{\mathrm{u}}\mathrm{\underline{r}ound}}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{p}}
239"cm:" u_se< "Comparison"{\text{"cm:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Comparison"}}"cm:" u‾se< "Comparison"{\text{"cm:"}}\ {\mathrm{\underline{u}se}{<}}\ {\text{"Comparison"}}
240s := 31 cm:s_tart 7{\mathrm{s}}\ {\leftarrow}\ {31}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tart}}\ {7}s ← 31 cms‾tart 7{\mathrm{s}}\ {\leftarrow}\ {31}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}tart}}\ {7}
241s{\mathrm{s}}s{\mathrm{s}}
242cm:TOP cm:s_teps (cm:TOP, 7) cm:c_hoose s{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}teps}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {7}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}cmTOP cms‾teps (cmTOP, 7) cmc‾hoose s{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{s}teps}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {7}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}
243cm:TOP cm:a_ngle 0.1 cm:t_ick (cm:TOP, 7) cm:c_hoose s{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {7}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}cmTOP cma‾ngle 0.1 cmt‾ick (cmTOP, 7) cmc‾hoose s{{}^{\mathrm{cm}}\mathrm{TOP}}\ {{}^{\mathrm{cm}}\mathrm{\underline{a}ngle}}\ {0.1}\ {{}^{\mathrm{cm}}\mathrm{\underline{t}ick}}\ {(}{{}^{\mathrm{cm}}\mathrm{TOP}}{,}\ {7}{)}\ {{}^{\mathrm{cm}}\mathrm{\underline{c}hoose}}\ {\mathrm{s}}
272'{ k -> (k, f_loat k) } m_ap 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}’{ k → (k, f‾loat k) } m‾ap 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}

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}
235f_loat 3{\mathrm{\underline{f}loat}}\ {3}f‾loat 3{\mathrm{\underline{f}loat}}\ {3}
2371 / 3{1}\ {\div}\ {3}1 ÷ 3{1}\ {\div}\ {3}
2390.1 + 0.2{0.1}\ {+}\ {0.2}0.1 + 0.2{0.1}\ {+}\ {0.2}
255s_in 0 1{\mathrm{\underline{s}in}}\ {0}\ {1}s‾in 0 1{\mathrm{\underline{s}in}}\ {0}\ {1}
266c_os p_i @{\mathrm{\underline{c}os}}\ {\mathrm{\underline{p}i}}\ {@}c‾os p‾i @{\mathrm{\underline{c}os}}\ {\mathrm{\underline{p}i}}\ {@}
2774 * a_tan 1{4}\ {\times}\ {\mathrm{\underline{a}tan}}\ {1}4 × a‾tan 1{4}\ {\times}\ {\mathrm{\underline{a}tan}}\ {1}
288p_i @{\mathrm{\underline{p}i}}\ {@}p‾i @{\mathrm{\underline{p}i}}\ {@}
300t_anh 0.5 1e-10 1000{\mathrm{\underline{t}anh}}\ {0.5}\ {1e-10}\ {1000}t‾anh 0.5 1e−10 1000{\mathrm{\underline{t}anh}}\ {0.5}\ {1e-10}\ {1000}
312s_qrt 2 16{\mathrm{\underline{s}qrt}}\ {2}\ {16}s‾qrt 2 16{\mathrm{\underline{s}qrt}}\ {2}\ {16}
324e_xpm1 1e-10{\mathrm{\underline{e}xpm1}}\ {1e-10}e‾xpm1 1e−10{\mathrm{\underline{e}xpm1}}\ {1e-10}
335l_og1p 1e-10{\mathrm{\underline{l}og1p}}\ {1e-10}l‾og1p 1e−10{\mathrm{\underline{l}og1p}}\ {1e-10}
347e_rf 0 0.5 3{\mathrm{\underline{e}rf}}\ {0}\ {0.5}\ {3}e‾rf 0 0.5 3{\mathrm{\underline{e}rf}}\ {0}\ {0.5}\ {3}
3490.5 * 1 + e_rf 1 / s_qrt 2{0.5}\ {\times}\ {1}\ {+}\ {\mathrm{\underline{e}rf}}\ {1}\ {\div}\ {\mathrm{\underline{s}qrt}}\ {2}0.5 × 1 + e‾rf 1 ÷ s‾qrt 2{0.5}\ {\times}\ {1}\ {+}\ {\mathrm{\underline{e}rf}}\ {1}\ {\div}\ {\mathrm{\underline{s}qrt}}\ {2}
361e_rfc 0.5 3{\mathrm{\underline{e}rfc}}\ {0.5}\ {3}e‾rfc 0.5 3{\mathrm{\underline{e}rfc}}\ {0.5}\ {3}
3632 * p_i @{2}\ {\times}\ {\mathrm{\underline{p}i}}\ {@}2 × p‾i @{2}\ {\times}\ {\mathrm{\underline{p}i}}\ {@}
3803 = 3{3}\ {=}\ {3}3 = 3{3}\ {=}\ {3}
382v = 1{\mathrm{v}}\ {=}\ {1}v = 1{\mathrm{v}}\ {=}\ {1}
393v != 1{\mathrm{v}}\ {\neq}\ {1}v ≠ 1{\mathrm{v}}\ {\neq}\ {1}
404v < 2{\mathrm{v}}\ {<}\ {2}v < 2{\mathrm{v}}\ {<}\ {2}
415v > 2{\mathrm{v}}\ {>}\ {2}v > 2{\mathrm{v}}\ {>}\ {2}
426v <= 2{\mathrm{v}}\ {\leq}\ {2}v ≤ 2{\mathrm{v}}\ {\leq}\ {2}
437v >= 2{\mathrm{v}}\ {\geq}\ {2}v ≥ 2{\mathrm{v}}\ {\geq}\ {2}
448(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}
4591 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}
4701 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}
481n_ot 1 0{\mathrm{\underline{n}ot}}\ {1}\ {0}n‾ot 1 0{\mathrm{\underline{n}ot}}\ {1}\ {0}
500s_hape v{\mathrm{\underline{s}hape}}\ {\mathrm{v}}s‾hape v{\mathrm{\underline{s}hape}}\ {\mathrm{v}}
502s_hape M{\mathrm{\underline{s}hape}}\ {\mathrm{M}}s‾hape M{\mathrm{\underline{s}hape}}\ {\mathrm{M}}
515t_ally v{\mathrm{\underline{t}ally}}\ {\mathrm{v}}t‾ally v{\mathrm{\underline{t}ally}}\ {\mathrm{v}}
517t_ally M{\mathrm{\underline{t}ally}}\ {\mathrm{M}}t‾ally M{\mathrm{\underline{t}ally}}\ {\mathrm{M}}
519t_ally_1 M{{\mathrm{\underline{t}ally}}_{1}}\ {\mathrm{M}}t‾ally1 M{{\mathrm{\underline{t}ally}}_{1}}\ {\mathrm{M}}
521t_ally_2 M{{\mathrm{\underline{t}ally}}_{2}}\ {\mathrm{M}}t‾ally2 M{{\mathrm{\underline{t}ally}}_{2}}\ {\mathrm{M}}
532r_ange 5{\mathrm{\underline{r}ange}}\ {5}r‾ange 5{\mathrm{\underline{r}ange}}\ {5}
543o_ffsets 5{\mathrm{\underline{o}ffsets}}\ {5}o‾ffsets 5{\mathrm{\underline{o}ffsets}}\ {5}
5552 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}
5582 2 r_eshape 7{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {7}2 2 r‾eshape 7{2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {7}
571r_avel M{\mathrm{\underline{r}avel}}\ {\mathrm{M}}r‾avel M{\mathrm{\underline{r}avel}}\ {\mathrm{M}}
573r_avel_2 M{{\mathrm{\underline{r}avel}}_{2}}\ {\mathrm{M}}r‾avel2 M{{\mathrm{\underline{r}avel}}_{2}}\ {\mathrm{M}}
585f_irst v{\mathrm{\underline{f}irst}}\ {\mathrm{v}}f‾irst v{\mathrm{\underline{f}irst}}\ {\mathrm{v}}
587f_irst M{\mathrm{\underline{f}irst}}\ {\mathrm{M}}f‾irst M{\mathrm{\underline{f}irst}}\ {\mathrm{M}}
589f_irst_1 M{{\mathrm{\underline{f}irst}}_{1}}\ {\mathrm{M}}f‾irst1 M{{\mathrm{\underline{f}irst}}_{1}}\ {\mathrm{M}}
591f_irst_2 M{{\mathrm{\underline{f}irst}}_{2}}\ {\mathrm{M}}f‾irst2 M{{\mathrm{\underline{f}irst}}_{2}}\ {\mathrm{M}}
6032 t_ake v{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}2 t‾ake v{2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}
605-2 t_ake v{-2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}−2 t‾ake v{-2}\ {\mathrm{\underline{t}ake}}\ {\mathrm{v}}
6071 t_ake M{1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{M}}1 t‾ake M{1}\ {\mathrm{\underline{t}ake}}\ {\mathrm{M}}
6091 t_ake_1 M{1}\ {{\mathrm{\underline{t}ake}}_{1}}\ {\mathrm{M}}1 t‾ake1 M{1}\ {{\mathrm{\underline{t}ake}}_{1}}\ {\mathrm{M}}
6111 t_ake_2 M{1}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{M}}1 t‾ake2 M{1}\ {{\mathrm{\underline{t}ake}}_{2}}\ {\mathrm{M}}
6241 d_rop v{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}1 d‾rop v{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{v}}
6261 d_rop M{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{M}}1 d‾rop M{1}\ {\mathrm{\underline{d}rop}}\ {\mathrm{M}}
6281 d_rop_1 M{1}\ {{\mathrm{\underline{d}rop}}_{1}}\ {\mathrm{M}}1 d‾rop1 M{1}\ {{\mathrm{\underline{d}rop}}_{1}}\ {\mathrm{M}}
6301 d_rop_2 M{1}\ {{\mathrm{\underline{d}rop}}_{2}}\ {\mathrm{M}}1 d‾rop2 M{1}\ {{\mathrm{\underline{d}rop}}_{2}}\ {\mathrm{M}}
6433 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}}
6452 s_elect M{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{M}}2 s‾elect M{2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{M}}
6472 s_elect_1 M{2}\ {{\mathrm{\underline{s}elect}}_{1}}\ {\mathrm{M}}2 s‾elect1 M{2}\ {{\mathrm{\underline{s}elect}}_{1}}\ {\mathrm{M}}
6492 s_elect_2 M{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{M}}2 s‾elect2 M{2}\ {{\mathrm{\underline{s}elect}}_{2}}\ {\mathrm{M}}
665v a_mend (1 3, 0 9){\mathrm{v}}\ {\mathrm{\underline{a}mend}}\ {(}{1}\ {3}{,}\ {0}\ {9}{)}v a‾mend (1 3, 0 9){\mathrm{v}}\ {\mathrm{\underline{a}mend}}\ {(}{1}\ {3}{,}\ {0}\ {9}{)}
667v a_mend (1 3, 0){\mathrm{v}}\ {\mathrm{\underline{a}mend}}\ {(}{1}\ {3}{,}\ {0}{)}v a‾mend (1 3, 0){\mathrm{v}}\ {\mathrm{\underline{a}mend}}\ {(}{1}\ {3}{,}\ {0}{)}
669M a_mend (2, 0 0 0){\mathrm{M}}\ {\mathrm{\underline{a}mend}}\ {(}{2}{,}\ {0}\ {0}\ {0}{)}M a‾mend (2, 0 0 0){\mathrm{M}}\ {\mathrm{\underline{a}mend}}\ {(}{2}{,}\ {0}\ {0}\ {0}{)}
672M a_mend_2 (3, 0 0){\mathrm{M}}\ {{\mathrm{\underline{a}mend}}_{2}}\ {(}{3}{,}\ {0}\ {0}{)}M a‾mend2 (3, 0 0){\mathrm{M}}\ {{\mathrm{\underline{a}mend}}_{2}}\ {(}{3}{,}\ {0}\ {0}{)}
6871 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"}}
689(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}}
6912 r_eplicate v{2}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{v}}2 r‾eplicate v{2}\ {\mathrm{\underline{r}eplicate}}\ {\mathrm{v}}
6930 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}}
6961 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}}
6991 -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}}
7162 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}
71824 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}
7200 10 e_ncode 123{0}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}0 10 e‾ncode 123{0}\ {10}\ {\mathrm{\underline{e}ncode}}\ {123}
7222 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}
7262 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}
7280 10 e_ncode -123{0}\ {10}\ {\mathrm{\underline{e}ncode}}\ {-123}0 10 e‾ncode −123{0}\ {10}\ {\mathrm{\underline{e}ncode}}\ {-123}
7302 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}}
7452 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}
74710 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}
74924 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}
7512 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}
7532.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}
7550.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}
7572 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}
775e_nclose "abc"{\mathrm{\underline{e}nclose}}\ {\text{"abc"}}e‾nclose "abc"{\mathrm{\underline{e}nclose}}\ {\text{"abc"}}
781"ab" "cde"{\text{"ab"}}\ {\text{"cde"}}"ab" "cde"{\text{"ab"}}\ {\text{"cde"}}
787(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}
793t_ally "ab" "cde"{\mathrm{\underline{t}ally}}\ {\text{"ab"}}\ {\text{"cde"}}t‾ally "ab" "cde"{\mathrm{\underline{t}ally}}\ {\text{"ab"}}\ {\text{"cde"}}
795e_nclose (1, 2.5){\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}e‾nclose (1, 2.5){\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}
808d_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"}}
810d_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"}}
812d_isclose "ab" "cde"{\mathrm{\underline{d}isclose}}\ {\text{"ab"}}\ {\text{"cde"}}d‾isclose "ab" "cde"{\mathrm{\underline{d}isclose}}\ {\text{"ab"}}\ {\text{"cde"}}
814d_isclose e_nclose (1, 2.5){\mathrm{\underline{d}isclose}}\ {\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}d‾isclose e‾nclose (1, 2.5){\mathrm{\underline{d}isclose}}\ {\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}
829m_ix '{ r_ange _r } m_ap v{\mathrm{\underline{m}ix}}\ {\text{'}}{\{}\ {\mathrm{\underline{r}ange}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{v}}m‾ix ’{ r‾ange _r } m‾ap v{\mathrm{\underline{m}ix}}\ {\text{'}}{\{}\ {\mathrm{\underline{r}ange}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{v}}
833m_ix "ab" "cde"{\mathrm{\underline{m}ix}}\ {\text{"ab"}}\ {\text{"cde"}}m‾ix "ab" "cde"{\mathrm{\underline{m}ix}}\ {\text{"ab"}}\ {\text{"cde"}}
850d_isplay M{\mathrm{\underline{d}isplay}}\ {\mathrm{M}}d‾isplay M{\mathrm{\underline{d}isplay}}\ {\mathrm{M}}
855d_isplay "abc"{\mathrm{\underline{d}isplay}}\ {\text{"abc"}}d‾isplay "abc"{\mathrm{\underline{d}isplay}}\ {\text{"abc"}}
859d_isplay "ab" "cde"{\mathrm{\underline{d}isplay}}\ {\text{"ab"}}\ {\text{"cde"}}d‾isplay "ab" "cde"{\mathrm{\underline{d}isplay}}\ {\text{"ab"}}\ {\text{"cde"}}
865s_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}}
867d_isplay 5{\mathrm{\underline{d}isplay}}\ {5}d‾isplay 5{\mathrm{\underline{d}isplay}}\ {5}
881t_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"}}
883d_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"}}
885'[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"}}
8871 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}
9011 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}
903M c_at M{\mathrm{M}}\ {\mathrm{\underline{c}at}}\ {\mathrm{M}}M c‾at M{\mathrm{M}}\ {\mathrm{\underline{c}at}}\ {\mathrm{M}}
908M 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}}
911M 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}
914M 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}
9292 3 r_equireShape M{2}\ {3}\ {\mathrm{\underline{r}equireShape}}\ {\mathrm{M}}2 3 r‾equireShape M{2}\ {3}\ {\mathrm{\underline{r}equireShape}}\ {\mathrm{M}}
9323 r_equireShape v{3}\ {\mathrm{\underline{r}equireShape}}\ {\mathrm{v}}3 r‾equireShape v{3}\ {\mathrm{\underline{r}equireShape}}\ {\mathrm{v}}
9343 2 r_equireShape M{3}\ {2}\ {\mathrm{\underline{r}equireShape}}\ {\mathrm{M}}3 2 r‾equireShape M{3}\ {2}\ {\mathrm{\underline{r}equireShape}}\ {\mathrm{M}}
952'+ r_/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}’+ r‾/ v{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{v}}
954'- r_/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}’− r‾/ 1 2 3{\text{'}}{-}\ {\mathrm{\underline{r}}{/}}\ {1}\ {2}\ {3}
956'+ r_/ M{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{M}}’+ r‾/ M{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\mathrm{M}}
958'+ r_/_1 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{M}}’+ r‾/1 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{1}}\ {\mathrm{M}}
960'+ r_/_2 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}’+ r‾/2 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{2}}\ {\mathrm{M}}
962'+ r_/_12 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{M}}’+ r‾/12 M{\text{'}}{+}\ {{\mathrm{\underline{r}}{/}}_{12}}\ {\mathrm{M}}
964'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}}
976'+ s_\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}’+ s‾\ v{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{v}}
978'+ s_\ M{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{M}}’+ s‾\ M{\text{'}}{+}\ {\mathrm{\underline{s}}{\backslash}}\ {\mathrm{M}}
981'+ s_\_1 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{1}}\ {\mathrm{M}}’+ s‾\1 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{1}}\ {\mathrm{M}}
984'+ s_\_2 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{M}}’+ s‾\2 M{\text{'}}{+}\ {{\mathrm{\underline{s}}{\backslash}}_{2}}\ {\mathrm{M}}
997'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}}
999'{ _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}}
10011 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}
1015t_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}
1017d_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}
1019'[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}
1021'{ k -> (k, f_loat k) } m_ap 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}’{ k → (k, f‾loat k) } m‾ap 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}
1027'{ k -> (k, k) } e_ach 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}’{ k → (k, k) } e‾ach 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}
10391 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}
1053(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}
1066'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}
1068[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}
107910 '- s_wap 3{10}\ {\text{'}}{-}\ {\mathrm{\underline{s}wap}}\ {3}10 ’− s‾wap 3{10}\ {\text{'}}{-}\ {\mathrm{\underline{s}wap}}\ {3}
10933 '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}
1095n_eg^3 5{\mathrm{\underline{n}eg}}^{3}\ {5}n‾eg3 5{\mathrm{\underline{n}eg}}^{3}\ {5}
10973 '{ (w, k) -> (w * 0.5, k + 1) } p_ower (8.0 4.0, 0){3}\ {\text{'}}{\{}\ {(}{\mathrm{w}}{,}\ {\mathrm{k}}{)}\ {\to}\ {(}{\mathrm{w}}\ {\times}\ {0.5}{,}\ {\mathrm{k}}\ {+}\ {1}{)}\ {\}}\ {\mathrm{\underline{p}ower}}\ {(}{8.0}\ {4.0}{,}\ {0}{)}3 ’{ (w, k) → (w × 0.5, k + 1) } p‾ower (8.0 4.0, 0){3}\ {\text{'}}{\{}\ {(}{\mathrm{w}}{,}\ {\mathrm{k}}{)}\ {\to}\ {(}{\mathrm{w}}\ {\times}\ {0.5}{,}\ {\mathrm{k}}\ {+}\ {1}{)}\ {\}}\ {\mathrm{\underline{p}ower}}\ {(}{8.0}\ {4.0}{,}\ {0}{)}
11132 '- n_wise 1 4 9 16{2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}2 ’− n‾wise 1 4 9 16{2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}
1115-2 '- n_wise 1 4 9 16{-2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}−2 ’− n‾wise 1 4 9 16{-2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}
11173 '+ n_wise v c_at v{3}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {\mathrm{v}}\ {\mathrm{\underline{c}at}}\ {\mathrm{v}}3 ’+ n‾wise v c‾at v{3}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {\mathrm{v}}\ {\mathrm{\underline{c}at}}\ {\mathrm{v}}
11192 'c_at n_wise "abc"{2}\ {\text{'}}{\mathrm{\underline{c}at}}\ {\mathrm{\underline{n}wise}}\ {\text{"abc"}}2 ’c‾at n‾wise "abc"{2}\ {\text{'}}{\mathrm{\underline{c}at}}\ {\mathrm{\underline{n}wise}}\ {\text{"abc"}}
11351 'g_rade r_ank N{1}\ {\text{'}}{\mathrm{\underline{g}rade}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{N}}1 ’g‾rade r‾ank N{1}\ {\text{'}}{\mathrm{\underline{g}rade}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{N}}
11381 'r_ev r_ank M{1}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}1 ’r‾ev r‾ank M{1}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}
1141-1 '{ '+ r_/ _r } r_ank M{-1}\ {\text{'}}{\{}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}−1 ’{ ’+ r‾/ _r } r‾ank M{-1}\ {\text{'}}{\{}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}
11575 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}
1159M 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}
11702 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}
11851 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}
11871 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}
1189M m_atch M{\mathrm{M}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{M}}M m‾atch M{\mathrm{M}}\ {\mathrm{\underline{m}atch}}\ {\mathrm{M}}
1191M 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}
11931 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}
1195(1 2, 3.5) m_atch (1 2, 3.5){(}{1}\ {2}{,}\ {3.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}\ {2}{,}\ {3.5}{)}(1 2, 3.5) m‾atch (1 2, 3.5){(}{1}\ {2}{,}\ {3.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}\ {2}{,}\ {3.5}{)}
1197(1 2, 3.5) m_atch (2 1 r_eshape 1 2, 3.5){(}{1}\ {2}{,}\ {3.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{2}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}{,}\ {3.5}{)}(1 2, 3.5) m‾atch (2 1 r‾eshape 1 2, 3.5){(}{1}\ {2}{,}\ {3.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{2}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}{,}\ {3.5}{)}
1199(1, 2) = (1, 2){(}{1}{,}\ {2}{)}\ {=}\ {(}{1}{,}\ {2}{)}(1, 2) = (1, 2){(}{1}{,}\ {2}{)}\ {=}\ {(}{1}{,}\ {2}{)}
1210u_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}
1222s_ort 3 1 2{\mathrm{\underline{s}ort}}\ {3}\ {1}\ {2}s‾ort 3 1 2{\mathrm{\underline{s}ort}}\ {3}\ {1}\ {2}
1224s_ort N{\mathrm{\underline{s}ort}}\ {\mathrm{N}}s‾ort N{\mathrm{\underline{s}ort}}\ {\mathrm{N}}
1227s_ort_2 N{{\mathrm{\underline{s}ort}}_{2}}\ {\mathrm{N}}s‾ort2 N{{\mathrm{\underline{s}ort}}_{2}}\ {\mathrm{N}}
1240g_rade 3 1 2{\mathrm{\underline{g}rade}}\ {3}\ {1}\ {2}g‾rade 3 1 2{\mathrm{\underline{g}rade}}\ {3}\ {1}\ {2}
1242g_rade_2 N{{\mathrm{\underline{g}rade}}_{2}}\ {\mathrm{N}}g‾rade2 N{{\mathrm{\underline{g}rade}}_{2}}\ {\mathrm{N}}
1253w_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}
1255w_here_2 M{{\mathrm{\underline{w}here}}_{2}}\ {\mathrm{M}}w‾here2 M{{\mathrm{\underline{w}here}}_{2}}\ {\mathrm{M}}
12711 o_- v{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}1 o‾− v{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}
1273-1 o_- v{-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}−1 o‾− v{-1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{v}}
12751 o_- M{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{M}}1 o‾− M{1}\ {\mathrm{\underline{o}}{-}}\ {\mathrm{M}}
12781 o_-_1 M{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{M}}1 o‾−1 M{1}\ {{\mathrm{\underline{o}}{-}}_{1}}\ {\mathrm{M}}
12811 o_-_2 M{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{M}}1 o‾−2 M{1}\ {{\mathrm{\underline{o}}{-}}_{2}}\ {\mathrm{M}}
1284-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}}
1298r_ev v{\mathrm{\underline{r}ev}}\ {\mathrm{v}}r‾ev v{\mathrm{\underline{r}ev}}\ {\mathrm{v}}
1300r_ev M{\mathrm{\underline{r}ev}}\ {\mathrm{M}}r‾ev M{\mathrm{\underline{r}ev}}\ {\mathrm{M}}
1303r_ev_1 M{{\mathrm{\underline{r}ev}}_{1}}\ {\mathrm{M}}r‾ev1 M{{\mathrm{\underline{r}ev}}_{1}}\ {\mathrm{M}}
1306r_ev_2 M{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{M}}r‾ev2 M{{\mathrm{\underline{r}ev}}_{2}}\ {\mathrm{M}}
1320o_\ M{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{M}}o‾\ M{\mathrm{\underline{o}}{\backslash}}\ {\mathrm{M}}
1324s_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}
1326s_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}
1328o_\_2 M{{\mathrm{\underline{o}}{\backslash}}_{2}}\ {\mathrm{M}}o‾\2 M{{\mathrm{\underline{o}}{\backslash}}_{2}}\ {\mathrm{M}}
13422 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}}
1346s_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}
13481 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}}
1362[]A{\square \mathrm{A}}□A{\square \mathrm{A}}
13643 t_ake []A{3}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{A}}3 t‾ake □A{3}\ {\mathrm{\underline{t}ake}}\ {\square \mathrm{A}}
1375[]D{\square \mathrm{D}}□D{\square \mathrm{D}}
1387t_ally []AV{\mathrm{\underline{t}ally}}\ {\square \mathrm{AV}}t‾ally □AV{\mathrm{\underline{t}ally}}\ {\square \mathrm{AV}}
138966 s_elect []AV{66}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{AV}}66 s‾elect □AV{66}\ {\mathrm{\underline{s}elect}}\ {\square \mathrm{AV}}
1400[]IO{\square \mathrm{IO}}□IO{\square \mathrm{IO}}
1412[]U_CS "Hi"{\square \mathrm{\underline{U}CS}}\ {\text{"Hi"}}□U‾CS "Hi"{\square \mathrm{\underline{U}CS}}\ {\text{"Hi"}}
1414([]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"}}
1425[]U_CHAR 72 105{\square \mathrm{\underline{U}CHAR}}\ {72}\ {105}□U‾CHAR 72 105{\square \mathrm{\underline{U}CHAR}}\ {72}\ {105}
1427[]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"}}
1429[]U_CHAR 200{\square \mathrm{\underline{U}CHAR}}\ {200}□U‾CHAR 200{\square \mathrm{\underline{U}CHAR}}\ {200}
1442s_hape []TS{\mathrm{\underline{s}hape}}\ {\square \mathrm{TS}}s‾hape □TS{\mathrm{\underline{s}hape}}\ {\square \mathrm{TS}}
14442026 <= 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}}
1457([]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}
1459[]D_L -1{\square \mathrm{\underline{D}L}}\ {-1}□D‾L −1{\square \mathrm{\underline{D}L}}\ {-1}
1472p_rint! v{\mathrm{\underline{p}rint}{!}}\ {\mathrm{v}}p‾rint! v{\mathrm{\underline{p}rint}{!}}\ {\mathrm{v}}
1485r_oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}r‾oll! 6 6 6{\mathrm{\underline{r}oll}{!}}\ {6}\ {6}\ {6}
1498i_d v{\mathrm{\underline{i}d}}\ {\mathrm{v}}i‾d v{\mathrm{\underline{i}d}}\ {\mathrm{v}}
1500[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}
15121 l_eft 2{1}\ {\mathrm{\underline{l}eft}}\ {2}1 l‾eft 2{1}\ {\mathrm{\underline{l}eft}}\ {2}
15143 [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}
15251 r_ight 2{1}\ {\mathrm{\underline{r}ight}}\ {2}1 r‾ight 2{1}\ {\mathrm{\underline{r}ight}}\ {2}
15271 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}
1538f_ormat 3.5{\mathrm{\underline{f}ormat}}\ {3.5}f‾ormat 3.5{\mathrm{\underline{f}ormat}}\ {3.5}
1540t_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}
1551n_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"}}
1563"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"}}
1574[]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"}}
1588[]R_EAD @{\square \mathrm{\underline{R}EAD}}\ {@}□R‾EAD @{\square \mathrm{\underline{R}EAD}}\ {@}
1602[]K_EY @{\square \mathrm{\underline{K}EY}}\ {@}□K‾EY @{\square \mathrm{\underline{K}EY}}\ {@}
1613[]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}}\ {@}
1625[]K_NAMED 1{\square \mathrm{\underline{K}NAMED}}\ {1}□K‾NAMED 1{\square \mathrm{\underline{K}NAMED}}\ {1}
1642[]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"}}
1681"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"}}
1687"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"}}
1702s_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"}}{)}
17041 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"}}{)}
1725[]E_VENT @{\square \mathrm{\underline{E}VENT}}\ {@}□E‾VENT @{\square \mathrm{\underline{E}VENT}}\ {@}
1738[]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}}\ {@}
1751[]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}}\ {@}
1763e := []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}}\ {@}
1765[]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}}\ {@}
1777[]C_OLOR 2{\square \mathrm{\underline{C}OLOR}}\ {2}□C‾OLOR 2{\square \mathrm{\underline{C}OLOR}}\ {2}
1789[]S_CALE 3{\square \mathrm{\underline{S}CALE}}\ {3}□S‾CALE 3{\square \mathrm{\underline{S}CALE}}\ {3}
1802t_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"}}
1813t_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"}}
1824t_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"}}
1836t_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"}}
1847t_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}}\ {@}
1859[]T_E @{\square \mathrm{\underline{T}E}}\ {@}□T‾E @{\square \mathrm{\underline{T}E}}\ {@}
1871t_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"}}
18851 + []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"}}
1900"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"}}
1902"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"}}
1926'{ @ -> []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{""}}\ {\}}
1928'{ @ -> "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}}\ {\}}
1930'{ @ -> 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}\ {\}}
1941'{ @ -> 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}\ {\}}
1953'{ @ -> "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}}\ {\}}
1965n! := 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}}\ {\}}
1967'{ @ -> "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}}\ {\}}
1978'{ @ -> "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}}\ {\}}
1989'{ @ -> "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}}\ {\}}
2001'{ @ -> "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}}\ {\}}
2017'{ @ -> 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}}\ {\}}
2019'{ @ -> 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}\ {\}}
202110 + (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"}}{)}
2036'{ @ -> '{ @ -> 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}}\ {\}}
2038'{ @ -> "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}}\ {\}}
2051'{ @ -> 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"}}\ {\}}
2055'{ @ -> "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"}}\ {\}}
2073"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"}}
2084[]S_TATEMENT @{\square \mathrm{\underline{S}TATEMENT}}\ {@}□S‾TATEMENT @{\square \mathrm{\underline{S}TATEMENT}}\ {@}
2095[]F_ILE @{\square \mathrm{\underline{F}ILE}}\ {@}□F‾ILE @{\square \mathrm{\underline{F}ILE}}\ {@}
2106[]L_INE @{\square \mathrm{\underline{L}INE}}\ {@}□L‾INE @{\square \mathrm{\underline{L}INE}}\ {@}
2118[]I_NCLUDE "data.txt"{\square \mathrm{\underline{I}NCLUDE}}\ {\text{"data.txt"}}□I‾NCLUDE "data.txt"{\square \mathrm{\underline{I}NCLUDE}}\ {\text{"data.txt"}}
2130[]C_FG "cli"{\square \mathrm{\underline{C}FG}}\ {\text{"cli"}}□C‾FG "cli"{\square \mathrm{\underline{C}FG}}\ {\text{"cli"}}
2145[]G_ENSYM "t"{\square \mathrm{\underline{G}ENSYM}}\ {\text{"t"}}□G‾ENSYM "t"{\square \mathrm{\underline{G}ENSYM}}\ {\text{"t"}}
2166[]G_RID 1 0{\square \mathrm{\underline{G}RID}}\ {1}\ {0}□G‾RID 1 0{\square \mathrm{\underline{G}RID}}\ {1}\ {0}
2185([]S_CALE 1) []N_GRID 0 9{(}{\square \mathrm{\underline{S}CALE}}\ {1}{)}\ {\square \mathrm{\underline{N}GRID}}\ {0}\ {9}(□S‾CALE 1) □N‾GRID 0 9{(}{\square \mathrm{\underline{S}CALE}}\ {1}{)}\ {\square \mathrm{\underline{N}GRID}}\ {0}\ {9}
2205[]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}
22219 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/errors/explain-binding.case

4m := 7 / 2{\mathrm{m}}\ {\leftarrow}\ {7}\ {\div}\ {2}m ← 7 ÷ 2{\mathrm{m}}\ {\leftarrow}\ {7}\ {\div}\ {2}
5k := 1{\mathrm{k}}\ {\leftarrow}\ {1}k ← 1{\mathrm{k}}\ {\leftarrow}\ {1}
6k + m{\mathrm{k}}\ {+}\ {\mathrm{m}}k + m{\mathrm{k}}\ {+}\ {\mathrm{m}}

spec/errors/explain-literal.case

3n := 3; n + 2.5{\mathrm{n}}\ {\leftarrow}\ {3}{\diamond}\ {\mathrm{n}}\ {+}\ {2.5}n ← 3⋄ n + 2.5{\mathrm{n}}\ {\leftarrow}\ {3}{\diamond}\ {\mathrm{n}}\ {+}\ {2.5}

spec/errors/explain-parameter.case

3u:f_ := { x -> (x + 1.5) + (x = "a") }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{x}}\ {+}\ {1.5}{)}\ {+}\ {(}{\mathrm{x}}\ {=}\ {\text{"a"}}{)}\ {\}}uf‾ ← { x → (x + 1.5) + (x = "a") }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{x}}\ {+}\ {1.5}{)}\ {+}\ {(}{\mathrm{x}}\ {=}\ {\text{"a"}}{)}\ {\}}

spec/errors/explain-string.case

31 + "a"{1}\ {+}\ {\text{"a"}}1 + "a"{1}\ {+}\ {\text{"a"}}

spec/errors/hint-condition.case

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

spec/errors/hint-disclose.case

3b := e_nclose 1 2; b + 1{\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{e}nclose}}\ {1}\ {2}{\diamond}\ {\mathrm{b}}\ {+}\ {1}b ← e‾nclose 1 2⋄ b + 1{\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{e}nclose}}\ {1}\ {2}{\diamond}\ {\mathrm{b}}\ {+}\ {1}

spec/errors/hint-enclose.case

3n := 1 2; (e_nclose n) c_at n{\mathrm{n}}\ {\leftarrow}\ {1}\ {2}{\diamond}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{n}}n ← 1 2⋄ (e‾nclose n) c‾at n{\mathrm{n}}\ {\leftarrow}\ {1}\ {2}{\diamond}\ {(}{\mathrm{\underline{e}nclose}}\ {\mathrm{n}}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{n}}

spec/errors/hint-float.case

3n := 3; u:g_ := { y -> y * 0.5 }; u:g_ n{\mathrm{n}}\ {\leftarrow}\ {3}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {\mathrm{y}}\ {\to}\ {\mathrm{y}}\ {\times}\ {0.5}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\mathrm{n}}n ← 3⋄ ug‾ ← { y → y × 0.5 }⋄ ug‾ n{\mathrm{n}}\ {\leftarrow}\ {3}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {\mathrm{y}}\ {\to}\ {\mathrm{y}}\ {\times}\ {0.5}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\mathrm{n}}

spec/errors/hint-floor.case

3x := 2.5; x t_ake 1 2 3{\mathrm{x}}\ {\leftarrow}\ {2.5}{\diamond}\ {\mathrm{x}}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}\ {3}x ← 2.5⋄ x t‾ake 1 2 3{\mathrm{x}}\ {\leftarrow}\ {2.5}{\diamond}\ {\mathrm{x}}\ {\mathrm{\underline{t}ake}}\ {1}\ {2}\ {3}

spec/errors/hint-function-waiting.case

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

spec/errors/hint-too-many.case

3{ x -> x + 1 } 2.5 m_ap 1 2{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {+}\ {1}\ {\}}\ {2.5}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}{ x → x + 1 } 2.5 m‾ap 1 2{\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {+}\ {1}\ {\}}\ {2.5}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}

spec/eval/add.case

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

spec/eval/amend.case

6s := 10 20 30 40{\mathrm{s}}\ {\leftarrow}\ {10}\ {20}\ {30}\ {40}s ← 10 20 30 40{\mathrm{s}}\ {\leftarrow}\ {10}\ {20}\ {30}\ {40}
7s a_mend (2 4, 0 9){\mathrm{s}}\ {\mathrm{\underline{a}mend}}\ {(}{2}\ {4}{,}\ {0}\ {9}{)}s a‾mend (2 4, 0 9){\mathrm{s}}\ {\mathrm{\underline{a}mend}}\ {(}{2}\ {4}{,}\ {0}\ {9}{)}
8s a_mend (3, 7){\mathrm{s}}\ {\mathrm{\underline{a}mend}}\ {(}{3}{,}\ {7}{)}s a‾mend (3, 7){\mathrm{s}}\ {\mathrm{\underline{a}mend}}\ {(}{3}{,}\ {7}{)}
9s a_mend (1 3, 5){\mathrm{s}}\ {\mathrm{\underline{a}mend}}\ {(}{1}\ {3}{,}\ {5}{)}s a‾mend (1 3, 5){\mathrm{s}}\ {\mathrm{\underline{a}mend}}\ {(}{1}\ {3}{,}\ {5}{)}
10s{\mathrm{s}}s{\mathrm{s}}
11s a_mend (2 2, 1 2){\mathrm{s}}\ {\mathrm{\underline{a}mend}}\ {(}{2}\ {2}{,}\ {1}\ {2}{)}s a‾mend (2 2, 1 2){\mathrm{s}}\ {\mathrm{\underline{a}mend}}\ {(}{2}\ {2}{,}\ {1}\ {2}{)}
12(2 3 r_eshape r_ange 6) a_mend (2, 0 0 0){(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {\mathrm{\underline{a}mend}}\ {(}{2}{,}\ {0}\ {0}\ {0}{)}(2 3 r‾eshape r‾ange 6) a‾mend (2, 0 0 0){(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {\mathrm{\underline{a}mend}}\ {(}{2}{,}\ {0}\ {0}\ {0}{)}
13(2 3 r_eshape r_ange 6) a_mend_2 (1 3, 2 2 r_eshape 7 8 9 0){(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {{\mathrm{\underline{a}mend}}_{2}}\ {(}{1}\ {3}{,}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {7}\ {8}\ {9}\ {0}{)}(2 3 r‾eshape r‾ange 6) a‾mend2 (1 3, 2 2 r‾eshape 7 8 9 0){(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{)}\ {{\mathrm{\underline{a}mend}}_{2}}\ {(}{1}\ {3}{,}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {7}\ {8}\ {9}\ {0}{)}
14"abc" a_mend (2, "X"){\text{"abc"}}\ {\mathrm{\underline{a}mend}}\ {(}{2}{,}\ {\text{"X"}}{)}"abc" a‾mend (2, "X"){\text{"abc"}}\ {\mathrm{\underline{a}mend}}\ {(}{2}{,}\ {\text{"X"}}{)}

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

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

spec/eval/comparison-result-defaults.case

9u:a_nd := { a b -> 2 d_ecode (2 2 2 2 e_ncode a) & 2 2 2 2 e_ncode b }{{}^{\mathrm{u}}\mathrm{\underline{a}nd}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {2}\ {\mathrm{\underline{d}ecode}}\ {(}{2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{a}}{)}\ {\wedge}\ {2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{b}}\ {\}}ua‾nd ← { a b → 2 d‾ecode (2 2 2 2 e‾ncode a) ∧ 2 2 2 2 e‾ncode b }{{}^{\mathrm{u}}\mathrm{\underline{a}nd}}\ {\leftarrow}\ {\{}\ {\mathrm{a}}\ {\mathrm{b}}\ {\to}\ {2}\ {\mathrm{\underline{d}ecode}}\ {(}{2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{a}}{)}\ {\wedge}\ {2}\ {2}\ {2}\ {2}\ {\mathrm{\underline{e}ncode}}\ {\mathrm{b}}\ {\}}
10u:p_os := { x -> x > 0 }{{}^{\mathrm{u}}\mathrm{\underline{p}os}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {>}\ {0}\ {\}}up‾os ← { x → x > 0 }{{}^{\mathrm{u}}\mathrm{\underline{p}os}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {>}\ {0}\ {\}}
11u:s_ame := { x -> x }{{}^{\mathrm{u}}\mathrm{\underline{s}ame}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}us‾ame ← { x → x }{{}^{\mathrm{u}}\mathrm{\underline{s}ame}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}
1212 u:a_nd 10{12}\ {{}^{\mathrm{u}}\mathrm{\underline{a}nd}}\ {10}12 ua‾nd 10{12}\ {{}^{\mathrm{u}}\mathrm{\underline{a}nd}}\ {10}
13u:p_os 3{{}^{\mathrm{u}}\mathrm{\underline{p}os}}\ {3}up‾os 3{{}^{\mathrm{u}}\mathrm{\underline{p}os}}\ {3}
14(u:p_os 3) + 1{(}{{}^{\mathrm{u}}\mathrm{\underline{p}os}}\ {3}{)}\ {+}\ {1}(up‾os 3) + 1{(}{{}^{\mathrm{u}}\mathrm{\underline{p}os}}\ {3}{)}\ {+}\ {1}
15u:s_ign := { x -> u:p_os x ? "yes"; "no" }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{p}os}}\ {\mathrm{x}}\ {?}\ {\text{"yes"}}{\diamond}\ {\text{"no"}}\ {\}}us‾ign ← { x → up‾os x ? "yes"⋄ "no" }{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{p}os}}\ {\mathrm{x}}\ {?}\ {\text{"yes"}}{\diamond}\ {\text{"no"}}\ {\}}
16u:s_ign 3{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {3}us‾ign 3{{}^{\mathrm{u}}\mathrm{\underline{s}ign}}\ {3}

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/condition-in-box.case

3b := e_nclose 0 < 1 2 3{\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{e}nclose}}\ {0}\ {<}\ {1}\ {2}\ {3}b ← e‾nclose 0 < 1 2 3{\mathrm{b}}\ {\leftarrow}\ {\mathrm{\underline{e}nclose}}\ {0}\ {<}\ {1}\ {2}\ {3}
40 + d_isclose b{0}\ {+}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}0 + d‾isclose b{0}\ {+}\ {\mathrm{\underline{d}isclose}}\ {\mathrm{b}}

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/discard.case

4_ := p_rint! 1{\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {1}_ ← p‾rint! 1{\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {1}
5_ := p_rint! 2{\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {2}_ ← p‾rint! 2{\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {2}
6u:f_ := { x -> _ := p_rint! x; _ := p_rint! x + 1; x + 2 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}{\diamond}\ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}\ {+}\ {1}{\diamond}\ {\mathrm{x}}\ {+}\ {2}\ {\}}uf‾ ← { x → _ ← p‾rint! x⋄ _ ← p‾rint! x + 1⋄ x + 2 }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}{\diamond}\ {\_}\ {\leftarrow}\ {\mathrm{\underline{p}rint}{!}}\ {\mathrm{x}}\ {+}\ {1}{\diamond}\ {\mathrm{x}}\ {+}\ {2}\ {\}}
7u:f_ 10{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {10}uf‾ 10{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {10}

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{\underline{(}}{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{w}hen}}\ {1}\ {=}\ {1}{\underline{)}}\ {42}{\underline{)}}\ {1}\ {\div}\ {0}(‾(‾uw‾hen 1 = 1)‾ 42)‾ 1 ÷ 0{\underline{(}}{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{w}hen}}\ {1}\ {=}\ {1}{\underline{)}}\ {42}{\underline{)}}\ {1}\ {\div}\ {0}

spec/eval/libm.case

8t_anh 0.5 1e-10 1000{\mathrm{\underline{t}anh}}\ {0.5}\ {1e-10}\ {1000}t‾anh 0.5 1e−10 1000{\mathrm{\underline{t}anh}}\ {0.5}\ {1e-10}\ {1000}
9s_qrt 2 16{\mathrm{\underline{s}qrt}}\ {2}\ {16}s‾qrt 2 16{\mathrm{\underline{s}qrt}}\ {2}\ {16}
10e_xpm1 1e-10{\mathrm{\underline{e}xpm1}}\ {1e-10}e‾xpm1 1e−10{\mathrm{\underline{e}xpm1}}\ {1e-10}
11(e_xp 1e-10) - 1{(}{\mathrm{\underline{e}xp}}\ {1e-10}{)}\ {-}\ {1}(e‾xp 1e−10) − 1{(}{\mathrm{\underline{e}xp}}\ {1e-10}{)}\ {-}\ {1}
12l_og1p 1e-10{\mathrm{\underline{l}og1p}}\ {1e-10}l‾og1p 1e−10{\mathrm{\underline{l}og1p}}\ {1e-10}
13e_rf 0 0.5 3{\mathrm{\underline{e}rf}}\ {0}\ {0.5}\ {3}e‾rf 0 0.5 3{\mathrm{\underline{e}rf}}\ {0}\ {0.5}\ {3}
14e_rfc 0.5 10{\mathrm{\underline{e}rfc}}\ {0.5}\ {10}e‾rfc 0.5 10{\mathrm{\underline{e}rfc}}\ {0.5}\ {10}
150.5 * 1 + e_rf 1 / s_qrt 2{0.5}\ {\times}\ {1}\ {+}\ {\mathrm{\underline{e}rf}}\ {1}\ {\div}\ {\mathrm{\underline{s}qrt}}\ {2}0.5 × 1 + e‾rf 1 ÷ s‾qrt 2{0.5}\ {\times}\ {1}\ {+}\ {\mathrm{\underline{e}rf}}\ {1}\ {\div}\ {\mathrm{\underline{s}qrt}}\ {2}

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/mix.case

6m_ix '{ r_ange _r } m_ap 1 2 3{\mathrm{\underline{m}ix}}\ {\text{'}}{\{}\ {\mathrm{\underline{r}ange}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}m‾ix ’{ r‾ange _r } m‾ap 1 2 3{\mathrm{\underline{m}ix}}\ {\text{'}}{\{}\ {\mathrm{\underline{r}ange}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}\ {3}
7m_ix "ab" "cde"{\mathrm{\underline{m}ix}}\ {\text{"ab"}}\ {\text{"cde"}}m‾ix "ab" "cde"{\mathrm{\underline{m}ix}}\ {\text{"ab"}}\ {\text{"cde"}}
8m_ix '{ (2 c_at _r) r_eshape 1 } m_ap 1 2{\mathrm{\underline{m}ix}}\ {\text{'}}{\{}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\_\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {1}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}m‾ix ’{ (2 c‾at _r) r‾eshape 1 } m‾ap 1 2{\mathrm{\underline{m}ix}}\ {\text{'}}{\{}\ {(}{2}\ {\mathrm{\underline{c}at}}\ {\_\mathrm{r}}{)}\ {\mathrm{\underline{r}eshape}}\ {1}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}
9m_ix e_nclose 7 8{\mathrm{\underline{m}ix}}\ {\mathrm{\underline{e}nclose}}\ {7}\ {8}m‾ix e‾nclose 7 8{\mathrm{\underline{m}ix}}\ {\mathrm{\underline{e}nclose}}\ {7}\ {8}
10m_ix 1 r_eshape e_nclose 5{\mathrm{\underline{m}ix}}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{e}nclose}}\ {5}m‾ix 1 r‾eshape e‾nclose 5{\mathrm{\underline{m}ix}}\ {1}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{e}nclose}}\ {5}
11m_ix (e_nclose 1 2) c_at e_nclose 2 2 r_eshape 3 4 5 6{\mathrm{\underline{m}ix}}\ {(}{\mathrm{\underline{e}nclose}}\ {1}\ {2}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {3}\ {4}\ {5}\ {6}m‾ix (e‾nclose 1 2) c‾at e‾nclose 2 2 r‾eshape 3 4 5 6{\mathrm{\underline{m}ix}}\ {(}{\mathrm{\underline{e}nclose}}\ {1}\ {2}{)}\ {\mathrm{\underline{c}at}}\ {\mathrm{\underline{e}nclose}}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {3}\ {4}\ {5}\ {6}

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/mutable-number-in-function.case

4u:f_ := { x -> a! := 1; a! := a! + x; a! }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{a}!}\ {\leftarrow}\ {1}{\diamond}\ {\mathrm{a}!}\ {\leftarrow}\ {\mathrm{a}!}\ {+}\ {\mathrm{x}}{\diamond}\ {\mathrm{a}!}\ {\}}uf‾ ← { x → a! ← 1⋄ a! ← a! + x⋄ a! }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{a}!}\ {\leftarrow}\ {1}{\diamond}\ {\mathrm{a}!}\ {\leftarrow}\ {\mathrm{a}!}\ {+}\ {\mathrm{x}}{\diamond}\ {\mathrm{a}!}\ {\}}
5u:f_ 0.5{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {0.5}uf‾ 0.5{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {0.5}
6u:f_ 2{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}uf‾ 2{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {2}

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/n-wise.case

72 '- n_wise 1 4 9 16{2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}2 ’− n‾wise 1 4 9 16{2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}
8-2 '- n_wise 1 4 9 16{-2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}−2 ’− n‾wise 1 4 9 16{-2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}
93 '+ n_wise 1 2 3 4 5{3}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}\ {4}\ {5}3 ’+ n‾wise 1 2 3 4 5{3}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}\ {4}\ {5}
102 'c_at n_wise "abcd"{2}\ {\text{'}}{\mathrm{\underline{c}at}}\ {\mathrm{\underline{n}wise}}\ {\text{"abcd"}}2 ’c‾at n‾wise "abcd"{2}\ {\text{'}}{\mathrm{\underline{c}at}}\ {\mathrm{\underline{n}wise}}\ {\text{"abcd"}}
114 '+ n_wise 1 2 3 4{4}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}\ {4}4 ’+ n‾wise 1 2 3 4{4}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}\ {4}
12t_ally 5 '+ n_wise 1 2 3 4{\mathrm{\underline{t}ally}}\ {5}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}\ {4}t‾ally 5 ’+ n‾wise 1 2 3 4{\mathrm{\underline{t}ally}}\ {5}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}\ {4}
130 '+ n_wise 1 2 3{0}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}0 ’+ n‾wise 1 2 3{0}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}
142 '+ n_wise 3 2 r_eshape r_ange 6{2}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}2 ’+ n‾wise 3 2 r‾eshape r‾ange 6{2}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {3}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
152 '- n_wise_2 2 3 r_eshape 1 4 9 2 3 5{2}\ {\text{'}}{-}\ {{\mathrm{\underline{n}wise}}_{2}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {4}\ {9}\ {2}\ {3}\ {5}2 ’− n‾wise2 2 3 r‾eshape 1 4 9 2 3 5{2}\ {\text{'}}{-}\ {{\mathrm{\underline{n}wise}}_{2}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {1}\ {4}\ {9}\ {2}\ {3}\ {5}

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/never-stops.case

3[]P_ANIC "stop here"{\square \mathrm{\underline{P}ANIC}}\ {\text{"stop here"}}□P‾ANIC "stop here"{\square \mathrm{\underline{P}ANIC}}\ {\text{"stop here"}}

spec/eval/never.case

6u:f_ail := { m -> []P_ANIC m }{{}^{\mathrm{u}}\mathrm{\underline{f}ail}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\square \mathrm{\underline{P}ANIC}}\ {\mathrm{m}}\ {\}}uf‾ail ← { m → □P‾ANIC m }{{}^{\mathrm{u}}\mathrm{\underline{f}ail}}\ {\leftarrow}\ {\{}\ {\mathrm{m}}\ {\to}\ {\square \mathrm{\underline{P}ANIC}}\ {\mathrm{m}}\ {\}}
7u:l_oop := { x -> u:l_oop x }{{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\mathrm{x}}\ {\}}ul‾oop ← { x → ul‾oop x }{{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {{}^{\mathrm{u}}\mathrm{\underline{l}oop}}\ {\mathrm{x}}\ {\}}
8u:s_afe := { x -> x < 0 ? u:f_ail "negative"; x * 2 }{{}^{\mathrm{u}}\mathrm{\underline{s}afe}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ail}}\ {\text{"negative"}}{\diamond}\ {\mathrm{x}}\ {\times}\ {2}\ {\}}us‾afe ← { x → x < 0 ? uf‾ail "negative"⋄ x × 2 }{{}^{\mathrm{u}}\mathrm{\underline{s}afe}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {<}\ {0}\ {?}\ {{}^{\mathrm{u}}\mathrm{\underline{f}ail}}\ {\text{"negative"}}{\diamond}\ {\mathrm{x}}\ {\times}\ {2}\ {\}}
9u:p_ick := { c x -> c ? x; []P_ANIC "no" }{{}^{\mathrm{u}}\mathrm{\underline{p}ick}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{x}}\ {\to}\ {\mathrm{c}}\ {?}\ {\mathrm{x}}{\diamond}\ {\square \mathrm{\underline{P}ANIC}}\ {\text{"no"}}\ {\}}up‾ick ← { c x → c ? x⋄ □P‾ANIC "no" }{{}^{\mathrm{u}}\mathrm{\underline{p}ick}}\ {\leftarrow}\ {\{}\ {\mathrm{c}}\ {\mathrm{x}}\ {\to}\ {\mathrm{c}}\ {?}\ {\mathrm{x}}{\diamond}\ {\square \mathrm{\underline{P}ANIC}}\ {\text{"no"}}\ {\}}
10u:s_afe 3{{}^{\mathrm{u}}\mathrm{\underline{s}afe}}\ {3}us‾afe 3{{}^{\mathrm{u}}\mathrm{\underline{s}afe}}\ {3}
111 u:p_ick "yes"{1}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ick}}\ {\text{"yes"}}1 up‾ick "yes"{1}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ick}}\ {\text{"yes"}}

spec/eval/number-grid.case

6([]S_CALE 2) []N_GRID 1 2{(}{\square \mathrm{\underline{S}CALE}}\ {2}{)}\ {\square \mathrm{\underline{N}GRID}}\ {1}\ {2}(□S‾CALE 2) □N‾GRID 1 2{(}{\square \mathrm{\underline{S}CALE}}\ {2}{)}\ {\square \mathrm{\underline{N}GRID}}\ {1}\ {2}

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}\ {\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {10}{\underline{)}}\ {3}us‾ub ← { _l − _r }⋄ (‾us‾ub 10)‾ 3{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {\leftarrow}\ {\{}\ {\_\mathrm{l}}\ {-}\ {\_\mathrm{r}}\ {\}}{\diamond}\ {\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{s}ub}}\ {10}{\underline{)}}\ {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-bool-count.case

4(1 > 0) '{ _r + 1 } p_ower 5{(}{1}\ {>}\ {0}{)}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {\mathrm{\underline{p}ower}}\ {5}(1 > 0) ’{ _r + 1 } p‾ower 5{(}{1}\ {>}\ {0}{)}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {\mathrm{\underline{p}ower}}\ {5}
5c := 2 > 3{\mathrm{c}}\ {\leftarrow}\ {2}\ {>}\ {3}c ← 2 > 3{\mathrm{c}}\ {\leftarrow}\ {2}\ {>}\ {3}
6c '{ _r + 1 } p_ower 5{\mathrm{c}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {\mathrm{\underline{p}ower}}\ {5}c ’{ _r + 1 } p‾ower 5{\mathrm{c}}\ {\text{'}}{\{}\ {\_\mathrm{r}}\ {+}\ {1}\ {\}}\ {\mathrm{\underline{p}ower}}\ {5}

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/rank.case

5M := 2 3 r_eshape 3 1 2 6 4 5{\mathrm{M}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {3}\ {1}\ {2}\ {6}\ {4}\ {5}M ← 2 3 r‾eshape 3 1 2 6 4 5{\mathrm{M}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {3}\ {1}\ {2}\ {6}\ {4}\ {5}
61 'g_rade r_ank M{1}\ {\text{'}}{\mathrm{\underline{g}rade}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}1 ’g‾rade r‾ank M{1}\ {\text{'}}{\mathrm{\underline{g}rade}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}
71 'r_ev r_ank M{1}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}1 ’r‾ev r‾ank M{1}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}
8-1 '{ '+ r_/ _r } r_ank M{-1}\ {\text{'}}{\{}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}−1 ’{ ’+ r‾/ _r } r‾ank M{-1}\ {\text{'}}{\{}\ {\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}
90 '{ r_ange _r } r_ank 1 2 3{0}\ {\text{'}}{\{}\ {\mathrm{\underline{r}ange}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}ank}}\ {1}\ {2}\ {3}0 ’{ r‾ange _r } r‾ank 1 2 3{0}\ {\text{'}}{\{}\ {\mathrm{\underline{r}ange}}\ {\_\mathrm{r}}\ {\}}\ {\mathrm{\underline{r}ank}}\ {1}\ {2}\ {3}
102 'g_rade r_ank M{2}\ {\text{'}}{\mathrm{\underline{g}rade}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}2 ’g‾rade r‾ank M{2}\ {\text{'}}{\mathrm{\underline{g}rade}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}
115 'r_ev r_ank M{5}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}5 ’r‾ev r‾ank M{5}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ank}}\ {\mathrm{M}}

spec/eval/rebind-mutable-parameter.case

3u:f_ := { s! -> s! := s! + 1; s! }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{s}!}\ {\to}\ {\mathrm{s}!}\ {\leftarrow}\ {\mathrm{s}!}\ {+}\ {1}{\diamond}\ {\mathrm{s}!}\ {\}}uf‾ ← { s! → s! ← s! + 1⋄ s! }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{s}!}\ {\to}\ {\mathrm{s}!}\ {\leftarrow}\ {\mathrm{s}!}\ {+}\ {1}{\diamond}\ {\mathrm{s}!}\ {\}}
4u:f_ 41{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {41}uf‾ 41{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {41}

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-amend-count.case

31 2 3 a_mend (1 2, 7 8 9){1}\ {2}\ {3}\ {\mathrm{\underline{a}mend}}\ {(}{1}\ {2}{,}\ {7}\ {8}\ {9}{)}1 2 3 a‾mend (1 2, 7 8 9){1}\ {2}\ {3}\ {\mathrm{\underline{a}mend}}\ {(}{1}\ {2}{,}\ {7}\ {8}\ {9}{)}

spec/eval/reject-amend-index.case

31 2 3 a_mend (4, 0){1}\ {2}\ {3}\ {\mathrm{\underline{a}mend}}\ {(}{4}{,}\ {0}{)}1 2 3 a‾mend (4, 0){1}\ {2}\ {3}\ {\mathrm{\underline{a}mend}}\ {(}{4}{,}\ {0}{)}

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-erase-in-file.case

4a := 42{\mathrm{a}}\ {\leftarrow}\ {42}a ← 42{\mathrm{a}}\ {\leftarrow}\ {42}
5[]E_X "a"{\square \mathrm{\underline{E}X}}\ {\text{"a"}}□E‾X "a"{\square \mathrm{\underline{E}X}}\ {\text{"a"}}
6a := 43{\mathrm{a}}\ {\leftarrow}\ {43}a ← 43{\mathrm{a}}\ {\leftarrow}\ {43}

spec/eval/reject-erase-not-literal.case

3n := "a"{\mathrm{n}}\ {\leftarrow}\ {\text{"a"}}n ← "a"{\mathrm{n}}\ {\leftarrow}\ {\text{"a"}}
4[]E_X n{\square \mathrm{\underline{E}X}}\ {\mathrm{n}}□E‾X n{\square \mathrm{\underline{E}X}}\ {\mathrm{n}}

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-libm-domain-log1p.case

3l_og1p -1{\mathrm{\underline{l}og1p}}\ {-1}l‾og1p −1{\mathrm{\underline{l}og1p}}\ {-1}

spec/eval/reject-libm-domain.case

4s_qrt -4{\mathrm{\underline{s}qrt}}\ {-4}s‾qrt −4{\mathrm{\underline{s}qrt}}\ {-4}

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-mix-unboxed.case

3m_ix 1 2 3{\mathrm{\underline{m}ix}}\ {1}\ {2}\ {3}m‾ix 1 2 3{\mathrm{\underline{m}ix}}\ {1}\ {2}\ {3}

spec/eval/reject-mutable-type-change.case

4a! := 42{\mathrm{a}!}\ {\leftarrow}\ {42}a! ← 42{\mathrm{a}!}\ {\leftarrow}\ {42}
5a! := 3.2{\mathrm{a}!}\ {\leftarrow}\ {3.2}a! ← 3.2{\mathrm{a}!}\ {\leftarrow}\ {3.2}

spec/eval/reject-n-wise-length.case

36 '+ n_wise 1 2 3 4{6}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}\ {4}6 ’+ n‾wise 1 2 3 4{6}\ {\text{'}}{+}\ {\mathrm{\underline{n}wise}}\ {1}\ {2}\ {3}\ {4}

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-number-grid-chars.case

3([]S_CALE 1) []N_GRID "ab"{(}{\square \mathrm{\underline{S}CALE}}\ {1}{)}\ {\square \mathrm{\underline{N}GRID}}\ {\text{"ab"}}(□S‾CALE 1) □N‾GRID "ab"{(}{\square \mathrm{\underline{S}CALE}}\ {1}{)}\ {\square \mathrm{\underline{N}GRID}}\ {\text{"ab"}}

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-rank-count.case

31.5 'r_ev r_ank 1 2 3{1.5}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ank}}\ {1}\ {2}\ {3}1.5 ’r‾ev r‾ank 1 2 3{1.5}\ {\text{'}}{\mathrm{\underline{r}ev}}\ {\mathrm{\underline{r}ank}}\ {1}\ {2}\ {3}

spec/eval/reject-read-discard.case

3_ := 5{\_}\ {\leftarrow}\ {5}_ ← 5{\_}\ {\leftarrow}\ {5}
4_ + 1{\_}\ {+}\ {1}_ + 1{\_}\ {+}\ {1}

spec/eval/reject-rebind-helper.case

3h:limit := 8{{}^{\mathrm{h}}\mathrm{limit}}\ {\leftarrow}\ {8}hlimit ← 8{{}^{\mathrm{h}}\mathrm{limit}}\ {\leftarrow}\ {8}
4h:limit := 9{{}^{\mathrm{h}}\mathrm{limit}}\ {\leftarrow}\ {9}hlimit ← 9{{}^{\mathrm{h}}\mathrm{limit}}\ {\leftarrow}\ {9}
5h:limit{{}^{\mathrm{h}}\mathrm{limit}}hlimit{{}^{\mathrm{h}}\mathrm{limit}}

spec/eval/reject-rebind-in-lambda.case

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

spec/eval/reject-rebind-parameter.case

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

spec/eval/reject-rebind.case

4a := 42{\mathrm{a}}\ {\leftarrow}\ {42}a ← 42{\mathrm{a}}\ {\leftarrow}\ {42}
5a := 43{\mathrm{a}}\ {\leftarrow}\ {43}a ← 43{\mathrm{a}}\ {\leftarrow}\ {43}
6a{\mathrm{a}}a{\mathrm{a}}

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-scale-range.case

3[]S_CALE 4{\square \mathrm{\underline{S}CALE}}\ {4}□S‾CALE 4{\square \mathrm{\underline{S}CALE}}\ {4}

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/require-shape-extents.case

4"ab" r_equireShape 1 2{\text{"ab"}}\ {\mathrm{\underline{r}equireShape}}\ {1}\ {2}"ab" r‾equireShape 1 2{\text{"ab"}}\ {\mathrm{\underline{r}equireShape}}\ {1}\ {2}

spec/eval/require-shape-mismatch.case

42 2 r_equireShape 1 2 3{2}\ {2}\ {\mathrm{\underline{r}equireShape}}\ {1}\ {2}\ {3}2 2 r‾equireShape 1 2 3{2}\ {2}\ {\mathrm{\underline{r}equireShape}}\ {1}\ {2}\ {3}

spec/eval/require-shape.case

62 3 r_equireShape 2 3 r_eshape r_ange 6{2}\ {3}\ {\mathrm{\underline{r}equireShape}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}2 3 r‾equireShape 2 3 r‾eshape r‾ange 6{2}\ {3}\ {\mathrm{\underline{r}equireShape}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
73 r_equireShape 1 2 3{3}\ {\mathrm{\underline{r}equireShape}}\ {1}\ {2}\ {3}3 r‾equireShape 1 2 3{3}\ {\mathrm{\underline{r}equireShape}}\ {1}\ {2}\ {3}
8(r_ange 0) r_equireShape 5{(}{\mathrm{\underline{r}ange}}\ {0}{)}\ {\mathrm{\underline{r}equireShape}}\ {5}(r‾ange 0) r‾equireShape 5{(}{\mathrm{\underline{r}ange}}\ {0}{)}\ {\mathrm{\underline{r}equireShape}}\ {5}
9N := 2{\mathrm{N}}\ {\leftarrow}\ {2}N ← 2{\mathrm{N}}\ {\leftarrow}\ {2}
10(N c_at 3) r_equireShape 2 3 r_eshape 0{(}{\mathrm{N}}\ {\mathrm{\underline{c}at}}\ {3}{)}\ {\mathrm{\underline{r}equireShape}}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {0}(N c‾at 3) r‾equireShape 2 3 r‾eshape 0{(}{\mathrm{N}}\ {\mathrm{\underline{c}at}}\ {3}{)}\ {\mathrm{\underline{r}equireShape}}\ {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/shadow-in-nested-scope.case

4x := 1{\mathrm{x}}\ {\leftarrow}\ {1}x ← 1{\mathrm{x}}\ {\leftarrow}\ {1}
5u:f_ := { x -> y := x + 1; y }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{y}}\ {\leftarrow}\ {\mathrm{x}}\ {+}\ {1}{\diamond}\ {\mathrm{y}}\ {\}}uf‾ ← { x → y ← x + 1⋄ y }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{y}}\ {\leftarrow}\ {\mathrm{x}}\ {+}\ {1}{\diamond}\ {\mathrm{y}}\ {\}}
6u:g_ := { z -> x := z * 10; x }{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {\mathrm{z}}\ {\to}\ {\mathrm{x}}\ {\leftarrow}\ {\mathrm{z}}\ {\times}\ {10}{\diamond}\ {\mathrm{x}}\ {\}}ug‾ ← { z → x ← z × 10⋄ x }{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {\mathrm{z}}\ {\to}\ {\mathrm{x}}\ {\leftarrow}\ {\mathrm{z}}\ {\times}\ {10}{\diamond}\ {\mathrm{x}}\ {\}}
7(u:f_ 5) + (u:g_ 2) + x{(}{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {5}{)}\ {+}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {2}{)}\ {+}\ {\mathrm{x}}(uf‾ 5) + (ug‾ 2) + x{(}{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {5}{)}\ {+}\ {(}{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {2}{)}\ {+}\ {\mathrm{x}}

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}\ {\underline{(}}{\mathrm{\underline{s}wap}}\ {\text{'}}{-}{\underline{)}}\ {3}ul‾ess3 ← (‾s‾wap ’−)‾ 3{{}^{\mathrm{u}}\mathrm{\underline{l}ess3}}\ {\leftarrow}\ {\underline{(}}{\mathrm{\underline{s}wap}}\ {\text{'}}{-}{\underline{)}}\ {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/train-fork-of-forks.case

4[['+ r_/ - t_ally] * ['m_ax r_/ - 'm_in r_/]] 1 2 3 10{[}{[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {-}\ {\mathrm{\underline{t}ally}}{]}\ {\times}\ {[}{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {-}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}{]}\ {1}\ {2}\ {3}\ {10}[[’+ r‾/ − t‾ally] × [’m‾ax r‾/ − ’m‾in r‾/]] 1 2 3 10{[}{[}{\text{'}}{+}\ {\mathrm{\underline{r}}{/}}\ {-}\ {\mathrm{\underline{t}ally}}{]}\ {\times}\ {[}{\text{'}}{\mathrm{\underline{m}ax}}\ {\mathrm{\underline{r}}{/}}\ {-}\ {\text{'}}{\mathrm{\underline{m}in}}\ {\mathrm{\underline{r}}{/}}{]}{]}\ {1}\ {2}\ {3}\ {10}

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/unused-param.case

4{ _u -> 42 } 7{\{}\ {\_\mathrm{u}}\ {\to}\ {42}\ {\}}\ {7}{ _u → 42 } 7{\{}\ {\_\mathrm{u}}\ {\to}\ {42}\ {\}}\ {7}
53 { x _u -> x + 1 } 9{3}\ {\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {+}\ {1}\ {\}}\ {9}3 { x _u → x + 1 } 9{3}\ {\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {+}\ {1}\ {\}}\ {9}
61 { _u _u -> 0 } 2{1}\ {\{}\ {\_\mathrm{u}}\ {\_\mathrm{u}}\ {\to}\ {0}\ {\}}\ {2}1 { _u _u → 0 } 2{1}\ {\{}\ {\_\mathrm{u}}\ {\_\mathrm{u}}\ {\to}\ {0}\ {\}}\ {2}
77 { a ~_u -> a } 1 / 0{7}\ {\{}\ {\mathrm{a}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{a}}\ {\}}\ {1}\ {\div}\ {0}7 { a ∼_u → a } 1 ÷ 0{7}\ {\{}\ {\mathrm{a}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{a}}\ {\}}\ {1}\ {\div}\ {0}

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{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {5}(‾uY‾ ’uF‾)‾ 5{\underline{(}}{{}^{\mathrm{u}}\mathrm{\underline{Y}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{F}}}{\underline{)}}\ {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{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}2}}\ {2}{\underline{)}}\ {3}(‾1 ’ua‾bc ’ui‾nc cB‾2 2)‾ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}\ {{}^{\mathrm{c}}\mathrm{\underline{B}2}}\ {2}{\underline{)}}\ {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{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{\underline{)}}\ {2}(‾1 ’ua‾b cD‾ ’ud‾bl)‾ 2{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{\underline{)}}\ {2}
23((1 'u:a_bc c:D_1 2)_ 'u:d_bl)_ 3{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}1}}\ {2}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{\underline{)}}\ {3}(‾(‾1 ’ua‾bc cD‾1 2)‾ ’ud‾bl)‾ 3{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{D}1}}\ {2}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{\underline{)}}\ {3}
24(1 'u:d_bl 'u:a_b c:D_2 'u:i_nc)_ 2{\underline{(}}{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}}{\underline{)}}\ {2}(‾1 ’ud‾bl ’ua‾b cD‾2 ’ui‾nc)‾ 2{\underline{(}}{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}}{\underline{)}}\ {2}
25((1 'u:a_b c:E_ 'u:a_b)_ 2)_ 3{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{E}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{\underline{)}}\ {2}{\underline{)}}\ {3}(‾(‾1 ’ua‾b cE‾ ’ua‾b)‾ 2)‾ 3{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{E}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{\underline{)}}\ {2}{\underline{)}}\ {3}
26(((1 'u:a_b 'u:a_b c:E_h 2)_ 'u:a_b)_ 3)_ 4{\underline{(}}{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{E}h}}\ {2}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{\underline{)}}\ {3}{\underline{)}}\ {4}(‾(‾(‾1 ’ua‾b ’ua‾b cE‾h 2)‾ ’ua‾b)‾ 3)‾ 4{\underline{(}}{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{E}h}}\ {2}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{\underline{)}}\ {3}{\underline{)}}\ {4}
27(1 c:F_ 2)_ 'u:a_b{\underline{(}}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{F}}}\ {2}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}(‾1 cF‾ 2)‾ ’ua‾b{\underline{(}}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{F}}}\ {2}{\underline{)}}\ {\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{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{J}}}\ {2}{\underline{)}}\ {3}(‾1 ’ua‾b cJ‾ 2)‾ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}\ {{}^{\mathrm{c}}\mathrm{\underline{J}}}\ {2}{\underline{)}}\ {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{\underline{(}}{5}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}2}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}(‾5 cQ‾2 ’ui‾nc)‾ ’ud‾bl{\underline{(}}{5}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}2}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}{\underline{)}}\ {\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{\underline{(}}{5}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}4}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}(‾5 cQ‾4 ’ud‾bl)‾ ’ui‾nc{\underline{(}}{5}\ {{}^{\mathrm{c}}\mathrm{\underline{Q}4}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{d}bl}}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{i}nc}}
37(1 c:R_ 'u:a_b)_ 2{\underline{(}}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{R}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{\underline{)}}\ {2}(‾1 cR‾ ’ua‾b)‾ 2{\underline{(}}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{R}}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}{\underline{)}}\ {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{\underline{(}}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {2}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}(‾1 cV‾ 2)‾ ’ua‾b{\underline{(}}{1}\ {{}^{\mathrm{c}}\mathrm{\underline{V}}}\ {2}{\underline{)}}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}b}}
40(1 'u:a_bc c:C_s 2)_ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}s}}\ {2}{\underline{)}}\ {3}(‾1 ’ua‾bc cC‾s 2)‾ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}s}}\ {2}{\underline{)}}\ {3}
41(1 'u:a_bc c:R_s 2)_ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{R}s}}\ {2}{\underline{)}}\ {3}(‾1 ’ua‾bc cR‾s 2)‾ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{R}s}}\ {2}{\underline{)}}\ {3}
42(1 'u:a_bc c:F_s 2)_ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{F}s}}\ {2}{\underline{)}}\ {3}(‾1 ’ua‾bc cF‾s 2)‾ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{F}s}}\ {2}{\underline{)}}\ {3}
43(1 'u:a_bc c:V_s 2)_ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{V}s}}\ {2}{\underline{)}}\ {3}(‾1 ’ua‾bc cV‾s 2)‾ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bc}}\ {{}^{\mathrm{c}}\mathrm{\underline{V}s}}\ {2}{\underline{)}}\ {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{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}ss}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}(‾(‾1 ’ua‾bcd cC‾ss 2)‾ 3)‾ 4{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{C}ss}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}
46((1 'u:a_bcd c:R_ss 2)_ 3)_ 4{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{R}ss}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}(‾(‾1 ’ua‾bcd cR‾ss 2)‾ 3)‾ 4{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{R}ss}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}
47((1 'u:a_bcd c:F_ss 2)_ 3)_ 4{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{F}ss}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}(‾(‾1 ’ua‾bcd cF‾ss 2)‾ 3)‾ 4{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{F}ss}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}
48((1 'u:a_bcd c:V_ss 2)_ 3)_ 4{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{V}ss}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}(‾(‾1 ’ua‾bcd cV‾ss 2)‾ 3)‾ 4{\underline{(}}{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{V}ss}}\ {2}{\underline{)}}\ {3}{\underline{)}}\ {4}
49(1 'u:a_bcd c:W_ss 2)_ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}ss}}\ {2}{\underline{)}}\ {3}(‾1 ’ua‾bcd cW‾ss 2)‾ 3{\underline{(}}{1}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{a}bcd}}\ {{}^{\mathrm{c}}\mathrm{\underline{W}ss}}\ {2}{\underline{)}}\ {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{}""}}
59u:p_ow := { b e -> b ^ e }{{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\mathrm{e}}\ {\to}\ {\mathrm{b}}\ {\mathbin{\hat{}}}\ {\mathrm{e}}\ {\}}up‾ow ← { b e → b ^ e }{{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {\leftarrow}\ {\{}\ {\mathrm{b}}\ {\mathrm{e}}\ {\to}\ {\mathrm{b}}\ {\mathbin{\hat{}}}\ {\mathrm{e}}\ {\}}
602 u:p_ow 10{2}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {10}2 up‾ow 10{2}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {10}
61u:t_woTo := u:p_ow 2{{}^{\mathrm{u}}\mathrm{\underline{t}woTo}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {2}ut‾woTo ← up‾ow 2{{}^{\mathrm{u}}\mathrm{\underline{t}woTo}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}ow}}\ {2}
62u:t_woTo 10{{}^{\mathrm{u}}\mathrm{\underline{t}woTo}}\ {10}ut‾woTo 10{{}^{\mathrm{u}}\mathrm{\underline{t}woTo}}\ {10}
63u:a_nswer := { @ -> 42 }; u:a_nswer @{{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {42}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {@}ua‾nswer ← { @ → 42 }⋄ ua‾nswer @{{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {\leftarrow}\ {\{}\ {@}\ {\to}\ {42}\ {\}}{\diamond}\ {{}^{\mathrm{u}}\mathrm{\underline{a}nswer}}\ {@}
64u:v_olume := { (l, w, h) -> l * w * h }{{}^{\mathrm{u}}\mathrm{\underline{v}olume}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{l}}{,}\ {\mathrm{w}}{,}\ {\mathrm{h}}{)}\ {\to}\ {\mathrm{l}}\ {\times}\ {\mathrm{w}}\ {\times}\ {\mathrm{h}}\ {\}}uv‾olume ← { (l, w, h) → l × w × h }{{}^{\mathrm{u}}\mathrm{\underline{v}olume}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{l}}{,}\ {\mathrm{w}}{,}\ {\mathrm{h}}{)}\ {\to}\ {\mathrm{l}}\ {\times}\ {\mathrm{w}}\ {\times}\ {\mathrm{h}}\ {\}}
65u:v_olume (2, 3, 4){{}^{\mathrm{u}}\mathrm{\underline{v}olume}}\ {(}{2}{,}\ {3}{,}\ {4}{)}uv‾olume (2, 3, 4){{}^{\mathrm{u}}\mathrm{\underline{v}olume}}\ {(}{2}{,}\ {3}{,}\ {4}{)}
66-2 '- n_wise 1 4 9 16{-2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}−2 ’− n‾wise 1 4 9 16{-2}\ {\text{'}}{-}\ {\mathrm{\underline{n}wise}}\ {1}\ {4}\ {9}\ {16}

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/code-strings.case

6p := c"n_eg x |> f_ $h"{\mathrm{p}}\ {\leftarrow}\ {\text{c"}}{\mathrm{\underline{n}eg}}\ {\mathrm{x}}\ {\triangleright}\ {\mathrm{\underline{f}}}\ {\scriptstyle\triangleright}{\mathrm{h}}{\text{"}}p ← c"n‾eg x ▹ f‾ ▹h"{\mathrm{p}}\ {\leftarrow}\ {\text{c"}}{\mathrm{\underline{n}eg}}\ {\mathrm{x}}\ {\triangleright}\ {\mathrm{\underline{f}}}\ {\scriptstyle\triangleright}{\mathrm{h}}{\text{"}}
7q := c#"p_rint! "a""#{\mathrm{q}}\ {\leftarrow}\ {\text{c\#"}}{\mathrm{\underline{p}rint}{!}}\ {\text{"a"}}{\text{"\#}}q ← c#"p‾rint! "a""#{\mathrm{q}}\ {\leftarrow}\ {\text{c\#"}}{\mathrm{\underline{p}rint}{!}}\ {\text{"a"}}{\text{"\#}}
8p m_atch "n_eg x |> f_ $h"{\mathrm{p}}\ {\mathrm{\underline{m}atch}}\ {\text{"n\_eg x |> f\_ \$h"}}p m‾atch "n_eg x |> f_ $h"{\mathrm{p}}\ {\mathrm{\underline{m}atch}}\ {\text{"n\_eg x |> f\_ \$h"}}
9t_ally q{\mathrm{\underline{t}ally}}\ {\mathrm{q}}t‾ally q{\mathrm{\underline{t}ally}}\ {\mathrm{q}}

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/label.case

4it $h $(q, k){\mathrm{it}}\ {\scriptstyle\triangleright}{\mathrm{h}}\ {\scriptstyle\triangleright}{(}{\mathrm{q}}{,}\ {\mathrm{k}}{)}it ▹h ▹(q, k){\mathrm{it}}\ {\scriptstyle\triangleright}{\mathrm{h}}\ {\scriptstyle\triangleright}{(}{\mathrm{q}}{,}\ {\mathrm{k}}{)}

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/pipe.case

4x |> y | > z{\mathrm{x}}\ {\triangleright}\ {\mathrm{y}}\ {\vee}\ {>}\ {\mathrm{z}}x ▹ y ∨ > z{\mathrm{x}}\ {\triangleright}\ {\mathrm{y}}\ {\vee}\ {>}\ {\mathrm{z}}

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/raw-string-lines.case

3t := r"a b"{\mathrm{t}}\ {\leftarrow}\ {\text{r"a b"}}t ← r"a b"{\mathrm{t}}\ {\leftarrow}\ {\text{r"a b"}}
5t{\mathrm{t}}t{\mathrm{t}}
6t_ally t{\mathrm{\underline{t}ally}}\ {\mathrm{t}}t‾ally t{\mathrm{\underline{t}ally}}\ {\mathrm{t}}

spec/lex/raw-strings.case

4p := r"C:\data\x.csv"{\mathrm{p}}\ {\leftarrow}\ {\text{r"C:\textbackslash{}data\textbackslash{}x.csv"}}p ← r"C:\data\x.csv"{\mathrm{p}}\ {\leftarrow}\ {\text{r"C:\textbackslash{}data\textbackslash{}x.csv"}}
5q := r#"say "hi""#{\mathrm{q}}\ {\leftarrow}\ {\text{r\#"say "hi""\#}}q ← r#"say "hi""#{\mathrm{q}}\ {\leftarrow}\ {\text{r\#"say "hi""\#}}
6p{\mathrm{p}}p{\mathrm{p}}
7t_ally q{\mathrm{\underline{t}ally}}\ {\mathrm{q}}t‾ally q{\mathrm{\underline{t}ally}}\ {\mathrm{q}}

spec/lex/reject-code-inside-char.case

4s := c"x ` y"{\mathrm{s}}\ {\leftarrow}\ {\text{c"}}{\mathrm{x}}\ {\text{`}}\ {\mathrm{y}}{\text{"}}s ← c"x ‘ y"{\mathrm{s}}\ {\leftarrow}\ {\text{c"}}{\mathrm{x}}\ {\text{`}}\ {\mathrm{y}}{\text{"}}

spec/lex/reject-code-inside-string.case

4s := c#"p_rint! "a"#{\mathrm{s}}\ {\leftarrow}\ {\text{c\#"}}{\mathrm{\underline{p}rint}{!}}\ {\text{"a}}{\text{"\#}}s ← c#"p‾rint! "a"#{\mathrm{s}}\ {\leftarrow}\ {\text{c\#"}}{\mathrm{\underline{p}rint}{!}}\ {\text{"a}}{\text{"\#}}

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/unused-param.case

3{ x _u -> x }{\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {\}}{ x _u → x }{\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {\}}

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-fails.case

4x := 6{\mathrm{x}}\ {\leftarrow}\ {6}x ← 6{\mathrm{x}}\ {\leftarrow}\ {6}
5"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"}}
6x{\mathrm{x}}x{\mathrm{x}}

spec/macros/assert.case

4x := 6{\mathrm{x}}\ {\leftarrow}\ {6}x ← 6{\mathrm{x}}\ {\leftarrow}\ {6}
5"x > 1" a_ssert< "x is more than one"{\text{"x > 1"}}\ {\mathrm{\underline{a}ssert}{<}}\ {\text{"x is more than one"}}"x > 1" a‾ssert< "x is more than one"{\text{"x > 1"}}\ {\mathrm{\underline{a}ssert}{<}}\ {\text{"x is more than one"}}
6"x < 10" a_ssert< @{\text{"x < 10"}}\ {\mathrm{\underline{a}ssert}{<}}\ {@}"x < 10" a‾ssert< @{\text{"x < 10"}}\ {\mathrm{\underline{a}ssert}{<}}\ {@}
7x{\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/check.case

4x := 6{\mathrm{x}}\ {\leftarrow}\ {6}x ← 6{\mathrm{x}}\ {\leftarrow}\ {6}
5"x > 10" c_heck< "x is big"{\text{"x > 10"}}\ {\mathrm{\underline{c}heck}{<}}\ {\text{"x is big"}}"x > 10" c‾heck< "x is big"{\text{"x > 10"}}\ {\mathrm{\underline{c}heck}{<}}\ {\text{"x is big"}}
6"x > 1" c_heck< @{\text{"x > 1"}}\ {\mathrm{\underline{c}heck}{<}}\ {@}"x > 1" c‾heck< @{\text{"x > 1"}}\ {\mathrm{\underline{c}heck}{<}}\ {@}
7x{\mathrm{x}}x{\mathrm{x}}

spec/macros/code-body.case

4n! := 0{\mathrm{n}!}\ {\leftarrow}\ {0}n! ← 0{\mathrm{n}!}\ {\leftarrow}\ {0}
5c#"n! := n! + 1; n! < 3 ? "again" []S_IGNAL "not yet"; n!"# t_ry< c"@ r_etry< @"{\text{c\#"}}{\mathrm{n}!}\ {\leftarrow}\ {\mathrm{n}!}\ {+}\ {1}{\diamond}\ {\mathrm{n}!}\ {<}\ {3}\ {?}\ {\text{"again"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"not yet"}}{\diamond}\ {\mathrm{n}!}{\text{"\#}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{c"}}{@}\ {\mathrm{\underline{r}etry}{<}}\ {@}{\text{"}}c#"n! ← n! + 1⋄ n! < 3 ? "again" □S‾IGNAL "not yet"⋄ n!"# t‾ry< c"@ r‾etry< @"{\text{c\#"}}{\mathrm{n}!}\ {\leftarrow}\ {\mathrm{n}!}\ {+}\ {1}{\diamond}\ {\mathrm{n}!}\ {<}\ {3}\ {?}\ {\text{"again"}}\ {\square \mathrm{\underline{S}IGNAL}}\ {\text{"not yet"}}{\diamond}\ {\mathrm{n}!}{\text{"\#}}\ {\mathrm{\underline{t}ry}{<}}\ {\text{c"}}{@}\ {\mathrm{\underline{r}etry}{<}}\ {@}{\text{"}}

spec/macros/code-on-text-side-lexes.case

4@ f_ormat< c"2 + 2 is {2 + 2}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{c"}}{2}\ {+}\ {2}\ {\mathrm{is}}\ {\{}{2}\ {+}\ {2}{\}}{\text{"}}@ f‾ormat< c"2 + 2 is {2 + 2}"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{c"}}{2}\ {+}\ {2}\ {\mathrm{is}}\ {\{}{2}\ {+}\ {2}{\}}{\text{"}}

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-markup.case

4p_rint! @ f_ormat< "<rect \"{1 + 2}\""{\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"<rect \textbackslash{}"\{1 + 2\}\textbackslash{}""}}p‾rint! @ f‾ormat< "<rect \"{1 + 2}\""{\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"<rect \textbackslash{}"\{1 + 2\}\textbackslash{}""}}
5p_rint! @ f_ormat< "class=\"light\" fill=\"{1}\" stroke=\"#000000\" stroke-width=\"4\""{\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"class=\textbackslash{}"light\textbackslash{}" fill=\textbackslash{}"\{1\}\textbackslash{}" stroke=\textbackslash{}"\#000000\textbackslash{}" stroke-width=\textbackslash{}"4\textbackslash{}""}}p‾rint! @ f‾ormat< "class=\"light\" fill=\"{1}\" stroke=\"#000000\" stroke-width=\"4\""{\mathrm{\underline{p}rint}{!}}\ {@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{"class=\textbackslash{}"light\textbackslash{}" fill=\textbackslash{}"\{1\}\textbackslash{}" stroke=\textbackslash{}"\#000000\textbackslash{}" stroke-width=\textbackslash{}"4\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/gensym-opt-in.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"}}
6x := 10{\mathrm{x}}\ {\leftarrow}\ {10}x ← 10{\mathrm{x}}\ {\leftarrow}\ {10}
7@ x:b_inds< "x + 1"{@}\ {{}^{\mathrm{x}}\mathrm{\underline{b}inds}{<}}\ {\text{"x + 1"}}@ xb‾inds< "x + 1"{@}\ {{}^{\mathrm{x}}\mathrm{\underline{b}inds}{<}}\ {\text{"x + 1"}}
8t := 5{\mathrm{t}}\ {\leftarrow}\ {5}t ← 5{\mathrm{t}}\ {\leftarrow}\ {5}
9@ 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-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-check-at.case

4@ c_heck< "m"{@}\ {\mathrm{\underline{c}heck}{<}}\ {\text{"m"}}@ c‾heck< "m"{@}\ {\mathrm{\underline{c}heck}{<}}\ {\text{"m"}}

spec/macros/reject-code-on-text-side.case

7@ f_ormat< c"from 3..4"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{c"}}{\mathrm{from}}\ {\text{3.}}{\text{.}}{4}{\text{"}}@ f‾ormat< c"from 3..4"{@}\ {\mathrm{\underline{f}ormat}{<}}\ {\text{c"}}{\mathrm{from}}\ {\text{3.}}{\text{.}}{4}{\text{"}}

spec/macros/reject-code-pipe.case

4c"2 > 0" i_f< c"1 |> n_eg; 0"{\text{c"}}{2}\ {>}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{1}\ {\triangleright}\ {\mathrm{\underline{n}eg}}{\diamond}\ {0}{\text{"}}c"2 > 0" i‾f< c"1 ▹ n‾eg⋄ 0"{\text{c"}}{2}\ {>}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{1}\ {\triangleright}\ {\mathrm{\underline{n}eg}}{\diamond}\ {0}{\text{"}}

spec/macros/reject-code-unclosed.case

4c"2 > 0" i_f< c"n_eg (1; 0"{\text{c"}}{2}\ {>}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\mathrm{\underline{n}eg}}\ {(}{1}{\diamond}\ {0}{\text{"}}c"2 > 0" i‾f< c"n‾eg (1⋄ 0"{\text{c"}}{2}\ {>}\ {0}{\text{"}}\ {\mathrm{\underline{i}f}{<}}\ {\text{c"}}{\mathrm{\underline{n}eg}}\ {(}{1}{\diamond}\ {0}{\text{"}}

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-contract-shape.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"}}
6"1" x:b_inds< "x + 1"{\text{"1"}}\ {{}^{\mathrm{x}}\mathrm{\underline{b}inds}{<}}\ {\text{"x + 1"}}"1" xb‾inds< "x + 1"{\text{"1"}}\ {{}^{\mathrm{x}}\mathrm{\underline{b}inds}{<}}\ {\text{"x + 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-gensym-outside.case

4[]G_ENSYM "t"{\square \mathrm{\underline{G}ENSYM}}\ {\text{"t"}}□G‾ENSYM "t"{\square \mathrm{\underline{G}ENSYM}}\ {\text{"t"}}

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-shadow-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 * 2 } e_ach it"{\text{"3 + 4"}}\ {{}^{\mathrm{x}}\mathrm{\underline{w}ith}{<}}\ {\text{"'\{ it -> it * 2 \} e\_ach it"}}"3 + 4" xw‾ith< "’{ it -> it * 2 } e_ach it"{\text{"3 + 4"}}\ {{}^{\mathrm{x}}\mathrm{\underline{w}ith}{<}}\ {\text{"'\{ it -> it * 2 \} e\_ach it"}}

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"}}
6z := 0{\mathrm{z}}\ {\leftarrow}\ {0}z ← 0{\mathrm{z}}\ {\leftarrow}\ {0}
7"z = 0" u_nless< "p_rint! 100 / z"{\text{"z = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / z"}}"z = 0" u‾nless< "p_rint! 100 / z"{\text{"z = 0"}}\ {\mathrm{\underline{u}nless}{<}}\ {\text{"p\_rint! 100 / z"}}

spec/macros/unreachable-bare.case

3@ u_nreachable< @{@}\ {\mathrm{\underline{u}nreachable}{<}}\ {@}@ u‾nreachable< @{@}\ {\mathrm{\underline{u}nreachable}{<}}\ {@}

spec/macros/unreachable-reached.case

4u:d_igit := { d -> d < 10 ? d; @ u_nreachable< "a digit is less than 10" }{{}^{\mathrm{u}}\mathrm{\underline{d}igit}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}\ {\mathrm{d}}\ {<}\ {10}\ {?}\ {\mathrm{d}}{\diamond}\ {@}\ {\mathrm{\underline{u}nreachable}{<}}\ {\text{"a digit is less than 10"}}\ {\}}ud‾igit ← { d → d < 10 ? d⋄ @ u‾nreachable< "a digit is less than 10" }{{}^{\mathrm{u}}\mathrm{\underline{d}igit}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}\ {\mathrm{d}}\ {<}\ {10}\ {?}\ {\mathrm{d}}{\diamond}\ {@}\ {\mathrm{\underline{u}nreachable}{<}}\ {\text{"a digit is less than 10"}}\ {\}}
5u:d_igit 12{{}^{\mathrm{u}}\mathrm{\underline{d}igit}}\ {12}ud‾igit 12{{}^{\mathrm{u}}\mathrm{\underline{d}igit}}\ {12}

spec/macros/unreachable.case

4u:d_igit := { d -> d < 10 ? d; @ u_nreachable< "a digit is less than 10" }{{}^{\mathrm{u}}\mathrm{\underline{d}igit}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}\ {\mathrm{d}}\ {<}\ {10}\ {?}\ {\mathrm{d}}{\diamond}\ {@}\ {\mathrm{\underline{u}nreachable}{<}}\ {\text{"a digit is less than 10"}}\ {\}}ud‾igit ← { d → d < 10 ? d⋄ @ u‾nreachable< "a digit is less than 10" }{{}^{\mathrm{u}}\mathrm{\underline{d}igit}}\ {\leftarrow}\ {\{}\ {\mathrm{d}}\ {\to}\ {\mathrm{d}}\ {<}\ {10}\ {?}\ {\mathrm{d}}{\diamond}\ {@}\ {\mathrm{\underline{u}nreachable}{<}}\ {\text{"a digit is less than 10"}}\ {\}}
5u:d_igit 7{{}^{\mathrm{u}}\mathrm{\underline{d}igit}}\ {7}ud‾igit 7{{}^{\mathrm{u}}\mathrm{\underline{d}igit}}\ {7}

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:t_est< "addition"{\mathrm{r}}\ {\leftarrow}\ {\text{"4 = 2 + 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{t}est}{<}}\ {\text{"addition"}}r ← "4 = 2 + 2" xt‾est< "addition"{\mathrm{r}}\ {\leftarrow}\ {\text{"4 = 2 + 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{t}est}{<}}\ {\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:t_est< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{t}est}{<}}\ {\text{"addition"}}"4 = 2 + 2" xt‾est< "addition"{\text{"4 = 2 + 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{t}est}{<}}\ {\text{"addition"}}
12"5 = 2 * 2" x:t_est< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{t}est}{<}}\ {\text{"doubling"}}"5 = 2 * 2" xt‾est< "doubling"{\text{"5 = 2 * 2"}}\ {{}^{\mathrm{x}}\mathrm{\underline{t}est}{<}}\ {\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/doc-comments.case

5u:t_wice := { 2 * _r } ## a remark{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\{}\ {2}\ {\times}\ {\_\mathrm{r}}\ {\}}ut‾wice ← { 2 × _r }{{}^{\mathrm{u}}\mathrm{\underline{t}wice}}\ {\leftarrow}\ {\{}\ {2}\ {\times}\ {\_\mathrm{r}}\ {\}}

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/render/unused-param.case

4{ x ~_u -> x } 1 2{\{}\ {\mathrm{x}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {\}}\ {1}\ {2}{ x ∼_u → x } 1 2{\{}\ {\mathrm{x}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {\}}\ {1}\ {2}
5{ _l + _r }{\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}{ _l + _r }{\{}\ {\_\mathrm{l}}\ {+}\ {\_\mathrm{r}}\ {\}}

spec/spatial/macro-name-needs-underline.case

4e:q< "a"{{}^{\mathrm{e}}\mathrm{q}}{<}\ {\text{"a"}}eq< "a"{{}^{\mathrm{e}}\mathrm{q}}{<}\ {\text{"a"}}

spec/spatial/reject-bracket-index.case

4X := 2 3 r_eshape r_ange 6{\mathrm{X}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}X ← 2 3 r‾eshape r‾ange 6{\mathrm{X}}\ {\leftarrow}\ {2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}
5X[1,2,3]{\mathrm{X}}{[}{1}{,}{2}{,}{3}{]}X[1,2,3]{\mathrm{X}}{[}{1}{,}{2}{,}{3}{]}

spec/spatial/reject-call-as-macro-argument.case

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

spec/spatial/reject-name-minus-one.case

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

spec/spatial/reject-plus-slash.case

4+/ 1 2 3{+}{\div}\ {1}\ {2}\ {3}+÷ 1 2 3{+}{\div}\ {1}\ {2}\ {3}

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{\underline{(}}{\mathrm{\underline{s}wap}}\ {\text{'}}{-}{\underline{)}}\ {3}(‾s‾wap ’−)‾ 3{\underline{(}}{\mathrm{\underline{s}wap}}\ {\text{'}}{-}{\underline{)}}\ {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-label-in-code.case

4x $h{\mathrm{x}}\ {\scriptstyle\triangleright}{\mathrm{h}}x ▹h{\mathrm{x}}\ {\scriptstyle\triangleright}{\mathrm{h}}

spec/syntax/reject-pipe-in-code.case

4x |> f_ x{\mathrm{x}}\ {\triangleright}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}x ▹ f‾ x{\mathrm{x}}\ {\triangleright}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}

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/reject-unused-read.case

3{ x _u -> _u }{\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\_\mathrm{u}}\ {\}}{ x _u → _u }{\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\_\mathrm{u}}\ {\}}

spec/syntax/reject-unused-shorthand.case

3{ _u + 1 }{\{}\ {\_\mathrm{u}}\ {+}\ {1}\ {\}}{ _u + 1 }{\{}\ {\_\mathrm{u}}\ {+}\ {1}\ {\}}

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}

spec/syntax/unused-param.case

5{ x _u -> x + 1 }{\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {+}\ {1}\ {\}}{ x _u → x + 1 }{\{}\ {\mathrm{x}}\ {\_\mathrm{u}}\ {\to}\ {\mathrm{x}}\ {+}\ {1}\ {\}}
6{ _u _u -> 0 }{\{}\ {\_\mathrm{u}}\ {\_\mathrm{u}}\ {\to}\ {0}\ {\}}{ _u _u → 0 }{\{}\ {\_\mathrm{u}}\ {\_\mathrm{u}}\ {\to}\ {0}\ {\}}
7{ a ~_u -> a }{\{}\ {\mathrm{a}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{a}}\ {\}}{ a ∼_u → a }{\{}\ {\mathrm{a}}\ {\sim}{\_\mathrm{u}}\ {\to}\ {\mathrm{a}}\ {\}}

spec/tuples/any-types.case

4u:k_eep := { s -> s }{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {\mathrm{s}}\ {\}}uk‾eep ← { s → s }{{}^{\mathrm{u}}\mathrm{\underline{k}eep}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {\mathrm{s}}\ {\}}
5u:r_evd := { x -> r_ev x }{{}^{\mathrm{u}}\mathrm{\underline{r}evd}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{r}ev}}\ {\mathrm{x}}\ {\}}ur‾evd ← { x → r‾ev x }{{}^{\mathrm{u}}\mathrm{\underline{r}evd}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{r}ev}}\ {\mathrm{x}}\ {\}}
6u:p_air := { x -> (x, r_ev x) }{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{x}}{,}\ {\mathrm{\underline{r}ev}}\ {\mathrm{x}}{)}\ {\}}up‾air ← { x → (x, r‾ev x) }{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{x}}{,}\ {\mathrm{\underline{r}ev}}\ {\mathrm{x}}{)}\ {\}}
7u:a_pply := { f_ x -> f_ x }{{}^{\mathrm{u}}\mathrm{\underline{a}pply}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}ua‾pply ← { f‾ x → f‾ x }{{}^{\mathrm{u}}\mathrm{\underline{a}pply}}\ {\leftarrow}\ {\{}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{f}}}\ {\mathrm{x}}\ {\}}

spec/tuples/boxed-match.case

3(e_nclose (1, 2.5)) m_atch e_nclose (1, 2.5){(}{\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}(e‾nclose (1, 2.5)) m‾atch e‾nclose (1, 2.5){(}{\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}
4(e_nclose (1, 2.5)) m_atch e_nclose (1, 3.5){(}{\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {3.5}{)}(e‾nclose (1, 2.5)) m‾atch e‾nclose (1, 3.5){(}{\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}{)}\ {\mathrm{\underline{m}atch}}\ {\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {3.5}{)}

spec/tuples/boxed-print.case

4ps := '{ k -> (k, f_loat k) } m_ap r_ange 3{\mathrm{ps}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {3}ps ← ’{ k → (k, f‾loat k) } m‾ap r‾ange 3{\mathrm{ps}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {3}
5t_ally ps{\mathrm{\underline{t}ally}}\ {\mathrm{ps}}t‾ally ps{\mathrm{\underline{t}ally}}\ {\mathrm{ps}}
6r_ev ps{\mathrm{\underline{r}ev}}\ {\mathrm{ps}}r‾ev ps{\mathrm{\underline{r}ev}}\ {\mathrm{ps}}
7e_nclose (1, 2.5){\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}e‾nclose (1, 2.5){\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2.5}{)}

spec/tuples/boxed-tall.case

3'{ k -> (k, 2 2 r_eshape k) } m_ap 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}’{ k → (k, 2 2 r‾eshape k) } m‾ap 1 2{\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {2}\ {2}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {1}\ {2}

spec/tuples/boxed.case

4ps := '{ k -> (k, f_loat k) } m_ap r_ange 3{\mathrm{ps}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {3}ps ← ’{ k → (k, f‾loat k) } m‾ap r‾ange 3{\mathrm{ps}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {3}
5(a, b) := d_isclose 2 s_elect ps{(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ps}}(a, b) ← d‾isclose 2 s‾elect ps{(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\leftarrow}\ {\mathrm{\underline{d}isclose}}\ {2}\ {\mathrm{\underline{s}elect}}\ {\mathrm{ps}}
6a{\mathrm{a}}a{\mathrm{a}}
7b{\mathrm{b}}b{\mathrm{b}}

spec/tuples/condition-in-nested-tuple.case

3t := ((1, 2 > 1), 7){\mathrm{t}}\ {\leftarrow}\ {(}{(}{1}{,}\ {2}\ {>}\ {1}{)}{,}\ {7}{)}t ← ((1, 2 > 1), 7){\mathrm{t}}\ {\leftarrow}\ {(}{(}{1}{,}\ {2}\ {>}\ {1}{)}{,}\ {7}{)}
4((a, c), b) := t{(}{(}{\mathrm{a}}{,}\ {\mathrm{c}}{)}{,}\ {\mathrm{b}}{)}\ {\leftarrow}\ {\mathrm{t}}((a, c), b) ← t{(}{(}{\mathrm{a}}{,}\ {\mathrm{c}}{)}{,}\ {\mathrm{b}}{)}\ {\leftarrow}\ {\mathrm{t}}
5a + c + b{\mathrm{a}}\ {+}\ {\mathrm{c}}\ {+}\ {\mathrm{b}}a + c + b{\mathrm{a}}\ {+}\ {\mathrm{c}}\ {+}\ {\mathrm{b}}

spec/tuples/condition-in-tuple-guard.case

3u:p_air := { z -> (z, 0 < 1) }{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\leftarrow}\ {\{}\ {\mathrm{z}}\ {\to}\ {(}{\mathrm{z}}{,}\ {0}\ {<}\ {1}{)}\ {\}}up‾air ← { z → (z, 0 < 1) }{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\leftarrow}\ {\{}\ {\mathrm{z}}\ {\to}\ {(}{\mathrm{z}}{,}\ {0}\ {<}\ {1}{)}\ {\}}
4s := u:p_air 5{\mathrm{s}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {5}s ← up‾air 5{\mathrm{s}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {5}
5u:g_ := { (a, c) -> c ? a; 0 }{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{c}}{)}\ {\to}\ {\mathrm{c}}\ {?}\ {\mathrm{a}}{\diamond}\ {0}\ {\}}ug‾ ← { (a, c) → c ? a⋄ 0 }{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{c}}{)}\ {\to}\ {\mathrm{c}}\ {?}\ {\mathrm{a}}{\diamond}\ {0}\ {\}}
6u:n_ := { (a, c) -> a + c }{{}^{\mathrm{u}}\mathrm{\underline{n}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{c}}{)}\ {\to}\ {\mathrm{a}}\ {+}\ {\mathrm{c}}\ {\}}un‾ ← { (a, c) → a + c }{{}^{\mathrm{u}}\mathrm{\underline{n}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{c}}{)}\ {\to}\ {\mathrm{a}}\ {+}\ {\mathrm{c}}\ {\}}
7u:g_ s{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\mathrm{s}}ug‾ s{{}^{\mathrm{u}}\mathrm{\underline{g}}}\ {\mathrm{s}}
8u:n_ s{{}^{\mathrm{u}}\mathrm{\underline{n}}}\ {\mathrm{s}}un‾ s{{}^{\mathrm{u}}\mathrm{\underline{n}}}\ {\mathrm{s}}

spec/tuples/condition-in-tuple.case

5u:n_um := { (a, m) -> 0 + m }{{}^{\mathrm{u}}\mathrm{\underline{n}um}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{m}}{)}\ {\to}\ {0}\ {+}\ {\mathrm{m}}\ {\}}un‾um ← { (a, m) → 0 + m }{{}^{\mathrm{u}}\mathrm{\underline{n}um}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{m}}{)}\ {\to}\ {0}\ {+}\ {\mathrm{m}}\ {\}}
6u:n_ew := { z -> (z, 0 < 1 2 3) }{{}^{\mathrm{u}}\mathrm{\underline{n}ew}}\ {\leftarrow}\ {\{}\ {\mathrm{z}}\ {\to}\ {(}{\mathrm{z}}{,}\ {0}\ {<}\ {1}\ {2}\ {3}{)}\ {\}}un‾ew ← { z → (z, 0 < 1 2 3) }{{}^{\mathrm{u}}\mathrm{\underline{n}ew}}\ {\leftarrow}\ {\{}\ {\mathrm{z}}\ {\to}\ {(}{\mathrm{z}}{,}\ {0}\ {<}\ {1}\ {2}\ {3}{)}\ {\}}
7s := u:n_ew 5{\mathrm{s}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ew}}\ {5}s ← un‾ew 5{\mathrm{s}}\ {\leftarrow}\ {{}^{\mathrm{u}}\mathrm{\underline{n}ew}}\ {5}
8u:n_um s{{}^{\mathrm{u}}\mathrm{\underline{n}um}}\ {\mathrm{s}}un‾um s{{}^{\mathrm{u}}\mathrm{\underline{n}um}}\ {\mathrm{s}}

spec/tuples/eq-with-arrays.case

4u:f_ind := { x y -> (r_ev x) i_ndexOf y }{{}^{\mathrm{u}}\mathrm{\underline{f}ind}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {(}{\mathrm{\underline{r}ev}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{y}}\ {\}}uf‾ind ← { x y → (r‾ev x) i‾ndexOf y }{{}^{\mathrm{u}}\mathrm{\underline{f}ind}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\mathrm{y}}\ {\to}\ {(}{\mathrm{\underline{r}ev}}\ {\mathrm{x}}{)}\ {\mathrm{\underline{i}ndexOf}}\ {\mathrm{y}}\ {\}}
5u:o_rd := { x -> s_ort r_ev x }{{}^{\mathrm{u}}\mathrm{\underline{o}rd}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{x}}\ {\}}uo‾rd ← { x → s‾ort r‾ev x }{{}^{\mathrm{u}}\mathrm{\underline{o}rd}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {\mathrm{\underline{s}ort}}\ {\mathrm{\underline{r}ev}}\ {\mathrm{x}}\ {\}}

spec/tuples/lambda-body-tuple.case

4{ (_r, _r * 2) } 3{\{}\ {(}{\_\mathrm{r}}{,}\ {\_\mathrm{r}}\ {\times}\ {2}{)}\ {\}}\ {3}{ (_r, _r × 2) } 3{\{}\ {(}{\_\mathrm{r}}{,}\ {\_\mathrm{r}}\ {\times}\ {2}{)}\ {\}}\ {3}

spec/tuples/literal-arrays.case

4(1 2 3, 4.5, 2 * 3 + 1){(}{1}\ {2}\ {3}{,}\ {4.5}{,}\ {2}\ {\times}\ {3}\ {+}\ {1}{)}(1 2 3, 4.5, 2 × 3 + 1){(}{1}\ {2}\ {3}{,}\ {4.5}{,}\ {2}\ {\times}\ {3}\ {+}\ {1}{)}

spec/tuples/literal-grouping.case

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

spec/tuples/literal-pair.case

4(1, 2.5){(}{1}{,}\ {2.5}{)}(1, 2.5){(}{1}{,}\ {2.5}{)}

spec/tuples/match-shape.case

3(1 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}{)}
4(1 2, 3) m_atch (2 1 r_eshape 1 2, 3){(}{1}\ {2}{,}\ {3}{)}\ {\mathrm{\underline{m}atch}}\ {(}{2}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}{,}\ {3}{)}(1 2, 3) m‾atch (2 1 r‾eshape 1 2, 3){(}{1}\ {2}{,}\ {3}{)}\ {\mathrm{\underline{m}atch}}\ {(}{2}\ {1}\ {\mathrm{\underline{r}eshape}}\ {1}\ {2}{,}\ {3}{)}

spec/tuples/match.case

3(1, 2.5) m_atch (1, 2.5){(}{1}{,}\ {2.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}{,}\ {2.5}{)}(1, 2.5) m‾atch (1, 2.5){(}{1}{,}\ {2.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}{,}\ {2.5}{)}
4(1, 2.5) m_atch (1, 3.5){(}{1}{,}\ {2.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}{,}\ {3.5}{)}(1, 2.5) m‾atch (1, 3.5){(}{1}{,}\ {2.5}{)}\ {\mathrm{\underline{m}atch}}\ {(}{1}{,}\ {3.5}{)}

spec/tuples/pattern-binding.case

3s := (1, 2.5, "ab"){\mathrm{s}}\ {\leftarrow}\ {(}{1}{,}\ {2.5}{,}\ {\text{"ab"}}{)}s ← (1, 2.5, "ab"){\mathrm{s}}\ {\leftarrow}\ {(}{1}{,}\ {2.5}{,}\ {\text{"ab"}}{)}
4(n, x, t) := s{(}{\mathrm{n}}{,}\ {\mathrm{x}}{,}\ {\mathrm{t}}{)}\ {\leftarrow}\ {\mathrm{s}}(n, x, t) ← s{(}{\mathrm{n}}{,}\ {\mathrm{x}}{,}\ {\mathrm{t}}{)}\ {\leftarrow}\ {\mathrm{s}}
5n{\mathrm{n}}n{\mathrm{n}}
6x{\mathrm{x}}x{\mathrm{x}}
7t{\mathrm{t}}t{\mathrm{t}}

spec/tuples/pattern-core-spacing.case

4s := (1, (2, 3), 4){\mathrm{s}}\ {\leftarrow}\ {(}{1}{,}\ {(}{2}{,}\ {3}{)}{,}\ {4}{)}s ← (1, (2, 3), 4){\mathrm{s}}\ {\leftarrow}\ {(}{1}{,}\ {(}{2}{,}\ {3}{)}{,}\ {4}{)}
5( a,( b,_ ),{(}\ {\mathrm{a}}{,}{(}\ {\mathrm{b}}{,}{\_}\ {)}{,}( a,( b,_ ),{(}\ {\mathrm{a}}{,}{(}\ {\mathrm{b}}{,}{\_}\ {)}{,}
6 c ) := s\ \ {\mathrm{c}}\ {)}\ {\leftarrow}\ {\mathrm{s}}  c ) ← s\ \ {\mathrm{c}}\ {)}\ {\leftarrow}\ {\mathrm{s}}

spec/tuples/pattern-core.case

5s := (1, (2, 3), 4){\mathrm{s}}\ {\leftarrow}\ {(}{1}{,}\ {(}{2}{,}\ {3}{)}{,}\ {4}{)}s ← (1, (2, 3), 4){\mathrm{s}}\ {\leftarrow}\ {(}{1}{,}\ {(}{2}{,}\ {3}{)}{,}\ {4}{)}
6(a, (b, _), c) := s{(}{\mathrm{a}}{,}\ {(}{\mathrm{b}}{,}\ {\_}{)}{,}\ {\mathrm{c}}{)}\ {\leftarrow}\ {\mathrm{s}}(a, (b, _), c) ← s{(}{\mathrm{a}}{,}\ {(}{\mathrm{b}}{,}\ {\_}{)}{,}\ {\mathrm{c}}{)}\ {\leftarrow}\ {\mathrm{s}}

spec/tuples/pattern-dyadic.case

3u:s_cale := { (a, b) k -> (a * k, b * k) }{{}^{\mathrm{u}}\mathrm{\underline{s}cale}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{a}}\ {\times}\ {\mathrm{k}}{,}\ {\mathrm{b}}\ {\times}\ {\mathrm{k}}{)}\ {\}}us‾cale ← { (a, b) k → (a × k, b × k) }{{}^{\mathrm{u}}\mathrm{\underline{s}cale}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{a}}\ {\times}\ {\mathrm{k}}{,}\ {\mathrm{b}}\ {\times}\ {\mathrm{k}}{)}\ {\}}
4(1 2, 3) u:s_cale 2{(}{1}\ {2}{,}\ {3}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{s}cale}}\ {2}(1 2, 3) us‾cale 2{(}{1}\ {2}{,}\ {3}{)}\ {{}^{\mathrm{u}}\mathrm{\underline{s}cale}}\ {2}

spec/tuples/pattern-local.case

4u:n_orm := { s -> (x, y) := s; (x * x) + y * y }{{}^{\mathrm{u}}\mathrm{\underline{n}orm}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {(}{\mathrm{x}}{,}\ {\mathrm{y}}{)}\ {\leftarrow}\ {\mathrm{s}}{\diamond}\ {(}{\mathrm{x}}\ {\times}\ {\mathrm{x}}{)}\ {+}\ {\mathrm{y}}\ {\times}\ {\mathrm{y}}\ {\}}un‾orm ← { s → (x, y) ← s⋄ (x × x) + y × y }{{}^{\mathrm{u}}\mathrm{\underline{n}orm}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {(}{\mathrm{x}}{,}\ {\mathrm{y}}{)}\ {\leftarrow}\ {\mathrm{s}}{\diamond}\ {(}{\mathrm{x}}\ {\times}\ {\mathrm{x}}{)}\ {+}\ {\mathrm{y}}\ {\times}\ {\mathrm{y}}\ {\}}
5u:n_orm (3, 4){{}^{\mathrm{u}}\mathrm{\underline{n}orm}}\ {(}{3}{,}\ {4}{)}un‾orm (3, 4){{}^{\mathrm{u}}\mathrm{\underline{n}orm}}\ {(}{3}{,}\ {4}{)}

spec/tuples/pattern-nested.case

3((a, b), c) := ((1, 2), 3){(}{(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}{,}\ {\mathrm{c}}{)}\ {\leftarrow}\ {(}{(}{1}{,}\ {2}{)}{,}\ {3}{)}((a, b), c) ← ((1, 2), 3){(}{(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}{,}\ {\mathrm{c}}{)}\ {\leftarrow}\ {(}{(}{1}{,}\ {2}{)}{,}\ {3}{)}
4a + b + c{\mathrm{a}}\ {+}\ {\mathrm{b}}\ {+}\ {\mathrm{c}}a + b + c{\mathrm{a}}\ {+}\ {\mathrm{b}}\ {+}\ {\mathrm{c}}

spec/tuples/pattern-parameter-core.case

4u:f_ := { (a, b) k -> a + k }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\mathrm{k}}\ {\to}\ {\mathrm{a}}\ {+}\ {\mathrm{k}}\ {\}}uf‾ ← { (a, b) k → a + k }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\mathrm{k}}\ {\to}\ {\mathrm{a}}\ {+}\ {\mathrm{k}}\ {\}}

spec/tuples/pattern-parameter.case

4u:s_wapped := { (a, b) -> (b, a) }{{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\to}\ {(}{\mathrm{b}}{,}\ {\mathrm{a}}{)}\ {\}}us‾wapped ← { (a, b) → (b, a) }{{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\to}\ {(}{\mathrm{b}}{,}\ {\mathrm{a}}{)}\ {\}}
5u:s_wapped (1, "x"){{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {(}{1}{,}\ {\text{"x"}}{)}us‾wapped (1, "x"){{}^{\mathrm{u}}\mathrm{\underline{s}wapped}}\ {(}{1}{,}\ {\text{"x"}}{)}

spec/tuples/pattern-wildcard.case

3(w, _, _, k) := (1, 2, 3, 4){(}{\mathrm{w}}{,}\ {\_}{,}\ {\_}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {(}{1}{,}\ {2}{,}\ {3}{,}\ {4}{)}(w, _, _, k) ← (1, 2, 3, 4){(}{\mathrm{w}}{,}\ {\_}{,}\ {\_}{,}\ {\mathrm{k}}{)}\ {\leftarrow}\ {(}{1}{,}\ {2}{,}\ {3}{,}\ {4}{)}
4w + k{\mathrm{w}}\ {+}\ {\mathrm{k}}w + k{\mathrm{w}}\ {+}\ {\mathrm{k}}

spec/tuples/plumbing.case

3u:p_air := { x -> (x, x) }{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{x}}{,}\ {\mathrm{x}}{)}\ {\}}up‾air ← { x → (x, x) }{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\leftarrow}\ {\{}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{x}}{,}\ {\mathrm{x}}{)}\ {\}}
4'u:p_air 'i_d c_ompose 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\text{'}}{\mathrm{\underline{i}d}}\ {\mathrm{\underline{c}ompose}}\ {3}’up‾air ’i‾d c‾ompose 3{\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{p}air}}\ {\text{'}}{\mathrm{\underline{i}d}}\ {\mathrm{\underline{c}ompose}}\ {3}
5(1, 2) 'l_eft s_wap 5{(}{1}{,}\ {2}{)}\ {\text{'}}{\mathrm{\underline{l}eft}}\ {\mathrm{\underline{s}wap}}\ {5}(1, 2) ’l‾eft s‾wap 5{(}{1}{,}\ {2}{)}\ {\text{'}}{\mathrm{\underline{l}eft}}\ {\mathrm{\underline{s}wap}}\ {5}
6i_d (1, "a"){\mathrm{\underline{i}d}}\ {(}{1}{,}\ {\text{"a"}}{)}i‾d (1, "a"){\mathrm{\underline{i}d}}\ {(}{1}{,}\ {\text{"a"}}{)}
7p_rint! (2, 3){\mathrm{\underline{p}rint}{!}}\ {(}{2}{,}\ {3}{)}p‾rint! (2, 3){\mathrm{\underline{p}rint}{!}}\ {(}{2}{,}\ {3}{)}

spec/tuples/power-m13.case

6u:r_estart := { s -> (0.5 0.5, 0.0 0.0, 0.0 0.0, 0) }{{}^{\mathrm{u}}\mathrm{\underline{r}estart}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {(}{0.5}\ {0.5}{,}\ {0.0}\ {0.0}{,}\ {0.0}\ {0.0}{,}\ {0}{)}\ {\}}ur‾estart ← { s → (0.5 0.5, 0.0 0.0, 0.0 0.0, 0) }{{}^{\mathrm{u}}\mathrm{\underline{r}estart}}\ {\leftarrow}\ {\{}\ {\mathrm{s}}\ {\to}\ {(}{0.5}\ {0.5}{,}\ {0.0}\ {0.0}{,}\ {0.0}\ {0.0}{,}\ {0}{)}\ {\}}
73 'u:r_estart p_ower (1.0 2.0, 0.1 0.2, 0.3 0.4, 7){3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}estart}}\ {\mathrm{\underline{p}ower}}\ {(}{1.0}\ {2.0}{,}\ {0.1}\ {0.2}{,}\ {0.3}\ {0.4}{,}\ {7}{)}3 ’ur‾estart p‾ower (1.0 2.0, 0.1 0.2, 0.3 0.4, 7){3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{r}estart}}\ {\mathrm{\underline{p}ower}}\ {(}{1.0}\ {2.0}{,}\ {0.1}\ {0.2}{,}\ {0.3}\ {0.4}{,}\ {7}{)}

spec/tuples/power-state.case

3u:s_tep := { (w, k) -> (w * 0.5, k + 1) }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{w}}{,}\ {\mathrm{k}}{)}\ {\to}\ {(}{\mathrm{w}}\ {\times}\ {0.5}{,}\ {\mathrm{k}}\ {+}\ {1}{)}\ {\}}us‾tep ← { (w, k) → (w × 0.5, k + 1) }{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{w}}{,}\ {\mathrm{k}}{)}\ {\to}\ {(}{\mathrm{w}}\ {\times}\ {0.5}{,}\ {\mathrm{k}}\ {+}\ {1}{)}\ {\}}
43 'u:s_tep p_ower (8.0 4.0, 0){3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{8.0}\ {4.0}{,}\ {0}{)}3 ’us‾tep p‾ower (8.0 4.0, 0){3}\ {\text{'}}{{}^{\mathrm{u}}\mathrm{\underline{s}tep}}\ {\mathrm{\underline{p}ower}}\ {(}{8.0}\ {4.0}{,}\ {0}{)}

spec/tuples/print-tall-last.case

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

spec/tuples/print-tall.case

5(2 3 r_eshape r_ange 6, 4.5){(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{,}\ {4.5}{)}(2 3 r‾eshape r‾ange 6, 4.5){(}{2}\ {3}\ {\mathrm{\underline{r}eshape}}\ {\mathrm{\underline{r}ange}}\ {6}{,}\ {4.5}{)}

spec/tuples/reject-arithmetic.case

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

spec/tuples/reject-array-builtin.case

4r_ev (1, 2){\mathrm{\underline{r}ev}}\ {(}{1}{,}\ {2}{)}r‾ev (1, 2){\mathrm{\underline{r}ev}}\ {(}{1}{,}\ {2}{)}

spec/tuples/reject-boxed-equals.case

3(e_nclose (1, 2)) = e_nclose (1, 2){(}{\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2}{)}{)}\ {=}\ {\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2}{)}(e‾nclose (1, 2)) = e‾nclose (1, 2){(}{\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2}{)}{)}\ {=}\ {\mathrm{\underline{e}nclose}}\ {(}{1}{,}\ {2}{)}

spec/tuples/reject-comma-outside.case

31, 2{1}{,}\ {2}1, 2{1}{,}\ {2}

spec/tuples/reject-disclose-many.case

4ps := '{ k -> (k, f_loat k) } m_ap r_ange 3{\mathrm{ps}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {3}ps ← ’{ k → (k, f‾loat k) } m‾ap r‾ange 3{\mathrm{ps}}\ {\leftarrow}\ {\text{'}}{\{}\ {\mathrm{k}}\ {\to}\ {(}{\mathrm{k}}{,}\ {\mathrm{\underline{f}loat}}\ {\mathrm{k}}{)}\ {\}}\ {\mathrm{\underline{m}ap}}\ {\mathrm{\underline{r}ange}}\ {3}
5d_isclose ps{\mathrm{\underline{d}isclose}}\ {\mathrm{ps}}d‾isclose ps{\mathrm{\underline{d}isclose}}\ {\mathrm{ps}}

spec/tuples/reject-each-tuple.case

4'{ x -> (x, x) } e_ach 1 2 3{\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{x}}{,}\ {\mathrm{x}}{)}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}’{ x → (x, x) } e‾ach 1 2 3{\text{'}}{\{}\ {\mathrm{x}}\ {\to}\ {(}{\mathrm{x}}{,}\ {\mathrm{x}}{)}\ {\}}\ {\mathrm{\underline{e}ach}}\ {1}\ {2}\ {3}

spec/tuples/reject-equals.case

3(1, 2) = (1, 2){(}{1}{,}\ {2}{)}\ {=}\ {(}{1}{,}\ {2}{)}(1, 2) = (1, 2){(}{1}{,}\ {2}{)}\ {=}\ {(}{1}{,}\ {2}{)}

spec/tuples/reject-pattern-literal.case

4(a, 1) := (1, 2){(}{\mathrm{a}}{,}\ {1}{)}\ {\leftarrow}\ {(}{1}{,}\ {2}{)}(a, 1) ← (1, 2){(}{\mathrm{a}}{,}\ {1}{)}\ {\leftarrow}\ {(}{1}{,}\ {2}{)}

spec/tuples/reject-pattern-not-tuple.case

3(a, b) := 1 2{(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\leftarrow}\ {1}\ {2}(a, b) ← 1 2{(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\leftarrow}\ {1}\ {2}

spec/tuples/reject-pattern-one-part.case

4(a) := 1{(}{\mathrm{a}}{)}\ {\leftarrow}\ {1}(a) ← 1{(}{\mathrm{a}}{)}\ {\leftarrow}\ {1}

spec/tuples/reject-pattern-size.case

4(a, b) := (1, 2, 3){(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\leftarrow}\ {(}{1}{,}\ {2}{,}\ {3}{)}(a, b) ← (1, 2, 3){(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\leftarrow}\ {(}{1}{,}\ {2}{,}\ {3}{)}

spec/tuples/reject-pattern-twice-params.case

4u:f_ := { (a, b) a -> a }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\mathrm{a}}\ {\to}\ {\mathrm{a}}\ {\}}uf‾ ← { (a, b) a → a }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {(}{\mathrm{a}}{,}\ {\mathrm{b}}{)}\ {\mathrm{a}}\ {\to}\ {\mathrm{a}}\ {\}}

spec/tuples/reject-pattern-twice.case

3(a, a) := (1, 2){(}{\mathrm{a}}{,}\ {\mathrm{a}}{)}\ {\leftarrow}\ {(}{1}{,}\ {2}{)}(a, a) ← (1, 2){(}{\mathrm{a}}{,}\ {\mathrm{a}}{)}\ {\leftarrow}\ {(}{1}{,}\ {2}{)}

spec/tuples/reject-reshape-tuple.case

32 r_eshape (1, 2){2}\ {\mathrm{\underline{r}eshape}}\ {(}{1}{,}\ {2}{)}2 r‾eshape (1, 2){2}\ {\mathrm{\underline{r}eshape}}\ {(}{1}{,}\ {2}{)}

spec/tuples/reject-trailing-comma.case

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

spec/tuples/reject-tuple-items.case

4(1, 2) c_at 3{(}{1}{,}\ {2}{)}\ {\mathrm{\underline{c}at}}\ {3}(1, 2) c‾at 3{(}{1}{,}\ {2}{)}\ {\mathrm{\underline{c}at}}\ {3}

spec/tuples/reject-tuple-strand.case

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

spec/tuples/reject-underscore-outside.case

3_ + 1{\_}\ {+}\ {1}_ + 1{\_}\ {+}\ {1}

spec/tuples/reject-wild-parameter.case

4u:f_ := { _ x -> x }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\_}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}uf‾ ← { _ x → x }{{}^{\mathrm{u}}\mathrm{\underline{f}}}\ {\leftarrow}\ {\{}\ {\_}\ {\mathrm{x}}\ {\to}\ {\mathrm{x}}\ {\}}

Literate documents · Live demo · Repository