diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b8dbd77 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: CI + +on: + push: + branches: ['**'] + paths-ignore: + - '**.md' + - 'docs/**' + pull_request: + branches: [master] + paths-ignore: + - '**.md' + - 'docs/**' + +env: + RUST_BACKTRACE: full + RUST_LOG: info + MINIMAL_LOG_FORMAT: true + HOONC: ~/.nockup/bin/hoonc + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2025-02-14 + + - name: Cache cargo + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Cache jockc.jam + uses: actions/cache@v4 + with: + path: | + assets/jockc.jam + ~/.nockapp/hoonc + key: ${{ runner.os }}-jockc-jam-${{ hashFiles('crates/jockc/hoon/**', 'common/hoon/lib/**') }} + restore-keys: | + ${{ runner.os }}-jockc-jam- + + - name: Install hoonc via Nockup + run: | + curl -fsSL https://raw.githubusercontent.com/nockchain/nockchain/refs/heads/master/crates/nockup/install.sh | bash + echo "$HOME/.nockup/bin" >> $GITHUB_PATH + $HOME/.nockup/bin/nockup update + + - name: Build jockc.jam + # Touch source files to ensure Make sees them as newer than any cache-restored jam. + # GitHub Actions cache restore sets restored file timestamps to "now", same as checkout, + # so Make may incorrectly consider the jam up-to-date when it is actually stale. + run: | + find crates/jockc/hoon common/hoon/lib -name '*.hoon' | xargs touch + make assets/jockc.jam + + - name: Build jockc + run: cargo build --profile release --bin jockc + + - name: Run Jock tests + run: bash common/tests/run-all-tests.sh + env: + PARALLEL: 4 + TEST_TIMEOUT: 120 diff --git a/Cargo.lock b/Cargo.lock index 62390c3..fe196f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1855,6 +1855,7 @@ name = "jockc" version = "0.1.0-alpha" dependencies = [ "clap", + "either", "nockapp", "nockvm", "nockvm_macros", diff --git a/Makefile b/Makefile index 09a6b2b..0036c80 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ help: PROFILE_DEV_DEBUG = --profile dev PROFILE_RELEASE = --profile release -HOONC = hoonc +HOONC ?= ~/.cargo/bin/hoonc .PHONY: build build: build-dev-debug @@ -66,6 +66,12 @@ release-test-all: .PHONY: build build: jockc jockt ## Build the Jock compiler and tester +.PHONY: clean-jam +clean-jam: ## Clean just the jam files to force Hoon recompilation + -find assets -name '*.jam' -delete 2>/dev/null; true + -command rm -rf .data.hoonc/ 2>/dev/null; true + -command rm -rf $(HOME)/.nockapp/hoonc/ 2>/dev/null; true + .PHONY: clean clean: ## Clean all projects @set -e; \ @@ -84,7 +90,7 @@ assets: ## Create the assets directory @mkdir -p assets assets/jockc.jam: assets $(JOCKC_HOON_SOURCES) - RUST_LOG=trace MINIMAL_LOG_FORMAT=true $(HOONC) crates/jockc/hoon/main.hoon crates/jockc/hoon + RUST_LOG=trace,gnort=off MINIMAL_LOG_FORMAT=true $(HOONC) crates/jockc/hoon/main.hoon crates/jockc/hoon mv out.jam assets/jockc.jam assets/jockt.jam: assets $(JOCKT_HOON_SOURCES) diff --git a/README.md b/README.md index c07a67b..d034b2a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Jock, a friendly and practical programming language -This is a developer preview of Jock, a friendly programming language that compiles to the [Nock instruction set architecture](#nock). +**Status February 2026** Jock was originally developed under the auspices of [Zorp Corp](https://github.com/zorp-corp), the primary developers of Nockchain. They released a developer preview and sponsored Jock's development to an alpha release before dropping it from the NockApp roadmap. However, many more features were planned for the Jock beta release and these are now underway. - [Jock language site](https://jock.org) - [@JockNockISA on X](https://x.com/JockNockISA) @@ -117,6 +117,8 @@ If you are developing Jock code, you should use the Jock compiler tool `jockc`. ### `jockt` Jock Test Framework +**Status February 2026** `jockt` is not working during beta development because it relies on the AST which is changing quickly. + If you are developing Jock itself, you should use the Jock testing tool `jockt` to verify behavior. 9. Build the Jock testing tool: @@ -171,3 +173,4 @@ If you are developing Jock itself, you should use the Jock testing tool `jockt` - [0.0.0-dp, Developer Preview](https://zorp.io/blog/jock), ~2024.10.24 - 0.1.0-alpha, ~2025.6.26 +- 0.2.0-beta, ongoing by @sigilante diff --git a/ROADMAP.md b/ROADMAP.md index a4cf602..539cd41 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,5 +1,20 @@ # Roadmap +## `BasedAtom` type + +Add a first-class `BasedAtom` type representing a Goldilocks prime field element — distinct from `Atom` (arbitrary precision). + +A `BasedAtom` is a value in `[0, p−1]` where `p = 2^64 − 2^32 + 1`. The distinction matters for zkVM contexts where field arithmetic is the native operation and overflow-reduction is semantically significant. + +### Design sketch + +- Add `%based` to `jatom-type` and to the `jatom` union; surface as `BasedAtom` in Jock source. +- Parser: `BasedAtom` maps to `[%atom %based %.n]`; literals that parse as `BasedAtom` are bounds-checked at parse time (error, not warning). +- Arithmetic operators (`+`, `-`, `*`, etc.) on two `BasedAtom` operands emit field-arithmetic Nock (reduction mod p) rather than arbitrary-precision arithmetic. +- A `BasedAtom` inferred from a literal `%number` that fits in the field may be silently promoted; one that does not fit is a compile error. +- Casting: `val as BasedAtom` performs runtime reduction mod p. +- Current status: `%number` literals that exceed the field maximum produce a compile-time `%warn-unbased-atom` warning (implemented); full type-system integration is deferred until jetting is complete. + ## Cache noun builds Cache large noun builds. @@ -32,11 +47,11 @@ This involves converting the single `$map` in the compiler door sample to a `mip - Current status: libraries can be supplied to the sample of the compiler door as a `(map term cord)`. (This should be changed to `(map path cord)` for flexibility, versioning, etc.) `jockc` supports preprocessed argument insertion, but this should be replaced with this better system. -## Jock imports +## Jock imports ✅ IMPLEMENTED Support Jock library imports just like Hoon imports. -This probably requires changing the library map to use paths as the keys instead of terms. +- Current status: `import mylib;` where `mylib.jock` is in the import directory works via AST inlining. The library's parse tree (compose/func/let chains) is spliced into the importing file at parse time. No new module system needed — the Rust loader already reads `.jock` files into the `libs` map. Library files should contain definitions only (e.g. `func double(x: Atom) -> Atom { (x + x) }; ~`). ## Hoon return types @@ -54,18 +69,18 @@ let mylist = [1 2 3 4 5]; ) ``` -- Current status: the Hoon FFI permits these operations but no syntax is available. +- Current status: Index notation (`expr[idx]`) is implemented for both lists (runtime via `hoon.snag`) and tuples (compile-time axis resolution). Slicing (`[1:4]`) is not yet implemented. + +## `Map` and `Set` type and syntax ✅ IMPLEMENTED -## `Map` type and syntax +Implement native `Map` and `Set` types with syntax support. -Implement a native `Map` type with syntax support. +- Current status: Map and Set are fully implemented with bracket notation only. Literal syntax: `{'a' -> 1, 'b' -> 2}` (Map), `{1, 2, 3}` (Set), `{->}` / `{}` (empty). Operations: `m[k]` (get → option), `m[k?]` (has → bool), `m[k] = v;` (put), `m[!k]` (del). Key types supported include atoms, chars, and number pairs. 92 regression tests in `common/tests/` cover all operations. ``` -{ - 'a' -> 'A' - 'b' -> 'B' - 'c' -> 'C' -} +let m = {'a' -> 100, 'b' -> 200}; +m['c'] = 300; +(m['a'] m['b'?] m[!'a']) ``` ## Operator associativity @@ -78,49 +93,38 @@ Implement a `List(String)` type with syntax support. This will facilitate paths and wires for JockApp interactions. -## `print` keyword +## `print` keyword ✅ IMPLEMENTED Produce output as a side effect. -We can print literals fine, but references (variables) are not yet complete. - ``` let a = 5; print(a); a ``` -- Current status: PR #53 contains work towards wrapping the environment in a closure so that references can be resolved at runtime. +- Current status: Runtime prettyprinting works for all basic types. `print(x)` generates Nock hint formulas that evaluate at runtime — the type (jype) selects the formatter at compile time, and the value is computed at runtime. Supported types: `%number` (decimal via `hoon.scot-ud`), `%hex` (hex via `hoon.scot-ux`), `%chars` (passthrough), `%logical` (inline `%.y`/`%.n`), and `%fork` option types (runtime none/some check). +- Known issue: Number formatting is slow (~10s per value) because the hoon library's arithmetic functions (`div`, `mod`, `add`, etc.) are not jetted. The library is compiled with `(mint ut %noun)` which produces correct Nock but battery hashes don't match the kernel's jet registrations. Fixing this requires either (a) compiling hoon.hoon in a way that produces matching battery hashes, (b) registering jets for the standalone core's batteries in the Nock runtime, or (c) caching the compiled noun (see "Cache noun builds" above) so the cost is amortized. -## `protocol` traits interface +## `protocol` traits interface ✅ IMPLEMENTED Define a list of methods and type relations to be validated at compile time. -A `protocol` is a definition of the allowed and type signatures that a class must implement. It may be `total` (only these methods are allowed) or partial (at least these methods are allowed, default). Eventually, `protocol` will form the basis of an operator overloading system. +- Current status: Traits are implemented via `trait Name { method1; method2; }` syntax. Classes can implement traits: `class C(S) impl Trait1, Trait2 { ... }`. Operator overloading is supported: `trait Add(+) { add; }` for binary operators and `trait Neg(unary -) { neg; }` for unary operators, including arbitrary Unicode operators. `Self` type resolves in method signatures. ``` +compose trait Add(+) { add; }; +compose trait Sub(-) { sub; }; +compose struct PointState { x: Real, y: Real }; compose - protocol Arithmetic { - add(# #) -> #; - sub(# #) -> #; - bitwidth(#) -> ##; - }; - -class Number implements Arithmetic { - add(x:Number y:Number) -> Number { - x + y - } - sub(x:Number y:Number) -> Number { - if (y > x) { - crash; - } else { - x - y - } - } - bitwidth(x:Number) -> Uint { - // logic to get log2 + 1 - } -} + class Point(PointState) impl Add, Sub { + add(self: Self, p: Self) -> Self { ( self.x + p.x self.y + p.y ) } + sub(self: Self, p: Self) -> Self { ( self.x - p.x self.y - p.y ) } + } +; +let p = Point { x: 101, y: 105 }; +let q = Point { x: 42, y: 7 }; +p + q ``` ## REPL development @@ -129,11 +133,11 @@ Produce a feature-complete, fast Jock REPL/CLI. [Jojo](https://github.com/sigilante/jojo) is a proof of concept, and does not represent any serious thought towards the "best" solution. -## Strings +## Strings ✅ IMPLEMENTED (pending jet performance) Implement true strings with operators. -Strings should be `cord` UTF-8 encodings, as `tape`s are several times larger in memory representation. Strings may or may not be agnostic to quote type (defer this decision). +Strings are `cord` (`@t`) UTF-8 encodings. `"foo"` = `String`; `'foo'` = `Chars` (symbol/key use). Both are the same underlying atom; different Jock types. ``` let forename:String = "Buckminster"; @@ -141,4 +145,61 @@ let surname:String = "Fuller"; forename + " " + surname ``` -- Current status: Right now we can write strings but operations on them must be routed through the Hoon FFI. PR #59 contains work towards supporting and testing strings. +- Current status: String and Chars literals, `+` concatenation, `lent(s)` byte-length, `s[i]` byte-index, and `s[i:j]` byte-slice are all implemented and correct. String ops compile to Nock calls to `met`/`cat`/`cut` from hoon.hoon. **Performance is very slow** because these arms are unjetted — see "Jet Matching" below. String tests hang on CI until jetting is resolved. + +## Jet Matching + +Enable jet dispatch for hoon.hoon arms so that string operations and arithmetic run at native speed. + +### Background + +Jock's compiler (`jock.hoon`) calls standard Hoon library arms (`met`, `cat`, `cut`, `add`, `sub`, etc.) from `hoon.hoon` at runtime to implement string ops and arithmetic. NockApp's jet system could replace these with fast Rust implementations — but jets only fire when the called battery has matching hint labels registered. + +The hint mechanism requires: +- A core-level hint `~% %k.136 ~ ~` on the Hoon core +- Per-arm hints `~/ %arm-name` on each arm to be jetted + +`hoon.hoon` already has the `~% %k.136 ~ ~` core-level hint, but has **no** per-arm `~/` hints — and `hoon.hoon` cannot be modified. As a result, the hot state entries in `crates/jockc/main.rs` register the right paths but never fire. + +### Proposed fix: `jruntime.hoon` + +Create a new file `common/hoon/lib/jruntime.hoon` (freely modifiable) that: + +1. Has `~% %k.136 ~ ~` and per-arm `~/ %name` hints +2. Contains wet-gate wrappers that delegate to the corresponding hoon.hoon arms in the subject +3. Is compiled into `jockc.jam` as part of the Jock kernel +4. Is callable from jock.hoon's codegen for the specific arms that need jetting + +Example structure: +```hoon +~% %k.136 ~ ~ +|% +~/ %met +++ met |*([a=bloq b=*] (met:hoon a b)) +~/ %cat +++ cat |*([a=bloq b=* c=*] (cat:hoon a b c)) +~/ %cut +++ cut |*([a=bloq b=[p=@ q=@] c=*] (cut:hoon a b c)) +~/ %add +++ add |*([a=@ b=@] (add:hoon a b)) +:: ... all other jetted arms ... +-- +``` + +When jetted, the Rust implementation runs directly (bypassing the wrapper body). When not jetted (fallback), the wrapper delegates to hoon.hoon — correct but slow. Two cores having the same `%k.136` label don't conflict: each registers by its own battery hash. + +### Implementation steps + +1. **`common/hoon/lib/jruntime.hoon`** — create the wrapper file with all arms that should be jetted. Wet gates required (dry gates cause rest-loop during jock.hoon mint). Arms needed at minimum: `met`, `cat`, `cut`, `add`, `dec`, `sub`, `mul`, `div`, `mod`, `dvr`, `gte`, `gth`, `lte`, `lth`, `mug`, `dor`, `gor`, `mor`. + +2. **`crates/jockc/hoon/lib/jruntime.hoon`** — symlink or copy into jockc's lib dir so `hoonc` compiles it into `jockc.jam`. + +3. **`common/hoon/lib/jock.hoon`** — add a `jruntime-lib` arm alongside `hoon-lib` that resolves the jruntime core from the Jock compiler's subject. Update `make-hoon-binop` (and `make-hoon-call`) to route jetted arms through `jruntime-lib` instead of `hoon-lib`. + +4. **`crates/jockc/main.rs`** — restore hot state entries for `met`, `cat`, `cut` (removed in cleanup); verify all other entries are present. The `jet_met`/`jet_cat`/`jet_cut` Rust implementations must handle the wet-gate sample axis correctly (`+<+<` not `+<`). + +5. **Build and test** — `make clean-jam && make jockc`, then run string tests; they should complete within timeout. Run full test suite to confirm no regressions. + +### Known complication + +Wet gate sample extraction: for a wet gate `|*([a b] ...)`, the sample is at a different axis than for a dry gate. The Rust jet implementations in `nockvm` must extract arguments at the correct axis. Confirmed axis for wet gates: `+<+<.gate` (not `+<.gate`). Verify each jet implementation handles this. diff --git a/common/hoon/jib/hoon-136.hoon b/common/hoon/jib/hoon-136.hoon new file mode 120000 index 0000000..98793ba --- /dev/null +++ b/common/hoon/jib/hoon-136.hoon @@ -0,0 +1 @@ +../lib/hoon-136.hoon \ No newline at end of file diff --git a/common/hoon/jib/print-demo.jock b/common/hoon/jib/print-demo.jock new file mode 100644 index 0000000..f343dba --- /dev/null +++ b/common/hoon/jib/print-demo.jock @@ -0,0 +1,12 @@ +import hoon; + +let n: Atom = 42; +print(n); + +let name = 'hello'; +print(name); + +let sum: Atom = n + 8; +print(sum); + +~ diff --git a/common/hoon/jib/scot.hoon b/common/hoon/jib/scot.hoon new file mode 100644 index 0000000..56723fd --- /dev/null +++ b/common/hoon/jib/scot.hoon @@ -0,0 +1,3 @@ +|% +++ scot scot +-- diff --git a/common/hoon/jib/testlib.jock b/common/hoon/jib/testlib.jock new file mode 100644 index 0000000..b33cfa9 --- /dev/null +++ b/common/hoon/jib/testlib.jock @@ -0,0 +1,2 @@ +func double(x: Atom) -> Atom { (x + x) }; +~ diff --git a/common/hoon/lib/hoon-136.hoon b/common/hoon/lib/hoon-136.hoon new file mode 100644 index 0000000..672b3ef --- /dev/null +++ b/common/hoon/lib/hoon-136.hoon @@ -0,0 +1,14180 @@ +:: +:::: /sys/hoon :: + :: :: +=< ride +=> %136 => +:: :: +:::: 0: version stub :: + :: :: +~% %k.136 ~ ~ :: +|% +++ hoon-version + +-- => +~% %one + ~ +:: layer-1 +:: +:: basic mathematical operations +|% +:: unsigned arithmetic ++| %math +++ add + ~/ %add + :: unsigned addition + :: + :: a: augend + :: b: addend + |= [a=@ b=@] + :: sum + ^- @ + ?: =(0 a) b + $(a (dec a), b +(b)) +:: +++ dec + ~/ %dec + :: unsigned decrement by one. + |= a=@ + ~_ leaf+"decrement-underflow" + ?< =(0 a) + =+ b=0 + :: decremented integer + |- ^- @ + ?: =(a +(b)) b + $(b +(b)) +:: +++ div + ~/ %div + :: unsigned divide + :: + :: a: dividend + :: b: divisor + |: [a=`@`1 b=`@`1] + :: quotient + ^- @ + -:(dvr a b) +:: +++ dvr + ~/ %dvr + :: unsigned divide with remainder + :: + :: a: dividend + :: b: divisor + |: [a=`@`1 b=`@`1] + :: p: quotient + :: q: remainder + ^- [p=@ q=@] + ~_ leaf+"divide-by-zero" + ?< =(0 b) + =+ c=0 + |- + ?: (lth a b) [c a] + $(a (sub a b), c +(c)) +:: +++ gte + ~/ %gte + :: unsigned greater than or equals + :: + :: returns whether {a >= b}. + :: + :: a: left hand operand (todo: name) + :: b: right hand operand + |= [a=@ b=@] + :: greater than or equal to? + ^- ? + !(lth a b) +:: +++ gth + ~/ %gth + :: unsigned greater than + :: + :: returns whether {a > b} + :: + :: a: left hand operand (todo: name) + :: b: right hand operand + |= [a=@ b=@] + :: greater than? + ^- ? + !(lte a b) +:: +++ lte + ~/ %lte + :: unsigned less than or equals + :: + :: returns whether {a <= b}. + :: + :: a: left hand operand (todo: name) + :: b: right hand operand + |= [a=@ b=@] + :: less than or equal to? + |(=(a b) (lth a b)) +:: +++ lth + ~/ %lth + :: unsigned less than + :: + :: a: left hand operand (todo: name) + :: b: right hand operand + |= [a=@ b=@] + :: less than? + ^- ? + ?& !=(a b) + |- + ?| =(0 a) + ?& !=(0 b) + $(a (dec a), b (dec b)) + == == == +:: +++ max + ~/ %max + :: unsigned maximum + |= [a=@ b=@] + :: the maximum + ^- @ + ?: (gth a b) a + b +:: +++ min + ~/ %min + :: unsigned minimum + |= [a=@ b=@] + :: the minimum + ^- @ + ?: (lth a b) a + b +:: +++ mod + ~/ %mod + :: unsigned modulus + :: + :: a: dividend + :: b: divisor + |: [a=`@`1 b=`@`1] + :: the remainder + ^- @ + +:(dvr a b) +:: +++ mul + ~/ %mul + :: unsigned multiplication + :: + :: a: multiplicand + :: b: multiplier + |: [a=`@`1 b=`@`1] + :: product + ^- @ + =+ c=0 + |- + ?: =(0 a) c + $(a (dec a), c (add b c)) +:: +++ sub + ~/ %sub + :: unsigned subtraction + :: + :: a: minuend + :: b: subtrahend + |= [a=@ b=@] + ~_ leaf+"subtract-underflow" + :: difference + ^- @ + ?: =(0 b) a + $(a (dec a), b (dec b)) +:: +:: tree addressing ++| %tree +++ cap + ~/ %cap + :: tree head + :: + :: tests whether an `a` is in the head or tail of a noun. produces %2 if it + :: is within the head, or %3 if it is within the tail. + |= a=@ + ^- ?(%2 %3) + ?- a + %2 %2 + %3 %3 + ?(%0 %1) !! + * $(a (div a 2)) + == +:: +++ mas + ~/ %mas + :: axis within head/tail + :: + :: computes the axis of `a` within either the head or tail of a noun + :: (depends whether `a` lies within the head or tail). + |= a=@ + ^- @ + ?- a + ?(%2 %3) 1 + ?(%0 %1) !! + * (add (mod a 2) (mul $(a (div a 2)) 2)) + == +:: +++ peg + ~/ %peg + :: axis within axis + :: + :: computes the axis of {b} within axis {a}. + |= [a=@ b=@] + ?< =(0 a) + ?< =(0 b) + :: a composed axis + ^- @ + ?- b + %1 a + %2 (mul a 2) + %3 +((mul a 2)) + * (add (mod b 2) (mul $(b (div b 2)) 2)) + == +:: +:: # %containers +:: +:: the most basic of data types ++| %containers +:: ++$ bite + :: atom slice specifier + :: + $@(bloq [=bloq =step]) +:: ++$ bloq + :: blocksize + :: + :: a blocksize is the power of 2 size of an atom. ie, 3 is a byte as 2^3 is + :: 8 bits. + @ +:: +++ each + |$ [this that] + :: either {a} or {b}, defaulting to {a}. + :: + :: mold generator: produces a discriminated fork between two types, + :: defaulting to {a}. + :: + $% [%| p=that] + [%& p=this] + == +:: ++$ gate + :: function + :: + :: a core with one arm, `$`--the empty name--which transforms a sample noun + :: into a product noun. If used dryly as a type, the subject must have a + :: sample type of `*`. + $-(* *) +:: +++ list + |$ [item] + :: null-terminated list + :: + :: mold generator: produces a mold of a null-terminated list of the + :: homogeneous type {a}. + :: + $@(~ [i=item t=(list item)]) +:: +++ lone + |$ [item] + :: single item tuple + :: + :: mold generator: puts the face of `p` on the passed in mold. + :: + p=item +:: +++ lest + |$ [item] + :: null-terminated non-empty list + :: + :: mold generator: produces a mold of a null-terminated list of the + :: homogeneous type {a} with at least one element. + [i=item t=(list item)] +:: ++$ mold + :: normalizing gate + :: + :: a gate that accepts any noun, and validates its shape, producing the + :: input if it fits or a default value if it doesn't. + :: + :: examples: * @ud ,[p=time q=?(%a %b)] + $~(* $-(* *)) +:: +++ pair + |$ [head tail] + :: dual tuple + :: + :: mold generator: produces a tuple of the two types passed in. + :: + :: a: first type, labeled {p} + :: b: second type, labeled {q} + :: + [p=head q=tail] +:: +++ pole + |$ [item] + :: faceless list + :: + :: like ++list, but without the faces {i} and {t}. + :: + $@(~ [item (pole item)]) +:: +++ qual + |$ [first second third fourth] + :: quadruple tuple + :: + :: mold generator: produces a tuple of the four types passed in. + :: + [p=first q=second r=third s=fourth] +:: +++ quip + |$ [item state] + :: pair of list of first and second + :: + :: a common pattern in hoon code is to return a ++list of changes, along with + :: a new state. + :: + :: a: type of list item + :: b: type of returned state + :: + [(list item) state] +:: +++ step + :: atom size or offset, in bloqs + :: + _`@u`1 +:: +++ trap + |$ [product] + :: a core with one arm `$` + :: + _|?($:product) +:: +++ tree + |$ [node] + :: tree mold generator + :: + :: a `++tree` can be empty, or contain a node of a type and + :: left/right sub `++tree` of the same type. pretty-printed with `{}`. + :: + $@(~ [n=node l=(tree node) r=(tree node)]) +:: +++ trel + |$ [first second third] + :: triple tuple + :: + :: mold generator: produces a tuple of the three types passed in. + :: + [p=first q=second r=third] +:: +++ unit + |$ [item] + :: maybe + :: + :: mold generator: either `~` or `[~ u=a]` where `a` is the + :: type that was passed in. + :: + $@(~ [~ u=item]) +-- => +:: +~% %two + ~ +:: layer-2 +:: +|% +:: 2a: unit logic ++| %unit-logc +:: +++ biff :: apply + |* [a=(unit) b=$-(* (unit))] + ?~ a ~ + (b u.a) +:: +++ bind :: argue + |* [a=(unit) b=gate] + ?~ a ~ + [~ u=(b u.a)] +:: +++ bond :: replace + |* a=(trap) + |* b=(unit) + ?~ b $:a + u.b +:: +++ both :: all the above + |* [a=(unit) b=(unit)] + ?~ a ~ + ?~ b ~ + [~ u=[u.a u.b]] +:: +++ clap :: combine + |* [a=(unit) b=(unit) c=_=>(~ |=(^ +<-))] + ?~ a b + ?~ b a + [~ u=(c u.a u.b)] +:: +++ clef :: compose + |* [a=(unit) b=(unit) c=_=>(~ |=(^ `+<-))] + ?~ a ~ + ?~ b ~ + (c u.a u.b) +:: +++ drop :: enlist + |* a=(unit) + ?~ a ~ + [i=u.a t=~] +:: +++ fall :: default + |* [a=(unit) b=*] + ?~(a b u.a) +:: +++ flit :: make filter + |* a=$-(* ?) + |* b=* + ?.((a b) ~ [~ u=b]) +:: +++ hunt :: first of units + |* [ord=$-(^ ?) a=(unit) b=(unit)] + ^- %- unit + $? _?>(?=(^ a) u.a) + _?>(?=(^ b) u.b) + == + ?~ a b + ?~ b a + ?:((ord u.a u.b) a b) +:: +++ lift :: lift mold (fmap) + |* a=mold :: flipped + |* b=(unit) :: curried + (bind b a) :: bind +:: +++ mate :: choose + |* [a=(unit) b=(unit)] + ?~ b a + ?~ a b + ?.(=(u.a u.b) ~>(%mean.'mate' !!) a) +:: +++ need :: demand + ~/ %need + |* a=(unit) + ?~ a ~>(%mean.'need' !!) + u.a +:: +++ some :: lift (pure) + |* a=* + [~ u=a] +:: +:: 2b: list logic ++| %list-logic +:: +snoc: append an element to the end of a list +:: +++ snoc + |* [a=(list) b=*] + (weld a ^+(a [b]~)) +:: +:: +lure: List pURE +++ lure + |* a=* + [i=a t=~] +:: +++ fand :: all indices + ~/ %fand + |= [nedl=(list) hstk=(list)] + =| i=@ud + =| fnd=(list @ud) + |- ^+ fnd + =+ [n=nedl h=hstk] + |- + ?: |(?=(~ n) ?=(~ h)) + (flop fnd) + ?: =(i.n i.h) + ?~ t.n + ^$(i +(i), hstk +.hstk, fnd [i fnd]) + $(n t.n, h t.h) + ^$(i +(i), hstk +.hstk) +:: +++ find :: first index + ~/ %find + |= [nedl=(list) hstk=(list)] + =| i=@ud + |- ^- (unit @ud) + =+ [n=nedl h=hstk] + |- + ?: |(?=(~ n) ?=(~ h)) + ~ + ?: =(i.n i.h) + ?~ t.n + `i + $(n t.n, h t.h) + ^$(i +(i), hstk +.hstk) +:: +++ flop :: reverse + ~/ %flop + |* a=(list) + => .(a (homo a)) + ^+ a + =+ b=`_a`~ + |- + ?~ a b + $(a t.a, b [i.a b]) +:: +++ gulf :: range inclusive + |= [a=@ b=@] + ?> (lte a b) + |- ^- (list @) + ?:(=(a +(b)) ~ [a $(a +(a))]) +:: +++ homo :: homogenize + |* a=(list) + ^+ =< $ + |@ ++ $ ?:(*? ~ [i=(snag 0 a) t=$]) + -- + a +:: +join: construct a new list, placing .sep between every pair in .lit +:: +++ join + |* [sep=* lit=(list)] + =. sep `_?>(?=(^ lit) i.lit)`sep + ?~ lit ~ + =| out=(list _?>(?=(^ lit) i.lit)) + |- ^+ out + ?~ t.lit + (flop [i.lit out]) + $(out [sep i.lit out], lit t.lit) +:: +:: +bake: convert wet gate to dry gate by specifying argument mold +:: +++ bake + |* [f=gate a=mold] + |= arg=a + (f arg) +:: +++ lent :: length + ~/ %lent + |= a=(list) + ^- @ + =+ b=0 + |- + ?~ a b + $(a t.a, b +(b)) +:: +++ levy + ~/ %levy :: all of + |* [a=(list) b=$-(* ?)] + |- ^- ? + ?~ a & + ?. (b i.a) | + $(a t.a) +:: +++ lien :: some of + ~/ %lien + |* [a=(list) b=$-(* ?)] + |- ^- ? + ?~ a | + ?: (b i.a) & + $(a t.a) +:: +++ limo :: listify + |* a=* + ^+ =< $ + |@ ++ $ ?~(a ~ ?:(*? [i=-.a t=$] $(a +.a))) + -- + a +:: +++ murn :: maybe transform + ~/ %murn + |* [a=(list) b=$-(* (unit))] + => .(a (homo a)) + |- ^- (list _?>(?=(^ a) (need (b i.a)))) + ?~ a ~ + =/ c (b i.a) + ?~ c $(a t.a) + [+.c $(a t.a)] +:: +++ oust :: remove + ~/ %oust + |* [[a=@ b=@] c=(list)] + (weld (scag +<-< c) (slag (add +<-< +<->) c)) +:: +++ reap :: replicate + ~/ %reap + |* [a=@ b=*] + |- ^- (list _b) + ?~ a ~ + [b $(a (dec a))] +:: +++ rear :: last item of list + ~/ %rear + |* a=(list) + ^- _?>(?=(^ a) i.a) + ?> ?=(^ a) + ?: =(~ t.a) i.a ::NOTE avoiding tmi + $(a t.a) +:: +++ reel :: right fold + ~/ %reel + |* [a=(list) b=_=>(~ |=([* *] +<+))] + |- ^+ ,.+<+.b + ?~ a + +<+.b + (b i.a $(a t.a)) +:: +++ roll :: left fold + ~/ %roll + |* [a=(list) b=_=>(~ |=([* *] +<+))] + |- ^+ ,.+<+.b + ?~ a + +<+.b + $(a t.a, b b(+<+ (b i.a +<+.b))) +:: +++ scag :: prefix + ~/ %scag + |* [a=@ b=(list)] + |- ^+ b + ?: |(?=(~ b) =(0 a)) ~ + [i.b $(b t.b, a (dec a))] +:: +++ skid :: separate + ~/ %skid + |* [a=(list) b=$-(* ?)] + |- ^+ [p=a q=a] + ?~ a [~ ~] + =+ c=$(a t.a) + ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]]) +:: +++ skim :: only + ~/ %skim + |* [a=(list) b=$-(* ?)] + |- + ^+ a + ?~ a ~ + ?:((b i.a) [i.a $(a t.a)] $(a t.a)) +:: +++ skip :: except + ~/ %skip + |* [a=(list) b=$-(* ?)] + |- + ^+ a + ?~ a ~ + ?:((b i.a) $(a t.a) [i.a $(a t.a)]) +:: +++ slag :: suffix + ~/ %slag + |* [a=@ b=(list)] + |- ^+ b + ?: =(0 a) b + ?~ b ~ + $(b t.b, a (dec a)) +:: +++ snag :: index + ~/ %snag + |* [a=@ b=(list)] + |- ^+ ?>(?=(^ b) i.b) + ?~ b + ~_ leaf+"snag-fail" + !! + ?: =(0 a) i.b + $(b t.b, a (dec a)) +:: +++ snip :: drop tail off list + ~/ %snip + |* a=(list) + ^+ a + ?~ a ~ + ?: =(~ t.a) ~ + [i.a $(a t.a)] +:: +++ sort !. :: quicksort + ~/ %sort + |* [a=(list) b=$-([* *] ?)] + => .(a ^.(homo a)) + |- ^+ a + ?~ a ~ + =+ s=(skid t.a |:(c=i.a (b c i.a))) + %+ weld + $(a p.s) + ^+ t.a + [i.a $(a q.s)] +:: +++ spin :: stateful turn + :: + :: a: list + :: b: state + :: c: gate from list-item and state to product and new state + ~/ %spin + |* [a=(list) b=* c=_|=(^ [** +<+])] + => .(c `$-([_?>(?=(^ a) i.a) _b] [_-:(c) _b])`c) + =/ acc=(list _-:(c)) ~ + :: transformed list and updated state + |- ^- (pair _acc _b) + ?~ a + [(flop acc) b] + =^ res b (c i.a b) + $(acc [res acc], a t.a) +:: +++ spun :: internal spin + :: + :: a: list + :: b: gate from list-item and state to product and new state + ~/ %spun + |* [a=(list) b=_|=(^ [** +<+])] + :: transformed list + p:(spin a +<+.b b) +:: +++ swag :: slice + |* [[a=@ b=@] c=(list)] + (scag +<-> (slag +<-< c)) +:: +turn: transform each value of list :a using the function :b +:: +++ turn + ~/ %turn + |* [a=(list) b=gate] + => .(a (homo a)) + ^- (list _?>(?=(^ a) (b i.a))) + |- + ?~ a ~ + [i=(b i.a) t=$(a t.a)] +:: +++ weld :: concatenate + ~/ %weld + |* [a=(list) b=(list)] + => .(a ^.(homo a), b ^.(homo b)) + |- ^+ b + ?~ a b + [i.a $(a t.a)] +:: +++ snap :: replace item + ~/ %snap + |* [a=(list) b=@ c=*] + ^+ a + (weld (scag b a) [c (slag +(b) a)]) +:: +++ into :: insert item + ~/ %into + |* [a=(list) b=@ c=*] + ^+ a + (weld (scag b a) [c (slag b a)]) +:: +++ welp :: faceless weld + ~/ %welp + |* [* *] + ?~ +<- + +<-(. +<+) + +<-(+ $(+<- +<->)) +:: +++ zing :: promote + ~/ %zing + |* * + ?~ +< + +< + (welp +<- $(+< +<+)) +:: +:: 2c: bit arithmetic ++| %bit-arithmetic +:: +++ bex :: binary exponent + ~/ %bex + |= a=bloq + ^- @ + ?: =(0 a) 1 + (mul 2 $(a (dec a))) +:: +++ can :: assemble + ~/ %can + |= [a=bloq b=(list [p=step q=@])] + ^- @ + ?~ b 0 + (add (end [a p.i.b] q.i.b) (lsh [a p.i.b] $(b t.b))) +:: +++ cat :: concatenate + ~/ %cat + |= [a=bloq b=@ c=@] + (add (lsh [a (met a b)] c) b) +:: +++ cut :: slice + ~/ %cut + |= [a=bloq [b=step c=step] d=@] + (end [a c] (rsh [a b] d)) +:: +++ end :: tail + ~/ %end + |= [a=bite b=@] + =/ [=bloq =step] ?^(a a [a *step]) + (mod b (bex (mul (bex bloq) step))) +:: +++ fil :: fill bloqstream + ~/ %fil + |= [a=bloq b=step c=@] + =| n=@ud + =. c (end a c) + =/ d c + |- ^- @ + ?: =(n b) + (rsh a d) + $(d (add c (lsh a d)), n +(n)) +:: +++ hew :: cut many + ~/ %hew + |= [a=bite c=@] + =/ d=[=bloq =step] ?^(a a [a 0]) + ~% %fun +>+ ~ + |* b=* + ^+ [b d] + ?@ b + [(cut bloq.d [step.d b] c) bloq.d (add step.d b)] + =^ f d $(b -.b) + =^ g d $(b +.b) + [[f g] d] +:: +++ lsh :: left-shift + ~/ %lsh + |= [a=bite b=@] + =/ [=bloq =step] ?^(a a [a *step]) + (mul b (bex (mul (bex bloq) step))) +:: +++ met :: measure + ~/ %met + |= [a=bloq b=@] + ^- @ + =+ c=0 + |- + ?: =(0 b) c + $(b (rsh a b), c +(c)) +:: +++ rap :: assemble variable + ~/ %rap + |= [a=bloq b=(list @)] + ^- @ + ?~ b 0 + (cat a i.b $(b t.b)) +:: +++ rep :: assemble fixed + ~/ %rep + |= [a=bite b=(list @)] + =/ [=bloq =step] ?^(a a [a *step]) + =| i=@ud + |- ^- @ + ?~ b 0 + %+ add $(i +(i), b t.b) + (lsh [bloq (mul step i)] (end [bloq step] i.b)) +:: +++ rev + :: reverses block order, accounting for leading zeroes + :: + :: boz: block size + :: len: size of dat, in boz + :: dat: data to flip + ~/ %rev + |= [boz=bloq len=@ud dat=@] + ^- @ + =. dat (end [boz len] dat) + %+ lsh + [boz (sub len (met boz dat))] + (swp boz dat) +:: +++ rig :: convert bloqs + ~/ %rig + |= [=bite b=bloq] + ^- step + ?@ bite 0 + =/ [a=bloq c=step] bite + ?: =(a b) c + ?: (gth a b) + (lsh [0 (sub a b)] c) + =/ d [0 (sub b a)] + =/ e (rsh d c) + ?:(=(0 (end d c)) e +(e)) +:: +++ rip :: disassemble + ~/ %rip + |= [a=bite b=@] + ^- (list @) + ?: =(0 b) ~ + [(end a b) $(b (rsh a b))] +:: +++ rsh :: right-shift + ~/ %rsh + |= [a=bite b=@] + =/ [=bloq =step] ?^(a a [a *step]) + (div b (bex (mul (bex bloq) step))) +:: +++ run :: +turn into atom + ~/ %run + |= [a=bite b=@ c=$-(@ @)] + (rep a (turn (rip a b) c)) +:: +++ rut :: +turn into list + ~/ %rut + |* [a=bite b=@ c=$-(@ *)] + (turn (rip a b) c) +:: +++ sew :: stitch into + ~/ %sew + |= [a=bloq [b=step c=step d=@] e=@] + ^- @ + %+ add + (can a b^e c^d ~) + =/ f [a (add b c)] + (lsh f (rsh f e)) +:: +++ swp :: naive rev bloq order + ~/ %swp + |= [a=bloq b=@] + (rep a (flop (rip a b))) +:: +++ xeb :: binary logarithm + ~/ %xeb + |= a=@ + ^- @ + (met 0 a) +:: +++ fe :: modulo bloq + |_ a=bloq + ++ dif :: difference + |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c)))) + ++ inv |=(b=@ (sub (dec out) (sit b))) :: inverse + ++ net |= b=@ ^- @ :: flip byte endianness + => .(b (sit b)) + ?: (lte a 3) + b + =+ c=(dec a) + %+ con + (lsh c $(a c, b (cut c [0 1] b))) + $(a c, b (cut c [1 1] b)) + ++ out (bex (bex a)) :: mod value + ++ rol |= [b=bloq c=@ d=@] ^- @ :: roll left + =+ e=(sit d) + =+ f=(bex (sub a b)) + =+ g=(mod c f) + (sit (con (lsh [b g] e) (rsh [b (sub f g)] e))) + ++ ror |= [b=bloq c=@ d=@] ^- @ :: roll right + =+ e=(sit d) + =+ f=(bex (sub a b)) + =+ g=(mod c f) + (sit (con (rsh [b g] e) (lsh [b (sub f g)] e))) + ++ sum |=([b=@ c=@] (sit (add b c))) :: wrapping add + ++ sit |=(b=@ (end a b)) :: enforce modulo + -- +:: +:: 2d: bit logic ++| %bit-logic +:: +++ con :: binary or + ~/ %con + |= [a=@ b=@] + =+ [c=0 d=0] + |- ^- @ + ?: ?&(=(0 a) =(0 b)) d + %= $ + a (rsh 0 a) + b (rsh 0 b) + c +(c) + d %+ add d + %+ lsh [0 c] + ?& =(0 (end 0 a)) + =(0 (end 0 b)) + == + == +:: +++ clz :: leading zeros + ~/ %clz + |= [a=bite b=@] + =/ c=[=bloq =step] ?^(a a [a 1]) + (sub (mul (bex bloq.c) step.c) (met 0 (end a b))) +:: +++ ctz :: trailing zeros + ~/ %ctz + |= a=@ + ?: =(0 a) 0 + =| i=@ud + |-(?:(=(1 (cut 0 [i 1] a)) i $(i +(i)))) +:: +++ dis :: binary and + ~/ %dis + |= [a=@ b=@] + =| [c=@ d=@] + |- ^- @ + ?: ?|(=(0 a) =(0 b)) d + %= $ + a (rsh 0 a) + b (rsh 0 b) + c +(c) + d %+ add d + %+ lsh [0 c] + ?| =(0 (end 0 a)) + =(0 (end 0 b)) + == + == +:: +++ ham :: popcount + ~/ %ham + |= a=@ + ?: =(0 a) 0 + =| n=@ud + =/ m (dec (met 0 a)) + |- ^- @ud + =? n =(1 (cut 0 [m 1] a)) + +(n) + ?:(=(0 m) n $(m (dec m))) +:: +++ mix :: binary xor + ~/ %mix + |= [a=@ b=@] + ^- @ + =+ [c=0 d=0] + |- + ?: ?&(=(0 a) =(0 b)) d + %= $ + a (rsh 0 a) + b (rsh 0 b) + c +(c) + d (add d (lsh [0 c] =((end 0 a) (end 0 b)))) + == +:: +++ not |= [a=bloq b=@ c=@] :: binary not (sized) + (mix c (dec (bex (mul b (bex a))))) +:: +:: 2e: insecure hashing ++| %insecure-hashing +:: +++ muk :: standard murmur3 + ~/ %muk + |= [syd=@ len=@ key=@] + ^- @ + =+ ~(. fe 5) + =. syd (end 5 syd) + =/ nblocks (div len 4) :: intentionally off-by-one + =/ h1 syd + =+ [c1=0xcc9e.2d51 c2=0x1b87.3593] + =/ i nblocks + =. h1 =/ hi h1 |- + ?: =(0 i) hi + =/ k1 (cut 5 [(sub nblocks i) 1] key) :: negative array index + =. k1 (sit (mul k1 c1)) + =. k1 (rol 0 15 k1) + =. k1 (sit (mul k1 c2)) + =. hi (mix hi k1) + =. hi (rol 0 13 hi) + =. hi (sum (sit (mul hi 5)) 0xe654.6b64) + $(i (dec i)) + =/ tail (rsh [3 (mul 4 nblocks)] key) + =/ k1 0 + =/ tlen (dis len 3) + =. h1 + ?+ tlen h1 :: fallthrough switch + %3 =. k1 (mix k1 (lsh [0 16] (cut 3 [2 1] tail))) + =. k1 (mix k1 (lsh [0 8] (cut 3 [1 1] tail))) + =. k1 (mix k1 (cut 3 [0 1] tail)) + =. k1 (sit (mul k1 c1)) + =. k1 (rol 0 15 k1) + =. k1 (sit (mul k1 c2)) + (mix h1 k1) + %2 =. k1 (mix k1 (lsh [0 8] (cut 3 [1 1] tail))) + =. k1 (mix k1 (cut 3 [0 1] tail)) + =. k1 (sit (mul k1 c1)) + =. k1 (rol 0 15 k1) + =. k1 (sit (mul k1 c2)) + (mix h1 k1) + %1 =. k1 (mix k1 (cut 3 [0 1] tail)) + =. k1 (sit (mul k1 c1)) + =. k1 (rol 0 15 k1) + =. k1 (sit (mul k1 c2)) + (mix h1 k1) + == + =. h1 (mix h1 (end 5 len)) + |^ (fmix32 h1) + ++ fmix32 + |= h=@ + =. h (mix h (rsh [0 16] h)) + =. h (sit (mul h 0x85eb.ca6b)) + =. h (mix h (rsh [0 13] h)) + =. h (sit (mul h 0xc2b2.ae35)) + =. h (mix h (rsh [0 16] h)) + h + -- +:: +++ mug :: mug with murmur3 + ~/ %mug + |= a=* + |^ ?@ a (mum 0xcafe.babe 0x7fff a) + =/ b (cat 5 $(a -.a) $(a +.a)) + (mum 0xdead.beef 0xfffe b) + :: + ++ mum + |= [syd=@uxF fal=@F key=@] + =/ wyd (met 3 key) + =| i=@ud + |- ^- @F + ?: =(8 i) fal + =/ haz=@F (muk syd wyd key) + =/ ham=@F (mix (rsh [0 31] haz) (end [0 31] haz)) + ?.(=(0 ham) ham $(i +(i), syd +(syd))) + -- +:: :: +:: 2f: noun ordering ++| %noun-ordering +:: +:: +aor: alphabetical order +:: +:: Orders atoms before cells, and atoms in ascending LSB order. +:: +++ aor + ~/ %aor + |= [a=* b=*] + ^- ? + ?: =(a b) & + ?. ?=(@ a) + ?: ?=(@ b) | + ?: =(-.a -.b) + $(a +.a, b +.b) + $(a -.a, b -.b) + ?. ?=(@ b) & + |- + =+ [c=(end 3 a) d=(end 3 b)] + ?: =(c d) + $(a (rsh 3 a), b (rsh 3 b)) + (lth c d) +:: +dor: depth order +:: +:: Orders in ascending tree depth. +:: +++ dor + ~/ %dor + |= [a=* b=*] + ^- ? + ?: =(a b) & + ?. ?=(@ a) + ?: ?=(@ b) | + ?: =(-.a -.b) + $(a +.a, b +.b) + $(a -.a, b -.b) + ?. ?=(@ b) & + (lth a b) +:: +gor: mug order +:: +:: Orders in ascending +mug hash order, collisions fall back to +dor. +:: +++ gor + ~/ %gor + |= [a=* b=*] + ^- ? + =+ [c=(mug a) d=(mug b)] + ?: =(c d) + (dor a b) + (lth c d) +:: +mor: (more) mug order +:: +:: Orders in ascending double +mug hash order, collisions fall back to +dor. +:: +++ mor + ~/ %mor + |= [a=* b=*] + ^- ? + =+ [c=(mug (mug a)) d=(mug (mug b))] + ?: =(c d) + (dor a b) + (lth c d) +:: +:: 2g: unsigned powers ++| %unsigned-powers +:: +++ pow :: unsigned exponent + ~/ %pow + |= [a=@ b=@] + ?: =(b 0) 1 + |- ?: =(b 1) a + =+ c=$(b (div b 2)) + =+ d=(mul c c) + ?~ (dis b 1) d (mul d a) +:: +++ sqt :: unsigned sqrt/rem + ~/ %sqt + |= a=@ ^- [p=@ q=@] + ?~ a [0 0] + =+ [q=(div (dec (xeb a)) 2) r=0] + =- [-.b (sub a +.b)] + ^= b |- + =+ s=(add r (bex q)) + =+ t=(mul s s) + ?: =(q 0) + ?:((lte t a) [s t] [r (mul r r)]) + ?: (lte t a) + $(r s, q (dec q)) + $(q (dec q)) +:: +:: 2h: set logic ++| %set-logic +:: +++ in :: set engine + ~/ %in + =| a=(tree) :: (set) + |@ + ++ all :: logical AND + ~/ %all + |* b=$-(* ?) + |- ^- ? + ?~ a + & + ?&((b n.a) $(a l.a) $(a r.a)) + :: + ++ any :: logical OR + ~/ %any + |* b=$-(* ?) + |- ^- ? + ?~ a + | + ?|((b n.a) $(a l.a) $(a r.a)) + :: + ++ apt :: check correctness + =< $ + ~/ %apt + =| [l=(unit) r=(unit)] + |. ^- ? + ?~ a & + ?& ?~(l & &((gor n.a u.l) !=(n.a u.l))) + ?~(r & &((gor u.r n.a) !=(u.r n.a))) + ?~(l.a & ?&((mor n.a n.l.a) !=(n.a n.l.a) $(a l.a, l `n.a))) + ?~(r.a & ?&((mor n.a n.r.a) !=(n.a n.r.a) $(a r.a, r `n.a))) + == + :: + ++ bif :: splits a by b + ~/ %bif + |* b=* + ^+ [l=a r=a] + =< + + |- ^+ a + ?~ a + [b ~ ~] + ?: =(b n.a) + a + ?: (gor b n.a) + =+ c=$(a l.a) + ?> ?=(^ c) + c(r a(l r.c)) + =+ c=$(a r.a) + ?> ?=(^ c) + c(l a(r l.c)) + :: + ++ del :: b without any a + ~/ %del + |* b=* + |- ^+ a + ?~ a + ~ + ?. =(b n.a) + ?: (gor b n.a) + a(l $(a l.a)) + a(r $(a r.a)) + |- ^- [$?(~ _a)] + ?~ l.a r.a + ?~ r.a l.a + ?: (mor n.l.a n.r.a) + l.a(r $(l.a r.l.a)) + r.a(l $(r.a l.r.a)) + :: + ++ dif :: difference + ~/ %dif + |* b=_a + |- ^+ a + ?~ b + a + =+ c=(bif n.b) + ?> ?=(^ c) + =+ d=$(a l.c, b l.b) + =+ e=$(a r.c, b r.b) + |- ^- [$?(~ _a)] + ?~ d e + ?~ e d + ?: (mor n.d n.e) + d(r $(d r.d)) + e(l $(e l.e)) + :: + ++ dig :: axis of a in b + |= b=* + =+ c=1 + |- ^- (unit @) + ?~ a ~ + ?: =(b n.a) [~ u=(peg c 2)] + ?: (gor b n.a) + $(a l.a, c (peg c 6)) + $(a r.a, c (peg c 7)) + :: + ++ gas :: concatenate + ~/ %gas + |= b=(list _?>(?=(^ a) n.a)) + |- ^+ a + ?~ b + a + $(b t.b, a (put i.b)) + :: +has: does :b exist in :a? + :: + ++ has + ~/ %has + |* b=* + ^- ? + :: wrap extracted item type in a unit because bunting fails + :: + :: If we used the real item type of _?^(a n.a !!) as the sample type, + :: then hoon would bunt it to create the default sample for the gate. + :: + :: However, bunting that expression fails if :a is ~. If we wrap it + :: in a unit, the bunted unit doesn't include the bunted item type. + :: + :: This way we can ensure type safety of :b without needing to perform + :: this failing bunt. It's a hack. + :: + %. [~ b] + |= b=(unit _?>(?=(^ a) n.a)) + => .(b ?>(?=(^ b) u.b)) + |- ^- ? + ?~ a + | + ?: =(b n.a) + & + ?: (gor b n.a) + $(a l.a) + $(a r.a) + :: + ++ int :: intersection + ~/ %int + |* b=_a + |- ^+ a + ?~ b + ~ + ?~ a + ~ + ?. (mor n.a n.b) + $(a b, b a) + ?: =(n.b n.a) + a(l $(a l.a, b l.b), r $(a r.a, b r.b)) + ?: (gor n.b n.a) + %- uni(a $(a l.a, r.b ~)) $(b r.b) + %- uni(a $(a r.a, l.b ~)) $(b l.b) + :: + ++ put :: puts b in a, sorted + ~/ %put + |* b=* + |- ^+ a + ?~ a + [b ~ ~] + ?: =(b n.a) + a + ?: (gor b n.a) + =+ c=$(a l.a) + ?> ?=(^ c) + ?: (mor n.a n.c) + a(l c) + c(r a(l r.c)) + =+ c=$(a r.a) + ?> ?=(^ c) + ?: (mor n.a n.c) + a(r c) + c(l a(r l.c)) + :: + ++ rep :: reduce to product + ~/ %rep + |* b=_=>(~ |=([* *] +<+)) + |- + ?~ a +<+.b + $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b))) + :: + ++ run :: apply gate to values + ~/ %run + |* b=gate + =+ c=`(set _?>(?=(^ a) (b n.a)))`~ + |- ?~ a c + =. c (~(put in c) (b n.a)) + =. c $(a l.a, c c) + $(a r.a, c c) + :: + ++ tap :: convert to list + =< $ + ~/ %tap + =+ b=`(list _?>(?=(^ a) n.a))`~ + |. ^+ b + ?~ a + b + $(a r.a, b [n.a $(a l.a)]) + :: + ++ uni :: union + ~/ %uni + |* b=_a + ?: =(a b) a + |- ^+ a + ?~ b + a + ?~ a + b + ?: =(n.b n.a) + b(l $(a l.a, b l.b), r $(a r.a, b r.b)) + ?: (mor n.a n.b) + ?: (gor n.b n.a) + $(l.a $(a l.a, r.b ~), b r.b) + $(r.a $(a r.a, l.b ~), b l.b) + ?: (gor n.a n.b) + $(l.b $(b l.b, r.a ~), a r.a) + $(r.b $(b r.b, l.a ~), a l.a) + :: + ++ wyt :: size of set + =< $ + ~% %wyt + ~ + |. ^- @ + ?~(a 0 +((add $(a l.a) $(a r.a)))) + -- +:: +:: 2i: map logic ++| %map-logic +:: +++ by :: map engine + ~/ %by + =| a=(tree (pair)) :: (map) + |@ + ++ all :: logical AND + ~/ %all + |* b=$-(* ?) + |- ^- ? + ?~ a + & + ?&((b q.n.a) $(a l.a) $(a r.a)) + :: + ++ any :: logical OR + ~/ %any + |* b=$-(* ?) + |- ^- ? + ?~ a + | + ?|((b q.n.a) $(a l.a) $(a r.a)) + :: + ++ bif :: splits a by b + ~/ %bif + |* b=* + |- ^+ [l=a r=a] + ?~ a + [~ ~] + ?: =(b p.n.a) + +.a + ?: (gor b p.n.a) + =+ d=$(a l.a) + ?> ?=(^ d) + [l.d a(l r.d)] + =+ d=$(a r.a) + ?> ?=(^ d) + [a(r l.d) r.d] + :: + ++ del :: delete at key b + ~/ %del + |* b=* + |- ^+ a + ?~ a + ~ + ?. =(b p.n.a) + ?: (gor b p.n.a) + a(l $(a l.a)) + a(r $(a r.a)) + |- ^- [$?(~ _a)] + ?~ l.a r.a + ?~ r.a l.a + ?: (mor p.n.l.a p.n.r.a) + l.a(r $(l.a r.l.a)) + r.a(l $(r.a l.r.a)) + :: + ++ dif :: difference + ~/ %dif + |* b=_a + |- ^+ a + ?~ b + a + =+ c=(bif p.n.b) + ?> ?=(^ c) + =+ d=$(a l.c, b l.b) + =+ e=$(a r.c, b r.b) + |- ^- [$?(~ _a)] + ?~ d e + ?~ e d + ?: (mor p.n.d p.n.e) + d(r $(d r.d)) + e(l $(e l.e)) + :: + ++ dig :: axis of b key + |= b=* + =+ c=1 + |- ^- (unit @) + ?~ a ~ + ?: =(b p.n.a) [~ u=(peg c 2)] + ?: (gor b p.n.a) + $(a l.a, c (peg c 6)) + $(a r.a, c (peg c 7)) + :: + ++ apt :: check correctness + =< $ + ~/ %apt + =| [l=(unit) r=(unit)] + |. ^- ? + ?~ a & + ?& ?~(l & &((gor p.n.a u.l) !=(p.n.a u.l))) + ?~(r & &((gor u.r p.n.a) !=(u.r p.n.a))) + ?~ l.a & + &((mor p.n.a p.n.l.a) !=(p.n.a p.n.l.a) $(a l.a, l `p.n.a)) + ?~ r.a & + &((mor p.n.a p.n.r.a) !=(p.n.a p.n.r.a) $(a r.a, r `p.n.a)) + == + :: + ++ gas :: concatenate + ~/ %gas + |* b=(list [p=* q=*]) + => .(b `(list _?>(?=(^ a) n.a))`b) + |- ^+ a + ?~ b + a + $(b t.b, a (put p.i.b q.i.b)) + :: + ++ get :: grab value by key + ~/ %get + |* b=* + => .(b `_?>(?=(^ a) p.n.a)`b) + |- ^- (unit _?>(?=(^ a) q.n.a)) + ?~ a + ~ + ?: =(b p.n.a) + (some q.n.a) + ?: (gor b p.n.a) + $(a l.a) + $(a r.a) + :: + ++ got :: need value by key + |* b=* + (need (get b)) + :: + ++ gut :: fall value by key + |* [b=* c=*] + (fall (get b) c) + :: + ++ has :: key existence check + ~/ %has + |* b=* + !=(~ (get b)) + :: + ++ int :: intersection + ~/ %int + |* b=_a + |- ^+ a + ?~ b + ~ + ?~ a + ~ + ?: (mor p.n.a p.n.b) + ?: =(p.n.b p.n.a) + b(l $(a l.a, b l.b), r $(a r.a, b r.b)) + ?: (gor p.n.b p.n.a) + %- uni(a $(a l.a, r.b ~)) $(b r.b) + %- uni(a $(a r.a, l.b ~)) $(b l.b) + ?: =(p.n.a p.n.b) + b(l $(b l.b, a l.a), r $(b r.b, a r.a)) + ?: (gor p.n.a p.n.b) + %- uni(a $(b l.b, r.a ~)) $(a r.a) + %- uni(a $(b r.b, l.a ~)) $(a l.a) + :: + ++ jab + ~/ %jab + |* [key=_?>(?=(^ a) p.n.a) fun=$-(_?>(?=(^ a) q.n.a) _?>(?=(^ a) q.n.a))] + ^+ a + :: + ?~ a !! + :: + ?: =(key p.n.a) + a(q.n (fun q.n.a)) + :: + ?: (gor key p.n.a) + a(l $(a l.a)) + :: + a(r $(a r.a)) + :: + ++ mar :: add with validation + |* [b=* c=(unit *)] + ?~ c + (del b) + (put b u.c) + :: + ++ put :: adds key-value pair + ~/ %put + |* [b=* c=*] + |- ^+ a + ?~ a + [[b c] ~ ~] + ?: =(b p.n.a) + ?: =(c q.n.a) + a + a(n [b c]) + ?: (gor b p.n.a) + =+ d=$(a l.a) + ?> ?=(^ d) + ?: (mor p.n.a p.n.d) + a(l d) + d(r a(l r.d)) + =+ d=$(a r.a) + ?> ?=(^ d) + ?: (mor p.n.a p.n.d) + a(r d) + d(l a(r l.d)) + :: + ++ rep :: reduce to product + ~/ %rep + |* b=_=>(~ |=([* *] +<+)) + |- + ?~ a +<+.b + $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b))) + :: + ++ rib :: transform + product + |* [b=* c=gate] + |- ^+ [b a] + ?~ a [b ~] + =+ d=(c n.a b) + =. n.a +.d + =+ e=$(a l.a, b -.d) + =+ f=$(a r.a, b -.e) + [-.f a(l +.e, r +.f)] + :: + ++ run :: apply gate to values + ~/ %run + |* b=gate + |- + ?~ a a + [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)] + :: + ++ tap :: listify pairs + =< $ + ~/ %tap + =+ b=`(list _?>(?=(^ a) n.a))`~ + |. ^+ b + ?~ a + b + $(a r.a, b [n.a $(a l.a)]) + :: + ++ uni :: union, merge + ~/ %uni + |* b=_a + |- ^+ a + ?~ b + a + ?~ a + b + ?: =(p.n.b p.n.a) + b(l $(a l.a, b l.b), r $(a r.a, b r.b)) + ?: (mor p.n.a p.n.b) + ?: (gor p.n.b p.n.a) + $(l.a $(a l.a, r.b ~), b r.b) + $(r.a $(a r.a, l.b ~), b l.b) + ?: (gor p.n.a p.n.b) + $(l.b $(b l.b, r.a ~), a r.a) + $(r.b $(b r.b, l.a ~), a l.a) + :: + ++ uno :: general union + |* b=_a + |* meg=$-([* * *] *) + |- ^+ a + ?~ b + a + ?~ a + b + ?: =(p.n.b p.n.a) + :+ [p.n.a `_?>(?=(^ a) q.n.a)`(meg p.n.a q.n.a q.n.b)] + $(b l.b, a l.a) + $(b r.b, a r.a) + ?: (mor p.n.a p.n.b) + ?: (gor p.n.b p.n.a) + $(l.a $(a l.a, r.b ~), b r.b) + $(r.a $(a r.a, l.b ~), b l.b) + ?: (gor p.n.a p.n.b) + $(l.b $(b l.b, r.a ~), a r.a) + $(r.b $(b r.b, l.a ~), a l.a) + :: + ++ urn :: apply gate to nodes + ~/ %urn + |* b=$-([* *] *) + |- + ?~ a ~ + a(n n.a(q (b p.n.a q.n.a)), l $(a l.a), r $(a r.a)) + :: + ++ wyt :: depth of map + =< $ + ~% %wyt + ~ + |. ^- @ + ?~(a 0 +((add $(a l.a) $(a r.a)))) + :: + ++ key :: set of keys + =< $ + ~/ %key + =+ b=`(set _?>(?=(^ a) p.n.a))`~ + |. ^+ b + ?~ a b + $(a r.a, b $(a l.a, b (~(put in b) p.n.a))) + :: + ++ val :: list of vals + =+ b=`(list _?>(?=(^ a) q.n.a))`~ + |- ^+ b + ?~ a b + $(a r.a, b [q.n.a $(a l.a)]) + -- +:: +:: 2j: jar and jug logic ++| %jar-and-jug-logic +++ ja :: jar engine + =| a=(tree (pair * (list))) :: (jar) + |@ + ++ get :: gets list by key + |* b=* + =+ c=(~(get by a) b) + ?~(c ~ u.c) + :: + ++ add :: adds key-list pair + |* [b=* c=*] + =+ d=(get b) + (~(put by a) b [c d]) + :: + ++ zip :: listify jar + =< $ + ~/ %zip + =+ b=`(list _?>(?=([[* ^] *] a) [p=p q=i.q]:n.a))`~ + |. ^+ b + ?~ a b + %= $ + a r.a + b |- ^+ b + ?~ q.n.a ^$(a l.a) + [[p i.q]:n.a $(q.n.a t.q.n.a)] + == + -- +++ ju :: jug engine + =| a=(tree (pair * (tree))) :: (jug) + |@ + ++ del :: del key-set pair + |* [b=* c=*] + ^+ a + =+ d=(get b) + =+ e=(~(del in d) c) + ?~ e + (~(del by a) b) + (~(put by a) b e) + :: + ++ gas :: concatenate + |* b=(list [p=* q=*]) + => .(b `(list _?>(?=([[* ^] ^] a) [p=p q=n.q]:n.a))`b) + |- ^+ a + ?~ b + a + $(b t.b, a (put p.i.b q.i.b)) + :: + ++ get :: gets set by key + |* b=* + =+ c=(~(get by a) b) + ?~(c ~ u.c) + :: + ++ has :: existence check + |* [b=* c=*] + ^- ? + (~(has in (get b)) c) + :: + ++ put :: add key-set pair + |* [b=* c=*] + ^+ a + =+ d=(get b) + (~(put by a) b (~(put in d) c)) + -- +:: +:: 2k: queue logic ++| %queue-logic +:: +++ to :: queue engine + =| a=(tree) :: (qeu) + |@ + ++ apt :: check correctness + |- ^- ? + ?~ a & + ?& ?~(l.a & ?&((mor n.a n.l.a) $(a l.a))) + ?~(r.a & ?&((mor n.a n.r.a) $(a r.a))) + == + :: + ++ bal + |- ^+ a + ?~ a ~ + ?. |(?=(~ l.a) (mor n.a n.l.a)) + $(a l.a(r $(a a(l r.l.a)))) + ?. |(?=(~ r.a) (mor n.a n.r.a)) + $(a r.a(l $(a a(r l.r.a)))) + a + :: + ++ dep :: max depth of queue + |- ^- @ + ?~ a 0 + +((max $(a l.a) $(a r.a))) + :: + ++ gas :: insert list to que + |= b=(list _?>(?=(^ a) n.a)) + |- ^+ a + ?~(b a $(b t.b, a (put i.b))) + :: + ++ get :: head-rest pair + |- ^+ ?>(?=(^ a) [p=n.a q=*(tree _n.a)]) + ?~ a + !! + ?~ r.a + [n.a l.a] + =+ b=$(a r.a) + :- p.b + ?: |(?=(~ q.b) (mor n.a n.q.b)) + a(r q.b) + a(n n.q.b, l a(r l.q.b), r r.q.b) + :: + ++ nip :: removes root + |- ^+ a + ?~ a ~ + ?~ l.a r.a + ?~ r.a l.a + ?: (mor n.l.a n.r.a) + l.a(r $(l.a r.l.a)) + r.a(l $(r.a l.r.a)) + :: + ++ nap :: removes root + ?> ?=(^ a) + ?: =(~ l.a) r.a + =+ b=get(a l.a) + bal(n.a p.b, l.a q.b) + :: + ++ put :: insert new tail + |* b=* + |- ^+ a + ?~ a + [b ~ ~] + bal(l.a $(a l.a)) + :: + ++ run :: apply gate to values + |* b=gate + |- + ?~ a a + [n=(b n.a) l=$(a l.a) r=$(a r.a)] + :: + ++ tap :: adds list to end + =+ b=`(list _?>(?=(^ a) n.a))`~ + |- ^+ b + =+ 0 :: hack for jet match + ?~ a + b + $(a r.a, b [n.a $(a l.a)]) + :: + ++ top :: produces head + |- ^- (unit _?>(?=(^ a) n.a)) + ?~ a ~ + ?~(r.a [~ n.a] $(a r.a)) + -- +:: +:: 2l: container from container ++| %container-from-container +:: +++ malt :: map from list + |* a=(list) + (molt `(list [p=_-<.a q=_->.a])`a) +:: +++ molt :: map from pair list + |* a=(list (pair)) :: ^- =,(i.-.a (map _p _q)) + (~(gas by `(tree [p=_p.i.-.a q=_q.i.-.a])`~) a) +:: +++ silt :: set from list + |* a=(list) :: ^- (set _i.-.a) + =+ b=*(tree _?>(?=(^ a) i.a)) + (~(gas in b) a) +:: +:: 2m: container from noun ++| %container-from-noun +:: +++ ly :: list from raw noun + le:nl +:: +++ my :: map from raw noun + my:nl +:: +++ sy :: set from raw noun + si:nl +:: +++ nl + |% + :: :: + ++ le :: construct list + |* a=(list) + ^+ =< $ + |@ ++ $ ?:(*? ~ [i=(snag 0 a) t=$]) + -- + a + :: :: + ++ my :: construct map + |* a=(list (pair)) + => .(a ^+((le a) a)) + (~(gas by `(map _p.i.-.a _q.i.-.a)`~) a) + :: :: + ++ si :: construct set + |* a=(list) + => .(a ^+((le a) a)) + (~(gas in `(set _i.-.a)`~) a) + :: :: + ++ snag :: index + |* [a=@ b=(list)] + ?~ b + ~_ leaf+"snag-fail" + !! + ?: =(0 a) i.b + $(b t.b, a (dec a)) + :: :: + ++ weld :: concatenate + |* [a=(list) b=(list)] + => .(a ^+((le a) a), b ^+((le b) b)) + =+ 42 + |- + ?~ a b + [i=i.a t=$(a t.a)] + -- +:: 2n: functional hacks ++| %functional-hacks +:: +++ aftr |*(a=$-(* *) |*(b=$-(* *) (pair b a))) :: pair after +++ cork |*([a=$-(* *) b=$-(* *)] (corl b a)) :: compose forward +++ corl :: compose backwards + |* [a=$-(* *) b=$-(* *)] + =< +:|.((a (b))) :: type check + |* c=_,.+<.b + (a (b c)) +:: +++ cury :: curry left + |* [a=$-(^ *) b=*] + |* c=_,.+<+.a + (a b c) +:: +++ curr :: curry right + |* [a=$-(^ *) c=*] + |* b=_,.+<-.a + (a b c) +:: +++ fore |*(a=$-(* *) |*(b=$-(* *) (pair a b))) :: pair before +:: +++ head |*(^ ,:+<-) :: get head +++ same |*(* +<) :: identity +:: +++ succ |=(@ +(+<)) :: successor +:: +++ tail |*(^ ,:+<+) :: get tail +++ test |=(^ =(+<- +<+)) :: equality +:: +++ lead |*(* |*(* [+>+< +<])) :: put head +++ late |*(* |*(* [+< +>+<])) :: put tail +:: +:: 2o: containers ++| %containers +++ jar |$ [key value] (map key (list value)) :: map of lists +++ jug |$ [key value] (map key (set value)) :: map of sets +:: +++ map + |$ [key value] :: table + $| (tree (pair key value)) + |=(a=(tree (pair)) ?:(=(~ a) & ~(apt by a))) +:: +++ qeu + |$ [item] :: queue + $| (tree item) + |=(a=(tree) ?:(=(~ a) & ~(apt to a))) +:: +++ set + |$ [item] :: set + $| (tree item) + |=(a=(tree) ?:(=(~ a) & ~(apt in a))) +:: +:: 2p: serialization ++| %serialization +:: +++ cue :: unpack + ~/ %cue + |= a=@ + ^- * + =+ b=0 + =+ m=`(map @ *)`~ + =< q + |- ^- [p=@ q=* r=(map @ *)] + ?: =(0 (cut 0 [b 1] a)) + =+ c=(rub +(b) a) + [+(p.c) q.c (~(put by m) b q.c)] + =+ c=(add 2 b) + ?: =(0 (cut 0 [+(b) 1] a)) + =+ u=$(b c) + =+ v=$(b (add p.u c), m r.u) + =+ w=[q.u q.v] + [(add 2 (add p.u p.v)) w (~(put by r.v) b w)] + =+ d=(rub c a) + [(add 2 p.d) (need (~(get by m) q.d)) m] +:: +++ jam :: pack + ~/ %jam + |= a=* + ^- @ + =+ b=0 + =+ m=`(map * @)`~ + =< q + |- ^- [p=@ q=@ r=(map * @)] + =+ c=(~(get by m) a) + ?~ c + => .(m (~(put by m) a b)) + ?: ?=(@ a) + =+ d=(mat a) + [(add 1 p.d) (lsh 0 q.d) m] + => .(b (add 2 b)) + =+ d=$(a -.a) + =+ e=$(a +.a, b (add b p.d), m r.d) + [(add 2 (add p.d p.e)) (mix 1 (lsh [0 2] (cat 0 q.d q.e))) r.e] + ?: ?&(?=(@ a) (lte (met 0 a) (met 0 u.c))) + =+ d=(mat a) + [(add 1 p.d) (lsh 0 q.d) m] + =+ d=(mat u.c) + [(add 2 p.d) (mix 3 (lsh [0 2] q.d)) m] +:: +++ mat :: length-encode + ~/ %mat + |= a=@ + ^- [p=@ q=@] + ?: =(0 a) + [1 1] + =+ b=(met 0 a) + =+ c=(met 0 b) + :- (add (add c c) b) + (cat 0 (bex c) (mix (end [0 (dec c)] b) (lsh [0 (dec c)] a))) +:: +++ rub :: length-decode + ~/ %rub + |= [a=@ b=@] + ^- [p=@ q=@] + =+ ^= c + =+ [c=0 m=(met 0 b)] + |- ?< (gth c m) + ?. =(0 (cut 0 [(add a c) 1] b)) + c + $(c +(c)) + ?: =(0 c) + [1 0] + =+ d=(add a +(c)) + =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b)) + [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)] +:: +++ fn :: float, infinity, or NaN + :: + :: s=sign, e=exponent, a=arithmetic form + :: (-1)^s * a * 2^e + $% [%f s=? e=@s a=@u] + [%i s=?] + [%n ~] + == +:: +++ dn :: decimal float, infinity, or NaN + :: + :: (-1)^s * a * 10^e + $% [%d s=? e=@s a=@u] + [%i s=?] + [%n ~] + == +:: +++ rn :: parsed decimal float + :: + $% [%d a=? b=[c=@ [d=@ e=@] f=? i=@]] + [%i a=?] + [%n ~] + == +:: +:: 2q: molds and mold builders ++| %molds-and-mold-builders +:: ++$ axis @ :: tree address ++$ bean ? :: 0=&=yes, 1=|=no ++$ flag ? ++$ char @t :: UTF8 byte ++$ cord @t :: UTF8, LSB first ++$ byts [wid=@ud dat=@] :: bytes, MSB first ++$ date [[a=? y=@ud] m=@ud t=tarp] :: parsed date ++$ knot @ta :: ASCII text ++$ noun * :: any noun ++$ path (list knot) :: like unix path ++$ pith (list iota) :: typed urbit path ++$ stud :: standard name + $@ mark=@tas :: auth=urbit + $: auth=@tas :: standards authority + type=path :: standard label + == :: ++$ tang (list tank) :: bottom-first error +:: :: ++$ iota :: typed path segment + $+ iota + $~ [%n ~] + $@ @tas + $% [%ub @ub] [%uc @uc] [%ud @ud] [%ui @ui] + [%ux @ux] [%uv @uv] [%uw @uw] + [%sb @sb] [%sc @sc] [%sd @sd] [%si @si] + [%sx @sx] [%sv @sv] [%sw @sw] + [%da @da] [%dr @dr] + [%f ?] [%n ~] + [%if @if] [%is @is] + [%t @t] [%ta @ta] :: @tas + [%p @p] [%q @q] + [%rs @rs] [%rd @rd] [%rh @rh] [%rq @rq] + == +:: +:: $tank: formatted print tree +:: +:: just a cord, or +:: %leaf: just a tape +:: %palm: backstep list +:: flat-mid, open, flat-open, flat-close +:: %rose: flat list +:: flat-mid, open, close +:: ++$ tank + $+ tank + $~ leaf/~ + $@ cord + $% [%leaf p=tape] + [%palm p=(qual tape tape tape tape) q=(list tank)] + [%rose p=(trel tape tape tape) q=(list tank)] + == +:: ++$ tape (list @tD) :: utf8 string as list ++$ tour (list @c) :: utf32 clusters ++$ tarp [d=@ud h=@ud m=@ud s=@ud f=(list @ux)] :: parsed time ++$ term @tas :: ascii symbol ++$ wain (list cord) :: text lines ++$ wall (list tape) :: text lines +:: +-- => +:: :: +~% %tri + + == + %year year + %yore yore + %ob ob + == +:: layer-3 +:: +|% +:: 3a: signed and modular ints ++| %signed-and-modular-ints +:: +++ egcd :: schneier's egcd + |= [a=@ b=@] + =+ si + =+ [c=(sun a) d=(sun b)] + =+ [u=[c=(sun 1) d=--0] v=[c=--0 d=(sun 1)]] + |- ^- [d=@ u=@s v=@s] + ?: =(--0 c) + [(abs d) d.u d.v] + :: ?> ?& =(c (sum (pro (sun a) c.u) (pro (sun b) c.v))) + :: =(d (sum (pro (sun a) d.u) (pro (sun b) d.v))) + :: == + =+ q=(fra d c) + %= $ + c (dif d (pro q c)) + d c + u [(dif d.u (pro q c.u)) c.u] + v [(dif d.v (pro q c.v)) c.v] + == +:: +++ fo :: modulo prime + ^| + |_ a=@ + ++ dif + |= [b=@ c=@] + (sit (sub (add a b) (sit c))) + :: + ++ exp + |= [b=@ c=@] + ?: =(0 b) + 1 + =+ d=$(b (rsh 0 b)) + =+ e=(pro d d) + ?:(=(0 (end 0 b)) e (pro c e)) + :: + ++ fra + |= [b=@ c=@] + (pro b (inv c)) + :: + ++ inv + |= b=@ + =+ c=(dul:si u:(egcd b a) a) + c + :: + ++ pro + |= [b=@ c=@] + (sit (mul b c)) + :: + ++ sit + |= b=@ + (mod b a) + :: + ++ sum + |= [b=@ c=@] + (sit (add b c)) + -- +:: +++ si :: signed integer + ^? + |% + ++ abs |=(a=@s (add (end 0 a) (rsh 0 a))) :: absolute value + ++ dif |= [a=@s b=@s] :: subtraction + (sum a (new !(syn b) (abs b))) + ++ dul |= [a=@s b=@] :: modulus + =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c))) + ++ fra |= [a=@s b=@s] :: divide + (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b))) + ++ new |= [a=? b=@] :: [sign value] to @s + `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b))))) + ++ old |=(a=@s [(syn a) (abs a)]) :: [sign value] + ++ pro |= [a=@s b=@s] :: multiplication + (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b))) + ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b)))) :: remainder + ++ sum |= [a=@s b=@s] :: addition + =+ [c=(old a) d=(old b)] + ?: -.c + ?: -.d + (new & (add +.c +.d)) + ?: (gte +.c +.d) + (new & (sub +.c +.d)) + (new | (sub +.d +.c)) + ?: -.d + ?: (gte +.c +.d) + (new | (sub +.c +.d)) + (new & (sub +.d +.c)) + (new | (add +.c +.d)) + ++ sun |=(a=@u (mul 2 a)) :: @u to @s + ++ syn |=(a=@s =(0 (end 0 a))) :: sign test + ++ cmp |= [a=@s b=@s] :: compare + ^- @s + ?: =(a b) + --0 + ?: (syn a) + ?: (syn b) + ?: (gth a b) + --1 + -1 + --1 + ?: (syn b) + -1 + ?: (gth a b) + -1 + --1 + -- +:: +:: 3b: floating point ++| %floating-point +:: +++ fl :: arb. precision fp + =/ [[p=@u v=@s w=@u] r=$?(%n %u %d %z %a) d=$?(%d %f %i)] + [[113 -16.494 32.765] %n %d] + :: p=precision: number of bits in arithmetic form; must be at least 2 + :: v=min exponent: minimum value of e + :: w=width: max - min value of e, 0 is fixed point + :: r=rounding mode: nearest (ties to even), up, down, to zero, away from zero + :: d=behavior: return denormals, flush denormals to zero, + :: infinite exponent range + => + ~% %cofl +> ~ + :: cofl + :: + :: internal functions; mostly operating on [e=@s a=@u], in other words + :: positive numbers. many of these error out if a=0. + |% + ++ rou + |= [a=[e=@s a=@u]] ^- fn (rau a &) + :: + ++ rau + |= [a=[e=@s a=@u] t=?] ^- fn + ?- r + %z (lug %fl a t) %d (lug %fl a t) + %a (lug %ce a t) %u (lug %ce a t) + %n (lug %ne a t) + == + :: + ++ add :: add; exact if e + |= [a=[e=@s a=@u] b=[e=@s a=@u] e=?] ^- fn + =+ q=(dif:si e.a e.b) + |- ?. (syn:si q) $(b a, a b, q +(q)) :: a has larger exp + ?: e + [%f & e.b (^add (lsh [0 (abs:si q)] a.a) a.b)] + =+ [ma=(met 0 a.a) mb=(met 0 a.b)] + =+ ^= w %+ dif:si e.a %- sun:si :: expanded exp of a + ?: (gth prc ma) (^sub prc ma) 0 + =+ ^= x %+ sum:si e.b (sun:si mb) :: highest exp for b + ?: =((cmp:si w x) --1) :: don't need to add + ?- r + %z (lug %fl a &) %d (lug %fl a &) + %a (lug %lg a &) %u (lug %lg a &) + %n (lug %na a &) + == + (rou [e.b (^add (lsh [0 (abs:si q)] a.a) a.b)]) + :: + ++ sub :: subtract; exact if e + |= [a=[e=@s a=@u] b=[e=@s a=@u] e=?] ^- fn + =+ q=(dif:si e.a e.b) + |- ?. (syn:si q) + (fli $(b a, a b, q +(q), r swr)) + =+ [ma=(met 0 a.a) mb=(met 0 a.b)] + =+ ^= w %+ dif:si e.a %- sun:si + ?: (gth prc ma) (^sub prc ma) 0 + =+ ^= x %+ sum:si e.b (sun:si +(mb)) + ?: &(!e =((cmp:si w x) --1)) + ?- r + %z (lug %sm a &) %d (lug %sm a &) + %a (lug %ce a &) %u (lug %ce a &) + %n (lug %nt a &) + == + =+ j=(lsh [0 (abs:si q)] a.a) + |- ?. (gte j a.b) + (fli $(a.b j, j a.b, r swr)) + =+ i=(^sub j a.b) + ?~ i [%f & zer] + ?: e [%f & e.b i] (rou [e.b i]) + :: + ++ mul :: multiply + |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- fn + (rou (sum:si e.a e.b) (^mul a.a a.b)) + :: + ++ div :: divide + |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- fn + =+ [ma=(met 0 a.a) mb=(met 0 a.b)] + =+ v=(dif:si (sun:si ma) (sun:si +((^add mb prc)))) + =. a ?: (syn:si v) a + a(e (sum:si v e.a), a (lsh [0 (abs:si v)] a.a)) + =+ [j=(dif:si e.a e.b) q=(dvr a.a a.b)] + (rau [j p.q] =(q.q 0)) + :: + ++ sqt :: square root + |= [a=[e=@s a=@u]] ^- fn + =. a + =+ [w=(met 0 a.a) x=(^mul +(prc) 2)] + =+ ?:((^lth w x) (^sub x w) 0) + =+ ?: =((dis - 1) (dis (abs:si e.a) 1)) - + (^add - 1) + a(e (dif:si e.a (sun:si -)), a (lsh [0 -] a.a)) + =+ [y=(^sqt a.a) z=(fra:si e.a --2)] + (rau [z p.y] =(q.y 0)) + :: + ++ lth :: less-than + |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- ? + ?: =(e.a e.b) (^lth a.a a.b) + =+ c=(cmp:si (ibl a) (ibl b)) + ?: =(c -1) & ?: =(c --1) | + ?: =((cmp:si e.a e.b) -1) + (^lth (rsh [0 (abs:si (dif:si e.a e.b))] a.a) a.b) + (^lth (lsh [0 (abs:si (dif:si e.a e.b))] a.a) a.b) + :: + ++ equ :: equals + |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- ? + ?. =((ibl a) (ibl b)) | + ?: =((cmp:si e.a e.b) -1) + =((lsh [0 (abs:si (dif:si e.a e.b))] a.b) a.a) + =((lsh [0 (abs:si (dif:si e.a e.b))] a.a) a.b) + :: + :: integer binary logarithm: 2^ibl(a) <= |a| < 2^(ibl(a)+1) + ++ ibl + |= [a=[e=@s a=@u]] ^- @s + (sum:si (sun:si (dec (met 0 a.a))) e.a) + :: + :: +uni + :: + :: change to a representation where a.a is odd + :: every fn has a unique representation of this kind + ++ uni + |= [a=[e=@s a=@u]] + |- ?: =((end 0 a.a) 1) a + $(a.a (rsh 0 a.a), e.a (sum:si e.a --1)) + :: + :: +xpd: expands to either full precision or to denormalized + ++ xpd + |= [a=[e=@s a=@u]] + =+ ma=(met 0 a.a) + ?: (gte ma prc) a + =+ ?: =(den %i) (^sub prc ma) + =+ ^= q + =+ w=(dif:si e.a emn) + ?: (syn:si w) (abs:si w) 0 + (min q (^sub prc ma)) + a(e (dif:si e.a (sun:si -)), a (lsh [0 -] a.a)) + :: + :: +lug: central rounding mechanism + :: + :: can perform: floor, ceiling, smaller, larger, + :: nearest (round ties to: even, away from 0, toward 0) + :: s is sticky bit: represents a value less than ulp(a) = 2^(e.a) + :: + ++ lug + ~/ %lug + |= [t=$?(%fl %ce %sm %lg %ne %na %nt) a=[e=@s a=@u] s=?] ^- fn + ?< =(a.a 0) + =- + ?. =(den %f) - :: flush denormals + ?. ?=([%f *] -) - + ?: =((met 0 ->+>) prc) - [%f & zer] + :: + =+ m=(met 0 a.a) + ?> |(s (gth m prc)) :: require precision + =+ ^= q %+ max + ?: (gth m prc) (^sub m prc) 0 :: reduce precision + %- abs:si ?: =(den %i) --0 :: enforce min. exp + ?: =((cmp:si e.a emn) -1) (dif:si emn e.a) --0 + =^ b a :- (end [0 q] a.a) + a(e (sum:si e.a (sun:si q)), a (rsh [0 q] a.a)) + :: + ?~ a.a + ?< =(den %i) + ?- t + %fl [%f & zer] + %sm [%f & zer] + %ce [%f & spd] + %lg [%f & spd] + %ne ?: s [%f & ?:((lte b (bex (dec q))) zer spd)] + [%f & ?:((^lth b (bex (dec q))) zer spd)] + %nt ?: s [%f & ?:((lte b (bex (dec q))) zer spd)] + [%f & ?:((^lth b (bex (dec q))) zer spd)] + %na [%f & ?:((^lth b (bex (dec q))) zer spd)] + == + :: + =. a (xpd a) + :: + =. a + ?- t + %fl a + %lg a(a +(a.a)) + %sm ?. &(=(b 0) s) a + ?: &(=(e.a emn) !=(den %i)) a(a (dec a.a)) + =+ y=(dec (^mul a.a 2)) + ?. (lte (met 0 y) prc) a(a (dec a.a)) + [(dif:si e.a --1) y] + %ce ?: &(=(b 0) s) a a(a +(a.a)) + %ne ?~ b a + =+ y=(bex (dec q)) + ?: &(=(b y) s) :: round halfs to even + ?~ (dis a.a 1) a a(a +(a.a)) + ?: (^lth b y) a a(a +(a.a)) + %na ?~ b a + =+ y=(bex (dec q)) + ?: (^lth b y) a a(a +(a.a)) + %nt ?~ b a + =+ y=(bex (dec q)) + ?: =(b y) ?: s a a(a +(a.a)) + ?: (^lth b y) a a(a +(a.a)) + == + :: + =. a ?. =((met 0 a.a) +(prc)) a + a(a (rsh 0 a.a), e (sum:si e.a --1)) + ?~ a.a [%f & zer] + :: + ?: =(den %i) [%f & a] + ?: =((cmp:si emx e.a) -1) [%i &] [%f & a] :: enforce max. exp + :: + ++ drg :: dragon4; get + ~/ %drg :: printable decimal; + |= [a=[e=@s a=@u]] ^- [@s @u] :: guaranteed accurate + ?< =(a.a 0) :: for rounded floats + =. a (xpd a) + =+ r=(lsh [0 ?:((syn:si e.a) (abs:si e.a) 0)] a.a) + =+ s=(lsh [0 ?.((syn:si e.a) (abs:si e.a) 0)] 1) + =+ mn=(lsh [0 ?:((syn:si e.a) (abs:si e.a) 0)] 1) + =+ mp=mn + => ?. + ?& =(a.a (bex (dec prc))) :: if next smallest + |(!=(e.a emn) =(den %i)) :: float is half ULP, + == :: tighten lower bound + . + %= . + mp (lsh 0 mp) + r (lsh 0 r) + s (lsh 0 s) + == + =+ [k=--0 q=(^div (^add s 9) 10)] + |- ?: (^lth r q) + %= $ + k (dif:si k --1) + r (^mul r 10) + mn (^mul mn 10) + mp (^mul mp 10) + == + |- ?: (gte (^add (^mul r 2) mp) (^mul s 2)) + $(s (^mul s 10), k (sum:si k --1)) + =+ [u=0 o=0] + |- :: r/s+o = a*10^-k + =+ v=(dvr (^mul r 10) s) + => %= . + k (dif:si k --1) + u p.v + r q.v + mn (^mul mn 10) + mp (^mul mp 10) + == + =+ l=(^lth (^mul r 2) mn) :: in lower bound + =+ ^= h :: in upper bound + ?| (^lth (^mul s 2) mp) + (gth (^mul r 2) (^sub (^mul s 2) mp)) + == + ?: &(!l !h) + $(o (^add (^mul o 10) u)) + =+ q=&(h |(!l (gth (^mul r 2) s))) + =. o (^add (^mul o 10) ?:(q +(u) u)) + [k o] + :: + ++ toj :: round to integer + |= [a=[e=@s a=@u]] ^- fn + ?. =((cmp:si e.a --0) -1) [%f & a] + =+ x=(abs:si e.a) + =+ y=(rsh [0 x] a.a) + ?: |(=(r %d) =(r %z)) [%f & --0 y] + =+ z=(end [0 x] a.a) + ?: |(=(r %u) =(r %a)) [%f & --0 ?~(z y +(y))] + =+ i=(bex (dec x)) + ?: &(=(z i) =((dis y 1) 0)) [%f & --0 y] + ?: (^lth z i) [%f & --0 y] [%f & --0 +(y)] + :: + ++ ned :: require ?=([%f *] a) + |= [a=fn] ^- [%f s=? e=@s a=@u] + ?: ?=([%f *] a) a + ~_ leaf+"need-float" + !! + :: + ++ shf :: a * 2^b; no rounding + |= [a=fn b=@s] + ?: |(?=([%n *] a) ?=([%i *] a)) a + a(e (sum:si e.a b)) + :: + ++ fli :: flip sign + |= [a=fn] ^- fn + ?-(-.a %f a(s !s.a), %i a(s !s.a), %n a) + :: + ++ swr ?+(r r %d %u, %u %d) :: flipped rounding + ++ prc ?>((gth p 1) p) :: force >= 2 precision + ++ den d :: denorm+flush+inf exp + ++ emn v :: minimum exponent + ++ emx (sum:si emn (sun:si w)) :: maximum exponent + ++ spd [e=emn a=1] :: smallest denormal + ++ spn [e=emn a=(bex (dec prc))] :: smallest normal + ++ lfn [e=emx a=(fil 0 prc 1)] :: largest + ++ lfe (sum:si emx (sun:si prc)) :: 2^lfe is > than all + ++ zer [e=--0 a=0] + -- + |% + ++ rou :: round + |= [a=fn] ^- fn + ?. ?=([%f *] a) a + ?~ a.a [%f s.a zer] + ?: s.a (^rou +>.a) + =.(r swr (fli (^rou +>.a))) + :: + ++ syn :: get sign + |= [a=fn] ^- ? + ?-(-.a %f s.a, %i s.a, %n &) + :: + ++ abs :: absolute value + |= [a=fn] ^- fn + ?: ?=([%f *] a) [%f & e.a a.a] + ?: ?=([%i *] a) [%i &] [%n ~] + :: + ++ add :: add + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: |(?=([%i *] a) ?=([%i *] b)) + ?: &(?=([%i *] a) ?=([%i *] b)) + ?: =(a b) a [%n ~] + ?: ?=([%i *] a) a b + ?: |(=(a.a 0) =(a.b 0)) + ?. &(=(a.a 0) =(a.b 0)) %- rou ?~(a.a b a) + [%f ?:(=(r %d) &(s.a s.b) |(s.a s.b)) zer] + %- |= [a=fn] + ?. ?=([%f *] a) a + ?. =(a.a 0) a + [%f !=(r %d) zer] + ?: =(s.a s.b) + ?: s.a (^add +>.a +>.b |) + =.(r swr (fli (^add +>.a +>.b |))) + ?: s.a (^sub +>.a +>.b |) + (^sub +>.b +>.a |) + :: + ++ ead :: exact add + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: |(?=([%i *] a) ?=([%i *] b)) + ?: &(?=([%i *] a) ?=([%i *] b)) + ?: =(a b) a [%n ~] + ?: ?=([%i *] a) a b + ?: |(=(a.a 0) =(a.b 0)) + ?. &(=(a.a 0) =(a.b 0)) ?~(a.a b a) + [%f ?:(=(r %d) &(s.a s.b) |(s.a s.b)) zer] + %- |= [a=fn] + ?. ?=([%f *] a) a + ?. =(a.a 0) a + [%f !=(r %d) zer] + ?: =(s.a s.b) + ?: s.a (^add +>.a +>.b &) + (fli (^add +>.a +>.b &)) + ?: s.a (^sub +>.a +>.b &) + (^sub +>.b +>.a &) + :: + ++ sub :: subtract + |= [a=fn b=fn] ^- fn (add a (fli b)) + :: + ++ mul :: multiply + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: ?=([%i *] a) + ?: ?=([%i *] b) + [%i =(s.a s.b)] + ?: =(a.b 0) [%n ~] [%i =(s.a s.b)] + ?: ?=([%i *] b) + ?: =(a.a 0) [%n ~] [%i =(s.a s.b)] + ?: |(=(a.a 0) =(a.b 0)) [%f =(s.a s.b) zer] + ?: =(s.a s.b) (^mul +>.a +>.b) + =.(r swr (fli (^mul +>.a +>.b))) + :: + ++ emu :: exact multiply + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: ?=([%i *] a) + ?: ?=([%i *] b) + [%i =(s.a s.b)] + ?: =(a.b 0) [%n ~] [%i =(s.a s.b)] + ?: ?=([%i *] b) + ?: =(a.a 0) [%n ~] [%i =(s.a s.b)] + ?: |(=(a.a 0) =(a.b 0)) [%f =(s.a s.b) zer] + [%f =(s.a s.b) (sum:si e.a e.b) (^^mul a.a a.b)] + :: + ++ div :: divide + |= [a=fn b=fn] ^- fn + ?: |(?=([%n *] a) ?=([%n *] b)) [%n ~] + ?: ?=([%i *] a) + ?: ?=([%i *] b) [%n ~] [%i =(s.a s.b)] + ?: ?=([%i *] b) [%f =(s.a s.b) zer] + ?: =(a.a 0) ?: =(a.b 0) [%n ~] [%f =(s.a s.b) zer] + ?: =(a.b 0) [%i =(s.a s.b)] + ?: =(s.a s.b) (^div +>.a +>.b) + =.(r swr (fli (^div +>.a +>.b))) + :: + ++ fma :: fused multiply-add + |= [a=fn b=fn c=fn] ^- fn :: (a * b) + c + (add (emu a b) c) + :: + ++ sqt :: square root + |= [a=fn] ^- fn + ?: ?=([%n *] a) [%n ~] + ?: ?=([%i *] a) ?:(s.a a [%n ~]) + ?~ a.a [%f s.a zer] + ?: s.a (^sqt +>.a) [%n ~] + :: + ++ inv :: inverse + |= [a=fn] ^- fn + (div [%f & --0 1] a) + :: + ++ sun :: uns integer to float + |= [a=@u] ^- fn + (rou [%f & --0 a]) + :: + ++ san :: sgn integer to float + |= [a=@s] ^- fn + =+ b=(old:si a) + (rou [%f -.b --0 +.b]) + :: + ++ lth :: less-than + :: comparisons return ~ in the event of a NaN + |= [a=fn b=fn] ^- (unit ?) + ?: |(?=([%n *] a) ?=([%n *] b)) ~ :- ~ + ?: =(a b) | + ?: ?=([%i *] a) !s.a ?: ?=([%i *] b) s.b + ?: |(=(a.a 0) =(a.b 0)) + ?: &(=(a.a 0) =(a.b 0)) | + ?: =(a.a 0) s.b !s.a + ?: !=(s.a s.b) s.b + ?: s.a (^lth +>.a +>.b) (^lth +>.b +>.a) + :: + ++ lte :: less-equal + |= [a=fn b=fn] ^- (unit ?) + %+ bind (lth b a) |= a=? !a + :: + ++ equ :: equal + |= [a=fn b=fn] ^- (unit ?) + ?: |(?=([%n *] a) ?=([%n *] b)) ~ :- ~ + ?: =(a b) & + ?: |(?=([%i *] a) ?=([%i *] b)) | + ?: |(=(a.a 0) =(a.b 0)) + ?: &(=(a.a 0) =(a.b 0)) & | + ?: |(=(e.a e.b) !=(s.a s.b)) | + (^equ +>.a +>.b) + :: + ++ gte :: greater-equal + |= [a=fn b=fn] ^- (unit ?) (lte b a) + :: + ++ gth :: greater-than + |= [a=fn b=fn] ^- (unit ?) (lth b a) + :: + ++ drg :: float to decimal + |= [a=fn] ^- dn + ?: ?=([%n *] a) [%n ~] + ?: ?=([%i *] a) [%i s.a] + ?~ a.a [%d s.a --0 0] + [%d s.a (^drg +>.a)] + :: + ++ grd :: decimal to float + |= [a=dn] ^- fn + ?: ?=([%n *] a) [%n ~] + ?: ?=([%i *] a) [%i s.a] + => .(r %n) + =+ q=(abs:si e.a) + ?: (syn:si e.a) + (mul [%f s.a --0 a.a] [%f & e.a (pow 5 q)]) + (div [%f s.a --0 a.a] [%f & (sun:si q) (pow 5 q)]) + :: + ++ toi :: round to integer @s + |= [a=fn] ^- (unit @s) + =+ b=(toj a) + ?. ?=([%f *] b) ~ :- ~ + =+ c=(^^mul (bex (abs:si e.b)) a.b) + (new:si s.b c) + :: + ++ toj :: round to integer fn + |= [a=fn] ^- fn + ?. ?=([%f *] a) a + ?~ a.a [%f s.a zer] + ?: s.a (^toj +>.a) + =.(r swr (fli (^toj +>.a))) + -- +:: +ff +:: +:: this core has no use outside of the functionality +:: provided to ++rd, ++rs, ++rq, and ++rh +:: +:: w=width: bits in exponent field +:: p=precision: bits in fraction field +:: b=bias: added to exponent when storing +:: r=rounding mode: same as in ++fl +++ ff :: ieee 754 format fp + |_ [[w=@u p=@u b=@s] r=$?(%n %u %d %z %a)] + :: + ++ sb (bex (^add w p)) :: sign bit + ++ me (dif:si (dif:si --1 b) (sun:si p)) :: minimum exponent + :: + ++ pa + %*(. fl p +(p), v me, w (^sub (bex w) 3), d %d, r r) + :: + ++ sea :: @r to fn + |= [a=@r] ^- fn + =+ [f=(cut 0 [0 p] a) e=(cut 0 [p w] a)] + =+ s=(sig a) + ?: =(e 0) + ?: =(f 0) [%f s --0 0] [%f s me f] + ?: =(e (fil 0 w 1)) + ?: =(f 0) [%i s] [%n ~] + =+ q=:(sum:si (sun:si e) me -1) + =+ r=(^add f (bex p)) + [%f s q r] + :: + ++ bit |= [a=fn] (bif (rou:pa a)) :: fn to @r w+ rounding + :: + ++ bif :: fn to @r no rounding + |= [a=fn] ^- @r + ?: ?=([%i *] a) + =+ q=(lsh [0 p] (fil 0 w 1)) + ?: s.a q (^add q sb) + ?: ?=([%n *] a) (lsh [0 (dec p)] (fil 0 +(w) 1)) + ?~ a.a ?: s.a `@r`0 sb + =+ ma=(met 0 a.a) + ?. =(ma +(p)) + ?> =(e.a me) + ?> (^lth ma +(p)) + ?: s.a `@r`a.a (^add a.a sb) + =+ q=(sum:si (dif:si e.a me) --1) + =+ r=(^add (lsh [0 p] (abs:si q)) (end [0 p] a.a)) + ?: s.a r (^add r sb) + :: + ++ sig :: get sign + |= [a=@r] ^- ? + =(0 (cut 0 [(^add p w) 1] a)) + :: + ++ exp :: get exponent + |= [a=@r] ^- @s + (dif:si (sun:si (cut 0 [p w] a)) b) + :: + ++ add :: add + |= [a=@r b=@r] + (bif (add:pa (sea a) (sea b))) + :: + ++ sub :: subtract + |= [a=@r b=@r] + (bif (sub:pa (sea a) (sea b))) + :: + ++ mul :: multiply + |= [a=@r b=@r] + (bif (mul:pa (sea a) (sea b))) + :: + ++ div :: divide + |= [a=@r b=@r] + (bif (div:pa (sea a) (sea b))) + :: + ++ fma :: fused multiply-add + |= [a=@r b=@r c=@r] + (bif (fma:pa (sea a) (sea b) (sea c))) + :: + ++ sqt :: square root + |= [a=@r] + (bif (sqt:pa (sea a))) + :: + ++ lth :: less-than + |= [a=@r b=@r] (fall (lth:pa (sea a) (sea b)) |) + ++ lte :: less-equals + |= [a=@r b=@r] (fall (lte:pa (sea a) (sea b)) |) + ++ equ :: equals + |= [a=@r b=@r] (fall (equ:pa (sea a) (sea b)) |) + ++ gte :: greater-equals + |= [a=@r b=@r] (fall (gte:pa (sea a) (sea b)) |) + ++ gth :: greater-than + |= [a=@r b=@r] (fall (gth:pa (sea a) (sea b)) |) + ++ sun :: uns integer to @r + |= [a=@u] (bit [%f & --0 a]) + ++ san :: signed integer to @r + |= [a=@s] (bit [%f (syn:si a) --0 (abs:si a)]) + ++ toi :: round to integer + |= [a=@r] (toi:pa (sea a)) + ++ drg :: @r to decimal float + |= [a=@r] (drg:pa (sea a)) + ++ grd :: decimal float to @r + |= [a=dn] (bif (grd:pa a)) + -- +:: +++ rlyd |= a=@rd ^- dn (drg:rd a) :: prep @rd for print +++ rlys |= a=@rs ^- dn (drg:rs a) :: prep @rs for print +++ rlyh |= a=@rh ^- dn (drg:rh a) :: prep @rh for print +++ rlyq |= a=@rq ^- dn (drg:rq a) :: prep @rq for print +++ ryld |= a=dn ^- @rd (grd:rd a) :: finish parsing @rd +++ ryls |= a=dn ^- @rs (grd:rs a) :: finish parsing @rs +++ rylh |= a=dn ^- @rh (grd:rh a) :: finish parsing @rh +++ rylq |= a=dn ^- @rq (grd:rq a) :: finish parsing @rq +:: +++ rd :: double precision fp + ^| + ~% %rd +> ~ + |_ r=$?(%n %u %d %z) + :: round to nearest, round up, round down, round to zero + :: + ++ ma + %*(. ff w 11, p 52, b --1.023, r r) + :: + ++ sea :: @rd to fn + |= [a=@rd] (sea:ma a) + :: + ++ bit :: fn to @rd + |= [a=fn] ^- @rd (bit:ma a) + :: + ++ add ~/ %add :: add + |= [a=@rd b=@rd] ^- @rd + ~_ leaf+"rd-fail" + (add:ma a b) + :: + ++ sub ~/ %sub :: subtract + |= [a=@rd b=@rd] ^- @rd + ~_ leaf+"rd-fail" + (sub:ma a b) + :: + ++ mul ~/ %mul :: multiply + |= [a=@rd b=@rd] ^- @rd + ~_ leaf+"rd-fail" + (mul:ma a b) + :: + ++ div ~/ %div :: divide + |= [a=@rd b=@rd] ^- @rd + ~_ leaf+"rd-fail" + (div:ma a b) + :: + ++ fma ~/ %fma :: fused multiply-add + |= [a=@rd b=@rd c=@rd] ^- @rd + ~_ leaf+"rd-fail" + (fma:ma a b c) + :: + ++ sqt ~/ %sqt :: square root + |= [a=@rd] ^- @rd ~_ leaf+"rd-fail" + (sqt:ma a) + :: + ++ lth ~/ %lth :: less-than + |= [a=@rd b=@rd] + ~_ leaf+"rd-fail" + (lth:ma a b) + :: + ++ lte ~/ %lte :: less-equals + |= [a=@rd b=@rd] + ~_ leaf+"rd-fail" + (lte:ma a b) + :: + ++ equ ~/ %equ :: equals + |= [a=@rd b=@rd] + ~_ leaf+"rd-fail" + (equ:ma a b) + :: + ++ gte ~/ %gte :: greater-equals + |= [a=@rd b=@rd] + ~_ leaf+"rd-fail" + (gte:ma a b) + :: + ++ gth ~/ %gth :: greater-than + |= [a=@rd b=@rd] + ~_ leaf+"rd-fail" + (gth:ma a b) + :: + ++ sun |= [a=@u] ^- @rd (sun:ma a) :: uns integer to @rd + ++ san |= [a=@s] ^- @rd (san:ma a) :: sgn integer to @rd + ++ sig |= [a=@rd] ^- ? (sig:ma a) :: get sign + ++ exp |= [a=@rd] ^- @s (exp:ma a) :: get exponent + ++ toi |= [a=@rd] ^- (unit @s) (toi:ma a) :: round to integer + ++ drg |= [a=@rd] ^- dn (drg:ma a) :: @rd to decimal float + ++ grd |= [a=dn] ^- @rd (grd:ma a) :: decimal float to @rd + -- +:: +++ rs :: single precision fp + ~% %rs +> ~ + ^| + :: round to nearest, round up, round down, round to zero + |_ r=$?(%n %u %d %z) + :: + ++ ma + %*(. ff w 8, p 23, b --127, r r) + :: + ++ sea :: @rs to fn + |= [a=@rs] (sea:ma a) + :: + ++ bit :: fn to @rs + |= [a=fn] ^- @rs (bit:ma a) + :: + ++ add ~/ %add :: add + |= [a=@rs b=@rs] ^- @rs + ~_ leaf+"rs-fail" + (add:ma a b) + :: + ++ sub ~/ %sub :: subtract + |= [a=@rs b=@rs] ^- @rs + ~_ leaf+"rs-fail" + (sub:ma a b) + :: + ++ mul ~/ %mul :: multiply + |= [a=@rs b=@rs] ^- @rs + ~_ leaf+"rs-fail" + (mul:ma a b) + :: + ++ div ~/ %div :: divide + |= [a=@rs b=@rs] ^- @rs + ~_ leaf+"rs-fail" + (div:ma a b) + :: + ++ fma ~/ %fma :: fused multiply-add + |= [a=@rs b=@rs c=@rs] ^- @rs + ~_ leaf+"rs-fail" + (fma:ma a b c) + :: + ++ sqt ~/ %sqt :: square root + |= [a=@rs] ^- @rs + ~_ leaf+"rs-fail" + (sqt:ma a) + :: + ++ lth ~/ %lth :: less-than + |= [a=@rs b=@rs] + ~_ leaf+"rs-fail" + (lth:ma a b) + :: + ++ lte ~/ %lte :: less-equals + |= [a=@rs b=@rs] + ~_ leaf+"rs-fail" + (lte:ma a b) + :: + ++ equ ~/ %equ :: equals + |= [a=@rs b=@rs] + ~_ leaf+"rs-fail" + (equ:ma a b) + :: + ++ gte ~/ %gte :: greater-equals + |= [a=@rs b=@rs] + ~_ leaf+"rs-fail" + (gte:ma a b) + :: + ++ gth ~/ %gth :: greater-than + |= [a=@rs b=@rs] + ~_ leaf+"rs-fail" + (gth:ma a b) + :: + ++ sun |= [a=@u] ^- @rs (sun:ma a) :: uns integer to @rs + ++ san |= [a=@s] ^- @rs (san:ma a) :: sgn integer to @rs + ++ sig |= [a=@rs] ^- ? (sig:ma a) :: get sign + ++ exp |= [a=@rs] ^- @s (exp:ma a) :: get exponent + ++ toi |= [a=@rs] ^- (unit @s) (toi:ma a) :: round to integer + ++ drg |= [a=@rs] ^- dn (drg:ma a) :: @rs to decimal float + ++ grd |= [a=dn] ^- @rs (grd:ma a) :: decimal float to @rs + -- +:: +++ rq :: quad precision fp + ~% %rq +> ~ + ^| + :: round to nearest, round up, round down, round to zero + |_ r=$?(%n %u %d %z) + :: + ++ ma + %*(. ff w 15, p 112, b --16.383, r r) + :: + ++ sea :: @rq to fn + |= [a=@rq] (sea:ma a) + :: + ++ bit :: fn to @rq + |= [a=fn] ^- @rq (bit:ma a) + :: + ++ add ~/ %add :: add + |= [a=@rq b=@rq] ^- @rq + ~_ leaf+"rq-fail" + (add:ma a b) + :: + ++ sub ~/ %sub :: subtract + |= [a=@rq b=@rq] ^- @rq + ~_ leaf+"rq-fail" + (sub:ma a b) + :: + ++ mul ~/ %mul :: multiply + |= [a=@rq b=@rq] ^- @rq + ~_ leaf+"rq-fail" + (mul:ma a b) + :: + ++ div ~/ %div :: divide + |= [a=@rq b=@rq] ^- @rq + ~_ leaf+"rq-fail" + (div:ma a b) + :: + ++ fma ~/ %fma :: fused multiply-add + |= [a=@rq b=@rq c=@rq] ^- @rq + ~_ leaf+"rq-fail" + (fma:ma a b c) + :: + ++ sqt ~/ %sqt :: square root + |= [a=@rq] ^- @rq + ~_ leaf+"rq-fail" + (sqt:ma a) + :: + ++ lth ~/ %lth :: less-than + |= [a=@rq b=@rq] + ~_ leaf+"rq-fail" + (lth:ma a b) + :: + ++ lte ~/ %lte :: less-equals + |= [a=@rq b=@rq] + ~_ leaf+"rq-fail" + (lte:ma a b) + :: + ++ equ ~/ %equ :: equals + |= [a=@rq b=@rq] + ~_ leaf+"rq-fail" + (equ:ma a b) + :: + ++ gte ~/ %gte :: greater-equals + |= [a=@rq b=@rq] + ~_ leaf+"rq-fail" + (gte:ma a b) + :: + ++ gth ~/ %gth :: greater-than + |= [a=@rq b=@rq] + ~_ leaf+"rq-fail" + (gth:ma a b) + :: + ++ sun |= [a=@u] ^- @rq (sun:ma a) :: uns integer to @rq + ++ san |= [a=@s] ^- @rq (san:ma a) :: sgn integer to @rq + ++ sig |= [a=@rq] ^- ? (sig:ma a) :: get sign + ++ exp |= [a=@rq] ^- @s (exp:ma a) :: get exponent + ++ toi |= [a=@rq] ^- (unit @s) (toi:ma a) :: round to integer + ++ drg |= [a=@rq] ^- dn (drg:ma a) :: @rq to decimal float + ++ grd |= [a=dn] ^- @rq (grd:ma a) :: decimal float to @rq + -- +:: +++ rh :: half precision fp + ~% %rh +> ~ + ^| + :: round to nearest, round up, round down, round to zero + |_ r=$?(%n %u %d %z) + :: + ++ ma + %*(. ff w 5, p 10, b --15, r r) + :: + ++ sea :: @rh to fn + |= [a=@rh] (sea:ma a) + :: + ++ bit :: fn to @rh + |= [a=fn] ^- @rh (bit:ma a) + :: + ++ add ~/ %add :: add + |= [a=@rh b=@rh] ^- @rh + ~_ leaf+"rh-fail" + (add:ma a b) + :: + ++ sub ~/ %sub :: subtract + |= [a=@rh b=@rh] ^- @rh + ~_ leaf+"rh-fail" + (sub:ma a b) + :: + ++ mul ~/ %mul :: multiply + |= [a=@rh b=@rh] ^- @rh + ~_ leaf+"rh-fail" + (mul:ma a b) + :: + ++ div ~/ %div :: divide + |= [a=@rh b=@rh] ^- @rh + ~_ leaf+"rh-fail" + (div:ma a b) + :: + ++ fma ~/ %fma :: fused multiply-add + |= [a=@rh b=@rh c=@rh] ^- @rh + ~_ leaf+"rh-fail" + (fma:ma a b c) + :: + ++ sqt ~/ %sqt :: square root + |= [a=@rh] ^- @rh + ~_ leaf+"rh-fail" + (sqt:ma a) + :: + ++ lth ~/ %lth :: less-than + |= [a=@rh b=@rh] + ~_ leaf+"rh-fail" + (lth:ma a b) + :: + ++ lte ~/ %lte :: less-equals + |= [a=@rh b=@rh] + ~_ leaf+"rh-fail" + (lte:ma a b) + :: + ++ equ ~/ %equ :: equals + |= [a=@rh b=@rh] + ~_ leaf+"rh-fail" + (equ:ma a b) + :: + ++ gte ~/ %gte :: greater-equals + |= [a=@rh b=@rh] + ~_ leaf+"rh-fail" + (gte:ma a b) + :: + ++ gth ~/ %gth :: greater-than + |= [a=@rh b=@rh] + ~_ leaf+"rh-fail" + (gth:ma a b) + :: + ++ tos :: @rh to @rs + |= [a=@rh] (bit:rs (sea a)) + :: + ++ fos :: @rs to @rh + |= [a=@rs] (bit (sea:rs a)) + :: + ++ sun |= [a=@u] ^- @rh (sun:ma a) :: uns integer to @rh + ++ san |= [a=@s] ^- @rh (san:ma a) :: sgn integer to @rh + ++ sig |= [a=@rh] ^- ? (sig:ma a) :: get sign + ++ exp |= [a=@rh] ^- @s (exp:ma a) :: get exponent + ++ toi |= [a=@rh] ^- (unit @s) (toi:ma a) :: round to integer + ++ drg |= [a=@rh] ^- dn (drg:ma a) :: @rh to decimal float + ++ grd |= [a=dn] ^- @rh (grd:ma a) :: decimal float to @rh + -- +:: +:: 3c: urbit time ++| %urbit-time +:: +++ year :: date to @d + |= det=date + ^- @da + =+ ^= yer + ?: a.det + (add 292.277.024.400 y.det) + (sub 292.277.024.400 (dec y.det)) + =+ day=(yawn yer m.det d.t.det) + (yule day h.t.det m.t.det s.t.det f.t.det) +:: +++ yore :: @d to date + |= now=@da + ^- date + =+ rip=(yell now) + =+ ger=(yall d.rip) + :- ?: (gth y.ger 292.277.024.400) + [a=& y=(sub y.ger 292.277.024.400)] + [a=| y=+((sub 292.277.024.400 y.ger))] + [m.ger d.ger h.rip m.rip s.rip f.rip] +:: +++ yell :: tarp from @d + |= now=@d + ^- tarp + =+ sec=(rsh 6 now) + =+ ^= fan + =+ [muc=4 raw=(end 6 now)] + |- ^- (list @ux) + ?: |(=(0 raw) =(0 muc)) + ~ + => .(muc (dec muc)) + [(cut 4 [muc 1] raw) $(raw (end [4 muc] raw))] + =+ day=(div sec day:yo) + => .(sec (mod sec day:yo)) + =+ hor=(div sec hor:yo) + => .(sec (mod sec hor:yo)) + =+ mit=(div sec mit:yo) + => .(sec (mod sec mit:yo)) + [day hor mit sec fan] +:: +++ yule :: time atom + |= rip=tarp + ^- @d + =+ ^= sec ;: add + (mul d.rip day:yo) + (mul h.rip hor:yo) + (mul m.rip mit:yo) + s.rip + == + =+ ^= fac =+ muc=4 + |- ^- @ + ?~ f.rip + 0 + => .(muc (dec muc)) + (add (lsh [4 muc] i.f.rip) $(f.rip t.f.rip)) + (con (lsh 6 sec) fac) +:: +++ yall :: day / to day of year + |= day=@ud + ^- [y=@ud m=@ud d=@ud] + =+ [era=0 cet=0 lep=*?] + => .(era (div day era:yo), day (mod day era:yo)) + => ^+ . + ?: (lth day +(cet:yo)) + .(lep &, cet 0) + => .(lep |, cet 1, day (sub day +(cet:yo))) + .(cet (add cet (div day cet:yo)), day (mod day cet:yo)) + =+ yer=(add (mul 400 era) (mul 100 cet)) + |- ^- [y=@ud m=@ud d=@ud] + =+ dis=?:(lep 366 365) + ?. (lth day dis) + =+ ner=+(yer) + $(yer ner, day (sub day dis), lep =(0 (end [0 2] ner))) + |- ^- [y=@ud m=@ud d=@ud] + =+ [mot=0 cah=?:(lep moy:yo moh:yo)] + |- ^- [y=@ud m=@ud d=@ud] + =+ zis=(snag mot cah) + ?: (lth day zis) + [yer +(mot) +(day)] + $(mot +(mot), day (sub day zis)) +:: +++ yawn :: days since Jesus + |= [yer=@ud mot=@ud day=@ud] + ^- @ud + => .(mot (dec mot), day (dec day)) + => ^+ . + %= . + day + =+ cah=?:((yelp yer) moy:yo moh:yo) + |- ^- @ud + ?: =(0 mot) + day + $(mot (dec mot), cah (slag 1 cah), day (add day (snag 0 cah))) + == + |- ^- @ud + ?. =(0 (mod yer 4)) + =+ ney=(dec yer) + $(yer ney, day (add day ?:((yelp ney) 366 365))) + ?. =(0 (mod yer 100)) + =+ nef=(sub yer 4) + $(yer nef, day (add day ?:((yelp nef) 1.461 1.460))) + ?. =(0 (mod yer 400)) + =+ nec=(sub yer 100) + $(yer nec, day (add day ?:((yelp nec) 36.525 36.524))) + (add day (mul (div yer 400) (add 1 (mul 4 36.524)))) +:: +++ yelp :: leap year + |= yer=@ud ^- ? + &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400)))) +:: +++ yo :: time constants + |% ++ cet 36.524 :: (add 24 (mul 100 365)) + ++ day 86.400 :: (mul 24 hor) + ++ era 146.097 :: (add 1 (mul 4 cet)) + ++ hor 3.600 :: (mul 60 mit) + ++ jes 106.751.991.084.417 :: (mul 730.692.561 era) + ++ mit 60 + ++ moh `(list @ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~] + ++ moy `(list @ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~] + ++ qad 126.144.001 :: (add 1 (mul 4 yer)) + ++ yer 31.536.000 :: (mul 365 day) + -- +:: +:: 3d: SHA hash family ++| %sha-hash-family +:: +++ shad |=(ruz=@ (shax (shax ruz))) :: double sha-256 +++ shaf :: half sha-256 + |= [sal=@ ruz=@] + =+ haz=(shas sal ruz) + (mix (end 7 haz) (rsh 7 haz)) +:: +++ sham :: 128bit noun hash + |= yux=* ^- @uvH ^- @ + ?@ yux + (shaf %mash yux) + (shaf %sham (jam yux)) +:: +++ shas :: salted hash + ~/ %shas + |= [sal=@ ruz=@] + =/ len (max 32 (met 3 sal)) + (shay len (mix sal (shax ruz))) +:: +++ shax :: sha-256 + ~/ %shax + |= ruz=@ ^- @ + (shay [(met 3 ruz) ruz]) +:: +++ shay :: sha-256 with length + ~/ %shay + |= [len=@u ruz=@] ^- @ + => .(ruz (cut 3 [0 len] ruz)) + =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))] + =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few] + =+ ral=(lsh [0 3] len) + =+ ^= ful + %+ can 0 + :~ [ral ruz] + [8 128] + [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0] + [64 (~(net fe 6) ral)] + == + =+ lex=(met 9 ful) + =+ ^= kbx 0xc671.78f2.bef9.a3f7.a450.6ceb.90be.fffa. + 8cc7.0208.84c8.7814.78a5.636f.748f.82ee. + 682e.6ff3.5b9c.ca4f.4ed8.aa4a.391c.0cb3. + 34b0.bcb5.2748.774c.1e37.6c08.19a4.c116. + 106a.a070.f40e.3585.d699.0624.d192.e819. + c76c.51a3.c24b.8b70.a81a.664b.a2bf.e8a1. + 9272.2c85.81c2.c92e.766a.0abb.650a.7354. + 5338.0d13.4d2c.6dfc.2e1b.2138.27b7.0a85. + 1429.2967.06ca.6351.d5a7.9147.c6e0.0bf3. + bf59.7fc7.b003.27c8.a831.c66d.983e.5152. + 76f9.88da.5cb0.a9dc.4a74.84aa.2de9.2c6f. + 240c.a1cc.0fc1.9dc6.efbe.4786.e49b.69c1. + c19b.f174.9bdc.06a7.80de.b1fe.72be.5d74. + 550c.7dc3.2431.85be.1283.5b01.d807.aa98. + ab1c.5ed5.923f.82a4.59f1.11f1.3956.c25b. + e9b5.dba5.b5c0.fbcf.7137.4491.428a.2f98 + =+ ^= hax 0x5be0.cd19.1f83.d9ab.9b05.688c.510e.527f. + a54f.f53a.3c6e.f372.bb67.ae85.6a09.e667 + =+ i=0 + |- ^- @ + ?: =(i lex) + (run 5 hax net) + =+ ^= wox + =+ dux=(cut 9 [i 1] ful) + =+ wox=(run 5 dux net) + =+ j=16 + |- ^- @ + ?: =(64 j) + wox + =+ :* l=(wac (sub j 15) wox) + m=(wac (sub j 2) wox) + n=(wac (sub j 16) wox) + o=(wac (sub j 7) wox) + == + =+ x=:(mix (ror 0 7 l) (ror 0 18 l) (rsh [0 3] l)) + =+ y=:(mix (ror 0 17 m) (ror 0 19 m) (rsh [0 10] m)) + =+ z=:(sum n x o y) + $(wox (con (lsh [5 j] z) wox), j +(j)) + =+ j=0 + =+ :* a=(wac 0 hax) + b=(wac 1 hax) + c=(wac 2 hax) + d=(wac 3 hax) + e=(wac 4 hax) + f=(wac 5 hax) + g=(wac 6 hax) + h=(wac 7 hax) + == + |- ^- @ + ?: =(64 j) + %= ^$ + i +(i) + hax %+ rep 5 + :~ (sum a (wac 0 hax)) + (sum b (wac 1 hax)) + (sum c (wac 2 hax)) + (sum d (wac 3 hax)) + (sum e (wac 4 hax)) + (sum f (wac 5 hax)) + (sum g (wac 6 hax)) + (sum h (wac 7 hax)) + == + == + =+ l=:(mix (ror 0 2 a) (ror 0 13 a) (ror 0 22 a)) :: s0 + =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj + =+ n=(sum l m) :: t2 + =+ o=:(mix (ror 0 6 e) (ror 0 11 e) (ror 0 25 e)) :: s1 + =+ p=(mix (dis e f) (dis (inv e) g)) :: ch + =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1 + $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g) +:: +++ shaw :: hash to nbits + |= [sal=@ len=@ ruz=@] + (~(raw og (shas sal (mix len ruz))) len) +:: +++ shaz :: sha-512 + |= ruz=@ ^- @ + (shal [(met 3 ruz) ruz]) +:: +++ shal :: sha-512 with length + ~/ %shal + |= [len=@ ruz=@] ^- @ + => .(ruz (cut 3 [0 len] ruz)) + =+ [few==>(fe .(a 6)) wac=|=([a=@ b=@] (cut 6 [a 1] b))] + =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few] + =+ ral=(lsh [0 3] len) + =+ ^= ful + %+ can 0 + :~ [ral ruz] + [8 128] + [(mod (sub 1.920 (mod (add 8 ral) 1.024)) 1.024) 0] + [128 (~(net fe 7) ral)] + == + =+ lex=(met 10 ful) + =+ ^= kbx 0x6c44.198c.4a47.5817.5fcb.6fab.3ad6.faec. + 597f.299c.fc65.7e2a.4cc5.d4be.cb3e.42b6. + 431d.67c4.9c10.0d4c.3c9e.be0a.15c9.bebc. + 32ca.ab7b.40c7.2493.28db.77f5.2304.7d84. + 1b71.0b35.131c.471b.113f.9804.bef9.0dae. + 0a63.7dc5.a2c8.98a6.06f0.67aa.7217.6fba. + f57d.4f7f.ee6e.d178.eada.7dd6.cde0.eb1e. + d186.b8c7.21c0.c207.ca27.3ece.ea26.619c. + c671.78f2.e372.532b.bef9.a3f7.b2c6.7915. + a450.6ceb.de82.bde9.90be.fffa.2363.1e28. + 8cc7.0208.1a64.39ec.84c8.7814.a1f0.ab72. + 78a5.636f.4317.2f60.748f.82ee.5def.b2fc. + 682e.6ff3.d6b2.b8a3.5b9c.ca4f.7763.e373. + 4ed8.aa4a.e341.8acb.391c.0cb3.c5c9.5a63. + 34b0.bcb5.e19b.48a8.2748.774c.df8e.eb99. + 1e37.6c08.5141.ab53.19a4.c116.b8d2.d0c8. + 106a.a070.32bb.d1b8.f40e.3585.5771.202a. + d699.0624.5565.a910.d192.e819.d6ef.5218. + c76c.51a3.0654.be30.c24b.8b70.d0f8.9791. + a81a.664b.bc42.3001.a2bf.e8a1.4cf1.0364. + 9272.2c85.1482.353b.81c2.c92e.47ed.aee6. + 766a.0abb.3c77.b2a8.650a.7354.8baf.63de. + 5338.0d13.9d95.b3df.4d2c.6dfc.5ac4.2aed. + 2e1b.2138.5c26.c926.27b7.0a85.46d2.2ffc. + 1429.2967.0a0e.6e70.06ca.6351.e003.826f. + d5a7.9147.930a.a725.c6e0.0bf3.3da8.8fc2. + bf59.7fc7.beef.0ee4.b003.27c8.98fb.213f. + a831.c66d.2db4.3210.983e.5152.ee66.dfab. + 76f9.88da.8311.53b5.5cb0.a9dc.bd41.fbd4. + 4a74.84aa.6ea6.e483.2de9.2c6f.592b.0275. + 240c.a1cc.77ac.9c65.0fc1.9dc6.8b8c.d5b5. + efbe.4786.384f.25e3.e49b.69c1.9ef1.4ad2. + c19b.f174.cf69.2694.9bdc.06a7.25c7.1235. + 80de.b1fe.3b16.96b1.72be.5d74.f27b.896f. + 550c.7dc3.d5ff.b4e2.2431.85be.4ee4.b28c. + 1283.5b01.4570.6fbe.d807.aa98.a303.0242. + ab1c.5ed5.da6d.8118.923f.82a4.af19.4f9b. + 59f1.11f1.b605.d019.3956.c25b.f348.b538. + e9b5.dba5.8189.dbbc.b5c0.fbcf.ec4d.3b2f. + 7137.4491.23ef.65cd.428a.2f98.d728.ae22 + =+ ^= hax 0x5be0.cd19.137e.2179.1f83.d9ab.fb41.bd6b. + 9b05.688c.2b3e.6c1f.510e.527f.ade6.82d1. + a54f.f53a.5f1d.36f1.3c6e.f372.fe94.f82b. + bb67.ae85.84ca.a73b.6a09.e667.f3bc.c908 + =+ i=0 + |- ^- @ + ?: =(i lex) + (run 6 hax net) + =+ ^= wox + =+ dux=(cut 10 [i 1] ful) + =+ wox=(run 6 dux net) + =+ j=16 + |- ^- @ + ?: =(80 j) + wox + =+ :* l=(wac (sub j 15) wox) + m=(wac (sub j 2) wox) + n=(wac (sub j 16) wox) + o=(wac (sub j 7) wox) + == + =+ x=:(mix (ror 0 1 l) (ror 0 8 l) (rsh [0 7] l)) + =+ y=:(mix (ror 0 19 m) (ror 0 61 m) (rsh [0 6] m)) + =+ z=:(sum n x o y) + $(wox (con (lsh [6 j] z) wox), j +(j)) + =+ j=0 + =+ :* a=(wac 0 hax) + b=(wac 1 hax) + c=(wac 2 hax) + d=(wac 3 hax) + e=(wac 4 hax) + f=(wac 5 hax) + g=(wac 6 hax) + h=(wac 7 hax) + == + |- ^- @ + ?: =(80 j) + %= ^$ + i +(i) + hax %+ rep 6 + :~ (sum a (wac 0 hax)) + (sum b (wac 1 hax)) + (sum c (wac 2 hax)) + (sum d (wac 3 hax)) + (sum e (wac 4 hax)) + (sum f (wac 5 hax)) + (sum g (wac 6 hax)) + (sum h (wac 7 hax)) + == + == + =+ l=:(mix (ror 0 28 a) (ror 0 34 a) (ror 0 39 a)) :: S0 + =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj + =+ n=(sum l m) :: t2 + =+ o=:(mix (ror 0 14 e) (ror 0 18 e) (ror 0 41 e)) :: S1 + =+ p=(mix (dis e f) (dis (inv e) g)) :: ch + =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1 + $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g) +:: +++ shan :: sha-1 (deprecated) + |= ruz=@ + =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))] + =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few] + =+ ral=(lsh [0 3] (met 3 ruz)) + =+ ^= ful + %+ can 0 + :~ [ral ruz] + [8 128] + [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0] + [64 (~(net fe 6) ral)] + == + =+ lex=(met 9 ful) + =+ kbx=0xca62.c1d6.8f1b.bcdc.6ed9.eba1.5a82.7999 + =+ hax=0xc3d2.e1f0.1032.5476.98ba.dcfe.efcd.ab89.6745.2301 + =+ i=0 + |- + ?: =(i lex) + (rep 5 (flop (rip 5 hax))) + =+ ^= wox + =+ dux=(cut 9 [i 1] ful) + =+ wox=(rep 5 (turn (rip 5 dux) net)) + =+ j=16 + |- ^- @ + ?: =(80 j) + wox + =+ :* l=(wac (sub j 3) wox) + m=(wac (sub j 8) wox) + n=(wac (sub j 14) wox) + o=(wac (sub j 16) wox) + == + =+ z=(rol 0 1 :(mix l m n o)) + $(wox (con (lsh [5 j] z) wox), j +(j)) + =+ j=0 + =+ :* a=(wac 0 hax) + b=(wac 1 hax) + c=(wac 2 hax) + d=(wac 3 hax) + e=(wac 4 hax) + == + |- ^- @ + ?: =(80 j) + %= ^$ + i +(i) + hax %+ rep 5 + :~ + (sum a (wac 0 hax)) + (sum b (wac 1 hax)) + (sum c (wac 2 hax)) + (sum d (wac 3 hax)) + (sum e (wac 4 hax)) + == + == + =+ fx=(con (dis b c) (dis (not 5 1 b) d)) + =+ fy=:(mix b c d) + =+ fz=:(con (dis b c) (dis b d) (dis c d)) + =+ ^= tem + ?: &((gte j 0) (lte j 19)) + :(sum (rol 0 5 a) fx e (wac 0 kbx) (wac j wox)) + ?: &((gte j 20) (lte j 39)) + :(sum (rol 0 5 a) fy e (wac 1 kbx) (wac j wox)) + ?: &((gte j 40) (lte j 59)) + :(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox)) + :(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox)) + $(j +(j), a tem, b a, c (rol 0 30 b), d c, e d) +:: +++ og :: shax-powered rng + ~/ %og + |_ a=@ + ++ rad :: random in range + |= b=@ ^- @ + ~_ leaf+"rad-zero" + ?< =(0 b) + =+ c=(raw (met 0 b)) + ?:((lth c b) c $(a +(a))) + :: + ++ rads :: random continuation + |= b=@ + =+ r=(rad b) + [r +>.$(a (shas %og-s (mix a r)))] + :: + ++ raw :: random bits + ~/ %raw + |= b=@ ^- @ + %+ can + 0 + =+ c=(shas %og-a (mix b a)) + |- ^- (list [@ @]) + ?: =(0 b) + ~ + =+ d=(shas %og-b (mix b (mix a c))) + ?: (lth b 256) + [[b (end [0 b] d)] ~] + [[256 d] $(c d, b (sub b 256))] + :: + ++ raws :: random bits + |= b=@ :: continuation + =+ r=(raw b) + [r +>.$(a (shas %og-s (mix a r)))] + -- +:: +++ sha :: correct byte-order + ~% %sha ..sha ~ + => |% + ++ flin |=(a=@ (swp 3 a)) :: flip input + ++ flim |=(byts [wid (rev 3 wid dat)]) :: flip input w= length + ++ flip |=(w=@u (cury (cury rev 3) w)) :: flip output of size + ++ meet |=(a=@ [(met 3 a) a]) :: measure input size + -- + |% + :: + :: use with @ + :: + ++ sha-1 (cork meet sha-1l) + ++ sha-256 :(cork flin shax (flip 32)) + ++ sha-512 :(cork flin shaz (flip 64)) + :: + :: use with byts + :: + ++ sha-256l :(cork flim shay (flip 32)) + ++ sha-512l :(cork flim shal (flip 64)) + :: + ++ sha-1l + ~/ %sha1 + |= byts + ^- @ + =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))] + =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few] + =+ ral=(lsh [0 3] wid) + =+ ^= ful + %+ can 0 + :~ [ral (rev 3 wid dat)] + [8 128] + [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0] + [64 (~(net fe 6) ral)] + == + =+ lex=(met 9 ful) + =+ kbx=0xca62.c1d6.8f1b.bcdc.6ed9.eba1.5a82.7999 + =+ hax=0xc3d2.e1f0.1032.5476.98ba.dcfe.efcd.ab89.6745.2301 + =+ i=0 + |- + ?: =(i lex) + (rep 5 (flop (rip 5 hax))) + =+ ^= wox + =+ dux=(cut 9 [i 1] ful) + =+ wox=(rep 5 (turn (rip 5 dux) net)) + =+ j=16 + |- ^- @ + ?: =(80 j) + wox + =+ :* l=(wac (sub j 3) wox) + m=(wac (sub j 8) wox) + n=(wac (sub j 14) wox) + o=(wac (sub j 16) wox) + == + =+ z=(rol 0 1 :(mix l m n o)) + $(wox (con (lsh [5 j] z) wox), j +(j)) + =+ j=0 + =+ :* a=(wac 0 hax) + b=(wac 1 hax) + c=(wac 2 hax) + d=(wac 3 hax) + e=(wac 4 hax) + == + |- ^- @ + ?: =(80 j) + %= ^$ + i +(i) + hax %+ rep 5 + :~ + (sum a (wac 0 hax)) + (sum b (wac 1 hax)) + (sum c (wac 2 hax)) + (sum d (wac 3 hax)) + (sum e (wac 4 hax)) + == + == + =+ fx=(con (dis b c) (dis (not 5 1 b) d)) + =+ fy=:(mix b c d) + =+ fz=:(con (dis b c) (dis b d) (dis c d)) + =+ ^= tem + ?: &((gte j 0) (lte j 19)) + :(sum (rol 0 5 a) fx e (wac 0 kbx) (wac j wox)) + ?: &((gte j 20) (lte j 39)) + :(sum (rol 0 5 a) fy e (wac 1 kbx) (wac j wox)) + ?: &((gte j 40) (lte j 59)) + :(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox)) + :(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox)) + $(j +(j), a tem, b a, c (rol 0 30 b), d c, e d) + -- +:: 3f: scrambling ++| %scrambling +:: +++ un :: =(x (wred (wren x))) + |% + ++ wren :: conceal structure + |= pyn=@ ^- @ + =+ len=(met 3 pyn) + ?: =(0 len) + 0 + => .(len (dec len)) + =+ mig=(zaft (xafo len (cut 3 [len 1] pyn))) + %+ can 3 + %- flop ^- (list [@ @]) + :- [1 mig] + |- ^- (list [@ @]) + ?: =(0 len) + ~ + => .(len (dec len)) + =+ mog=(zyft :(mix mig (end 3 len) (cut 3 [len 1] pyn))) + [[1 mog] $(mig mog)] + :: + ++ wred :: restore structure + |= cry=@ ^- @ + =+ len=(met 3 cry) + ?: =(0 len) + 0 + => .(len (dec len)) + =+ mig=(cut 3 [len 1] cry) + %+ can 3 + %- flop ^- (list [@ @]) + :- [1 (xaro len (zart mig))] + |- ^- (list [@ @]) + ?: =(0 len) + ~ + => .(len (dec len)) + =+ mog=(cut 3 [len 1] cry) + [[1 :(mix mig (end 3 len) (zyrt mog))] $(mig mog)] + :: + ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255))) + ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255))) + :: + ++ zaft :: forward 255-sbox + |= a=@D + =+ ^= b + 0xcc.75bc.86c8.2fb1.9a42.f0b3.79a0.92ca.21f6.1e41.cde5.fcc0. + 7e85.51ae.1005.c72d.1246.07e8.7c64.a914.8d69.d9f4.59c2.8038. + 1f4a.dca2.6fdf.66f9.f561.a12e.5a16.f7b0.a39f.364e.cb70.7318. + 1de1.ad31.63d1.abd4.db68.6a33.134d.a760.edee.5434.493a.e323. + 930d.8f3d.3562.bb81.0b24.43cf.bea5.a6eb.52b4.0229.06b2.6704. + 78c9.45ec.d75e.58af.c577.b7b9.c40e.017d.90c3.87f8.96fa.1153. + 0372.7f30.1c32.ac83.ff17.c6e4.d36d.6b55.e2ce.8c71.8a5b.b6f3. + 9d4b.eab5.8b3c.e7f2.a8fe.9574.5de0.bf20.3f15.9784.9939.5f9c. + e609.564f.d8a4.b825.9819.94aa.2c08.8e4c.9b22.477a.2840.3ed6. + 3750.6ef1.44dd.89ef.6576.d00a.fbda.9ed2.3b6c.7b0c.bde9.2ade. + 5c88.c182.481a.1b0f.2bfd.d591.2726.57ba + (cut 3 [(dec a) 1] b) + :: + ++ zart :: reverse 255-sbox + |= a=@D + =+ ^= b + 0x68.4f07.ea1c.73c9.75c2.efc8.d559.5125.f621.a7a8.8591.5613. + dd52.40eb.65a2.60b7.4bcb.1123.ceb0.1bd6.3c84.2906.b164.19b3. + 1e95.5fec.ffbc.f187.fbe2.6680.7c77.d30e.e94a.9414.fd9a.017d. + 3a7e.5a55.8ff5.8bf9.c181.e5b6.6ab2.35da.50aa.9293.3bc0.cdc6. + f3bf.1a58.4130.f844.3846.744e.36a0.f205.789e.32d8.5e54.5c22. + 0f76.fce7.4569.0d99.d26e.e879.dc16.2df4.887f.1ffe.4dba.6f5d. + bbcc.2663.1762.aed7.af8a.ca20.dbb4.9bc7.a942.834c.105b.c4d4. + 8202.3e61.a671.90e6.273d.bdab.3157.cfa4.0c2e.df86.2496.f7ed. + 2b48.2a9d.5318.a343.d128.be9c.a5ad.6bb5.6dfa.c5e1.3408.128d. + 2c04.0339.97a1.2ff0.49d0.eeb8.6c0a.0b37.b967.c347.d9ac.e072. + e409.7b9f.1598.1d3f.33de.8ce3.8970.8e7a + (cut 3 [(dec a) 1] b) + :: + ++ zyft :: forward 256-sbox + |= a=@D + =+ ^= b + 0xbb49.b71f.b881.b402.17e4.6b86.69b5.1647.115f.dddb.7ca5. + 8371.4bd5.19a9.b092.605d.0d9b.e030.a0cc.78ba.5706.4d2d. + 986a.768c.f8e8.c4c7.2f1c.effe.3cae.01c0.253e.65d3.3872. + ce0e.7a74.8ac6.daac.7e5c.6479.44ec.4143.3d20.4af0.ee6c. + c828.deca.0377.249f.ffcd.7b4f.eb7d.66f2.8951.042e.595a. + 8e13.f9c3.a79a.f788.6199.9391.7fab.6200.4ce5.0758.e2f1. + 7594.c945.d218.4248.afa1.e61a.54fb.1482.bea4.96a2.3473. + 63c2.e7cb.155b.120a.4ed7.bfd8.b31b.4008.f329.fca3.5380. + 9556.0cb2.8722.2bea.e96e.3ac5.d1bc.10e3.2c52.a62a.b1d6. + 35aa.d05e.f6a8.0f3b.31ed.559d.09ad.f585.6d21.fd1d.8d67. + 370b.26f4.70c1.b923.4684.6fbd.cf8b.5036.0539.9cdc.d93f. + 9068.1edf.8f33.b632.d427.97fa.9ee1 + (cut 3 [a 1] b) + :: + ++ zyrt :: reverse 256-sbox + |= a=@D + =+ ^= b + 0x9fc8.2753.6e02.8fcf.8b35.2b20.5598.7caa.c9a9.30b0.9b48. + 47ce.6371.80f6.407d.00dd.0aa5.ed10.ecb7.0f5a.5c3a.e605. + c077.4337.17bd.9eda.62a4.79a7.ccb8.44cd.8e64.1ec4.5b6b. + 1842.ffd8.1dfb.fd07.f2f9.594c.3be3.73c6.2cb6.8438.e434. + 8d3d.ea6a.5268.72db.a001.2e11.de8c.88d3.0369.4f7a.87e2. + 860d.0991.25d0.16b9.978a.4bf4.2a1a.e96c.fa50.85b5.9aeb. + 9dbb.b2d9.a2d1.7bba.66be.e81f.1946.29a8.f5d2.f30c.2499. + c1b3.6583.89e1.ee36.e0b4.6092.937e.d74e.2f6f.513e.9615. + 9c5d.d581.e7ab.fe74.f01b.78b1.ae75.af57.0ec2.adc7.3245. + 12bf.2314.3967.0806.31dc.cb94.d43f.493c.54a6.0421.c3a1. + 1c4a.28ac.fc0b.26ca.5870.e576.f7f1.616d.905f.ef41.33bc. + df4d.225e.2d56.7fd6.1395.a3f8.c582 + (cut 3 [a 1] b) + -- +:: +++ ob + ~% %ob ..ob + == + %fein fein + %fynd fynd + == + |% + :: + :: +fein: conceal structure, v3. + :: + :: +fein conceals planet-sized atoms. The idea is that it should not be + :: trivial to tell which planet a star has spawned under. + :: + ++ fein + ~/ %fein + |= pyn=@ ^- @ + ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff)) + (add 0x1.0000 (feis (sub pyn 0x1.0000))) + ?: &((gte pyn 0x1.0000.0000) (lte pyn 0xffff.ffff.ffff.ffff)) + =/ lo (dis pyn 0xffff.ffff) + =/ hi (dis pyn 0xffff.ffff.0000.0000) + %+ con hi + $(pyn lo) + pyn + :: + :: +fynd: restore structure, v3. + :: + :: Restores obfuscated values that have been enciphered with +fein. + :: + ++ fynd + ~/ %fynd + |= cry=@ ^- @ + ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff)) + (add 0x1.0000 (tail (sub cry 0x1.0000))) + ?: &((gte cry 0x1.0000.0000) (lte cry 0xffff.ffff.ffff.ffff)) + =/ lo (dis cry 0xffff.ffff) + =/ hi (dis cry 0xffff.ffff.0000.0000) + %+ con hi + $(cry lo) + cry + :: +feis: a four-round generalised Feistel cipher over the domain + :: [0, 2^32 - 2^16 - 1]. + :: + :: See: Black & Rogaway (2002), Ciphers for arbitrary finite domains. + :: + ++ feis + |= m=@ + ^- @ + (fee 4 0xffff 0x1.0000 (mul 0xffff 0x1.0000) eff m) + :: + :: +tail: reverse +feis. + :: + ++ tail + |= m=@ + ^- @ + (feen 4 0xffff 0x1.0000 (mul 0xffff 0x1.0000) eff m) + :: + :: +fee: "Fe" in B&R (2002). + :: + :: A Feistel cipher given the following parameters: + :: + :: r: number of Feistel rounds + :: a, b: parameters such that ab >= k + :: k: value such that the domain of the cipher is [0, k - 1] + :: prf: a gate denoting a family of pseudorandom functions indexed by + :: its first argument and taking its second argument as input + :: m: an input value in the domain [0, k - 1] + :: + ++ fee + |= [r=@ a=@ b=@ k=@ prf=$-([j=@ r=@] @) m=@] + ^- @ + =/ c (fe r a b prf m) + ?: (lth c k) + c + (fe r a b prf c) + :: + :: +feen: "Fe^-1" in B&R (2002). + :: + :: Reverses a Feistel cipher constructed with parameters as described in + :: +fee. + :: + ++ feen + |= [r=@ a=@ b=@ k=@ prf=$-([j=@ r=@] @) m=@] + ^- @ + =/ c (fen r a b prf m) + ?: (lth c k) + c + (fen r a b prf c) + :: + :: +fe: "fe" in B&R (2002). + :: + :: An internal function to +fee. + :: + :: Note that this implementation differs slightly from the reference paper + :: to support some legacy behaviour. See urbit/arvo#1105. + :: + ++ fe + |= [r=@ a=@ b=@ prf=$-([j=@ r=@] @) m=@] + =/ j 1 + =/ ell (mod m a) + =/ arr (div m a) + |- ^- @ + :: + ?: (gth j r) + ?. =((mod r 2) 0) + (add (mul arr a) ell) + :: + :: Note that +fe differs from B&R (2002)'s "fe" below, as a previous + :: implementation of this cipher contained a bug such that certain inputs + :: could encipher to the same output. + :: + :: To correct these problem cases while also preserving the cipher's + :: legacy behaviour on most inputs, we check for a problem case (which + :: occurs when 'arr' is equal to 'a') and, if detected, use an alternate + :: permutation instead. + :: + ?: =(arr a) + (add (mul arr a) ell) + (add (mul ell a) arr) + :: + =/ f (prf (sub j 1) arr) + :: + =/ tmp + ?. =((mod j 2) 0) + (mod (add f ell) a) + (mod (add f ell) b) + :: + $(j +(j), ell arr, arr tmp) + :: + :: +fen: "fe^-1" in B&R (2002). + :: + :: Note that this implementation differs slightly from the reference paper + :: to support some legacy behaviour. See urbit/arvo#1105. + :: + ++ fen + |= [r=@ a=@ b=@ prf=$-([j=@ r=@] @) m=@] + =/ j r + :: + =/ ahh + ?. =((mod r 2) 0) + (div m a) + (mod m a) + :: + =/ ale + ?. =((mod r 2) 0) + (mod m a) + (div m a) + :: + :: Similar to the comment in +fe, +fen differs from B&R (2002)'s "fe^-1" + :: here in order to preserve the legacy cipher's behaviour on most inputs. + :: + :: Here problem cases can be identified by 'ahh' equating with 'a'; we + :: correct those cases by swapping the values of 'ahh' and 'ale'. + :: + =/ ell + ?: =(ale a) + ahh + ale + :: + =/ arr + ?: =(ale a) + ale + ahh + :: + |- ^- @ + ?: (lth j 1) + (add (mul arr a) ell) + =/ f (prf (sub j 1) ell) + :: + :: Note that there is a slight deviation here to avoid dealing with + :: negative values. We add 'a' or 'b' to arr as appropriate and reduce + :: 'f' modulo the same number before performing subtraction. + :: + =/ tmp + ?. =((mod j 2) 0) + (mod (sub (add arr a) (mod f a)) a) + (mod (sub (add arr b) (mod f b)) b) + :: + $(j (sub j 1), ell tmp, arr ell) + :: + :: +eff: a murmur3-based pseudorandom function. 'F' in B&R (2002). + :: + ++ eff + |= [j=@ r=@] + ^- @ + (muk (snag j raku) 2 r) + :: + :: +raku: seeds for eff. + :: + ++ raku + ^- (list @ux) + :~ 0xb76d.5eed + 0xee28.1300 + 0x85bc.ae01 + 0x4b38.7af7 + == + :: + -- +:: +:: 3g: molds and mold builders ++| %molds-and-mold-builders +:: ++$ coin $~ [%$ %ud 0] :: print format + $% [%$ p=dime] :: + [%blob p=*] :: + [%many p=(list coin)] :: + == :: ++$ dime [p=@ta q=@] :: ++$ edge [p=hair q=(unit [p=* q=nail])] :: parsing output ++$ hair [p=@ud q=@ud] :: parsing trace +++ like |* a=$-(* *) :: generic edge + |: b=`*`[(hair) ~] :: + :- p=(hair -.b) :: + ^= q :: + ?@ +.b ~ :: + :- ~ :: + u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] :: ++$ nail [p=hair q=tape] :: parsing input ++$ pint [p=[p=@ q=@] q=[p=@ q=@]] :: line+column range ++$ rule _|:($:nail $:edge) :: parsing rule ++$ spot [p=path q=pint] :: range in file ++$ tone $% [%0 product=*] :: success + [%1 block=*] :: single block + [%2 trace=(list [@ta *])] :: error report + == :: ++$ toon $% [%0 p=*] :: success + [%1 p=*] :: block + [%2 p=(list tank)] :: stack trace + == :: +++ wonk |* veq=_$:edge :: product from edge + ?~(q.veq !! p.u.q.veq) :: +-- => +:: +~% %qua + + + == + %show show + == +:: layer-4 +:: +|% +:: +:: 4a: exotic bases ++| %exotic-bases +:: +++ po :: phonetic base + ~/ %po + =+ :- ^= sis :: prefix syllables + 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\ + /rigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\ + /holpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\ + /losdilforpilramtirwintadbicdifrocwidbisdasmidlop\ + /rilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\ + /ritpodmottamtolsavposnapnopsomfinfonbanmorworsip\ + /ronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\ + /sivtagpadsaldivdactansidfabtarmonranniswolmispal\ + /lasdismaprabtobrollatlonnodnavfignomnibpagsopral\ + /bilhaddocridmocpacravripfaltodtiltinhapmicfanpat\ + /taclabmogsimsonpinlomrictapfirhasbosbatpochactid\ + /havsaplindibhosdabbitbarracparloddosbortochilmac\ + /tomdigfilfasmithobharmighinradmashalraglagfadtop\ + /mophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\ + /nimlarfitwalrapsarnalmoslandondanladdovrivbacpol\ + /laptalpitnambonrostonfodponsovnocsorlavmatmipfip' + ^= dex :: suffix syllables + 'zodnecbudwessevpersutletfulpensytdurwepserwylsun\ + /rypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\ + /lunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\ + /pyldulhetmevruttylwydtepbesdexsefwycburderneppur\ + /rysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\ + /secmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\ + /selrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\ + /syptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\ + /lytdusnebrumtynseglyxpunresredfunrevrefmectedrus\ + /bexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\ + /tenlusnussyltecmexpubrymtucfyllepdebbermughuttun\ + /bylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\ + /wedducfurfexnulluclennerlexrupnedlecrydlydfenwel\ + /nydhusrelrudneshesfetdesretdunlernyrsebhulryllud\ + /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\ + /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes' + |% + ++ ins ~/ %ins :: parse prefix + |= a=@tas + =+ b=0 + |- ^- (unit @) + ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b)))) + ++ ind ~/ %ind :: parse suffix + |= a=@tas + =+ b=0 + |- ^- (unit @) + ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b)))) + ++ tos ~/ %tos :: fetch prefix + |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis))) + ++ tod ~/ %tod :: fetch suffix + |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex))) + -- +:: +++ fa :: base58check + =+ key='123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' + =/ yek=@ux ~+ + =- yek:(roll (rip 3 key) -) + =+ [a=*char b=*@ yek=`@ux`(fil 3 256 0xff)] + |. + [+(b) (mix yek (lsh [3 `@u`a] (~(inv fe 3) b)))] + |% + ++ cha |=(a=char `(unit @uF)`=+(b=(cut 3 [`@`a 1] yek) ?:(=(b 0xff) ~ `b))) + ++ tok + |= a=@ux ^- @ux + =+ b=(pad a) + =- (~(net fe 5) (end [3 4] (shay 32 -))) + (shay (add b (met 3 a)) (lsh [3 b] (swp 3 a))) + :: + ++ pad |=(a=@ =+(b=(met 3 a) ?:((gte b 21) 0 (sub 21 b)))) + ++ enc |=(a=@ux `@ux`(mix (lsh [3 4] a) (tok a))) + ++ den + |= a=@ux ^- (unit @ux) + =+ b=(rsh [3 4] a) + ?. =((tok b) (end [3 4] a)) + ~ + `b + -- +:: 4b: text processing ++| %text-processing +:: +++ at :: basic printing + |_ a=@ + ++ r + ?: ?& (gte (met 3 a) 2) + |- + ?: =(0 a) + & + =+ vis=(end 3 a) + ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z'))) + $(a (rsh 3 a)) + == + == + rtam + ?: (lte (met 3 a) 2) + rud + rux + :: + ++ rf `tape`[?-(a %& '&', %| '|', * !!) ~] + ++ rn `tape`[?>(=(0 a) '~') ~] + ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])] + ++ rta rt + ++ rtam `tape`['%' (trip a)] + ++ rub `tape`['0' 'b' (rum 2 ~ |=(b=@ (add '0' b)))] + ++ rud (rum 10 ~ |=(b=@ (add '0' b))) + ++ rum + |= [b=@ c=tape d=$-(@ @)] + ^- tape + ?: =(0 a) + [(d 0) c] + =+ e=0 + |- ^- tape + ?: =(0 a) + c + =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4)))) + %= $ + a (div a b) + c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)] + e +(e) + == + :: + ++ rup + =+ b=(met 3 a) + ^- tape + :- '-' + |- ^- tape + ?: (gth (met 5 a) 1) + %+ weld + $(a (rsh 5 a), b (sub b 4)) + `tape`['-' '-' $(a (end 5 a), b 4)] + ?: =(0 b) + ['~' ~] + ?: (lte b 1) + (trip (tos:po a)) + |- ^- tape + ?: =(2 b) + =+ c=(rsh 3 a) + =+ d=(end 3 a) + (weld (trip (tod:po c)) (trip (tos:po (mix c d)))) + =+ c=(rsh [3 2] a) + =+ d=(end [3 2] a) + (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)]) + :: + ++ ruv + ^- tape + :+ '0' + 'v' + %^ rum + 64 + ~ + |= b=@ + ?: =(63 b) + '+' + ?: =(62 b) + '-' + ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4))) + :: + ++ rux `tape`['0' 'x' (rum 16 ~ |=(b=@ (add b ?:((lth b 10) 48 87))))] + -- +++ cass :: lowercase + |= vib=tape + ^- tape + (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a)))) +:: +++ cuss :: uppercase + |= vib=tape + ^- tape + (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32)))) +:: +++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord +:: +++ mesc :: ctrl code escape + |= vib=tape + ^- tape + ?~ vib + ~ + ?: =('\\' i.vib) + ['\\' '\\' $(vib t.vib)] + ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib)) + ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))] + [i.vib $(vib t.vib)] +:: +++ runt :: prepend repeatedly + |= [[a=@ b=@] c=tape] + ^- tape + ?: =(0 a) + c + [b $(a (dec a))] +:: +++ sand :: atom sanity + |= a=@ta + (flit (sane a)) +:: +++ sane :: atom sanity + |= a=@ta + |= b=@ ^- ? + ?. =(%t (end 3 a)) + :: XX more and better sanity + :: + & + =+ [inx=0 len=(met 3 b)] + ?: =(%tas a) + |- ^- ? + ?: =(inx len) & + =+ cur=(cut 3 [inx 1] b) + ?& ?| &((gte cur 'a') (lte cur 'z')) + &(=('-' cur) !=(0 inx) !=(len inx)) + &(&((gte cur '0') (lte cur '9')) !=(0 inx)) + == + $(inx +(inx)) + == + ?: =(%ta a) + |- ^- ? + ?: =(inx len) & + =+ cur=(cut 3 [inx 1] b) + ?& ?| &((gte cur 'a') (lte cur 'z')) + &((gte cur '0') (lte cur '9')) + |(=('-' cur) =('~' cur) =('_' cur) =('.' cur)) + == + $(inx +(inx)) + == + |- ^- ? + ?: =(inx len) & + =+ cur=(cut 3 [inx 1] b) + ?: &((lth cur 32) !=(10 cur)) | + =+ tef=(teff cur) + ?& ?| =(1 tef) + =+ i=1 + |- ^- ? + ?| =(i tef) + ?& (gte (cut 3 [(add i inx) 1] b) 128) + $(i +(i)) + == == == + $(inx (add inx tef)) + == +:: +++ ruth :: biblical sanity + |= [a=@ta b=*] + ^- @ + ?^ b !! + :: ?. ((sane a) b) !! + b +:: +++ trim :: list split + |* [a=@ b=(list)] + ^+ [p=b q=b] + ?~ b + [~ ~] + ?: =(0 a) + [~ b] + =+ c=$(a (dec a), b t.b) + [[i.b p.c] q.c] +:: +++ trip :: cord to tape + ~/ %trip + |= a=@ ^- tape + ?: =(0 (met 3 a)) + ~ + [^-(@ta (end 3 a)) $(a (rsh 3 a))] +:: +++ teff :: length utf8 + |= a=@t ^- @ + =+ b=(end 3 a) + ?: =(0 b) + ?>(=(`@`0 a) 0) + ?> |((gte b 32) =(10 b)) + ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4))) +:: +++ taft :: utf8 to utf32 + |= a=@t + ^- @c + %+ rap 5 + |- ^- (list @c) + =+ b=(teff a) + ?: =(0 b) ~ + =+ ^= c + %+ can 0 + %+ turn + ^- (list [p=@ q=@]) + ?+ b !! + %1 [[0 7] ~] + %2 [[8 6] [0 5] ~] + %3 [[16 6] [8 6] [0 4] ~] + %4 [[24 6] [16 6] [8 6] [0 3] ~] + == + |=([p=@ q=@] [q (cut 0 [p q] a)]) + ?> =((tuft c) (end [3 b] a)) + [c $(a (rsh [3 b] a))] +:: +++ tuba :: utf8 to utf32 tape + |= a=tape + ^- (list @c) + (rip 5 (taft (rap 3 a))) :: XX horrible +:: +++ tufa :: utf32 to utf8 tape + |= a=(list @c) + ^- tape + ?~ a "" + (weld (rip 3 (tuft i.a)) $(a t.a)) +:: +++ tuft :: utf32 to utf8 text + |= a=@c + ^- @t + %+ rap 3 + |- ^- (list @) + ?: =(`@`0 a) + ~ + =+ b=(end 5 a) + =+ c=$(a (rsh 5 a)) + ?: (lte b 0x7f) + [b c] + ?: (lte b 0x7ff) + :* (mix 0b1100.0000 (cut 0 [6 5] b)) + (mix 0b1000.0000 (end [0 6] b)) + c + == + ?: (lte b 0xffff) + :* (mix 0b1110.0000 (cut 0 [12 4] b)) + (mix 0b1000.0000 (cut 0 [6 6] b)) + (mix 0b1000.0000 (end [0 6] b)) + c + == + :* (mix 0b1111.0000 (cut 0 [18 3] b)) + (mix 0b1000.0000 (cut 0 [12 6] b)) + (mix 0b1000.0000 (cut 0 [6 6] b)) + (mix 0b1000.0000 (end [0 6] b)) + c + == +:: +++ wack :: knot escape + |= a=@ta + ^- @ta + =+ b=(rip 3 a) + %+ rap 3 + |- ^- tape + ?~ b + ~ + ?: =('~' i.b) ['~' '~' $(b t.b)] + ?: =('_' i.b) ['~' '-' $(b t.b)] + [i.b $(b t.b)] +:: +++ wick :: knot unescape + |= a=@ + ^- (unit @ta) + =+ b=(rip 3 a) + =- ?^(b ~ (some (rap 3 (flop c)))) + =| c=tape + |- ^- [b=tape c=tape] + ?~ b [~ c] + ?. =('~' i.b) + $(b t.b, c [i.b c]) + ?~ t.b [b ~] + ?- i.t.b + %'~' $(b t.t.b, c ['~' c]) + %'-' $(b t.t.b, c ['_' c]) + @ [b ~] + == +:: +++ woad :: cord unescape + |= a=@ta + ^- @t + %+ rap 3 + |- ^- (list @) + ?: =(`@`0 a) + ~ + =+ b=(end 3 a) + =+ c=(rsh 3 a) + ?: =('.' b) + [' ' $(a c)] + ?. =('~' b) + [b $(a c)] + => .(b (end 3 c), c (rsh 3 c)) + ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d)) + ^= d + =+ d=0 + |- ^- [p=@ q=@] + ?: =('.' b) + [d c] + ?< =(0 c) + %= $ + b (end 3 c) + c (rsh 3 c) + d %+ add (mul 16 d) + %+ sub b + ?: &((gte b '0') (lte b '9')) 48 + ?>(&((gte b 'a') (lte b 'z')) 87) + == + %'.' ['.' $(a c)] + %'~' ['~' $(a c)] + == +:: +++ wood :: cord escape + |= a=@t + ^- @ta + %+ rap 3 + |- ^- (list @) + ?: =(`@`0 a) + ~ + =+ b=(teff a) + =+ c=(taft (end [3 b] a)) + =+ d=$(a (rsh [3 b] a)) + ?: ?| &((gte c 'a') (lte c 'z')) + &((gte c '0') (lte c '9')) + =(`@`'-' c) + == + [c d] + ?+ c + :- '~' + =+ e=(met 2 c) + |- ^- tape + ?: =(0 e) + ['.' d] + =. e (dec e) + =+ f=(rsh [2 e] c) + [(add ?:((lte f 9) 48 87) f) $(c (end [2 e] c))] + :: + %' ' ['.' d] + %'.' ['~' '.' d] + %'~' ['~' '~' d] + == +:: +:: 4c: tank printer ++| %tank-printer +:: +++ wash :: render tank at width + |= [[tab=@ edg=@] tac=tank] ^- wall + (~(win re tac) tab edg) +:: +:: +re: tank renderer +:: +++ re + |_ tac=tank + :: +ram: render a tank to one line (flat) + :: + ++ ram + ^- tape + ?@ tac + (trip tac) + ?- -.tac + %leaf p.tac + :: + :: flat %palm rendered as %rose with welded openers + :: + %palm + =* mid p.p.tac + =* for (weld q.p.tac r.p.tac) + =* end s.p.tac + ram(tac [%rose [mid for end] q.tac]) + :: + :: flat %rose rendered with open/mid/close + :: + %rose + =* mid p.p.tac + =* for q.p.tac + =* end r.p.tac + =* lit q.tac + %+ weld + for + |- ^- tape + ?~ lit + end + %+ weld + ram(tac i.lit) + =* voz $(lit t.lit) + ?~(t.lit voz (weld mid voz)) + == + :: +win: render a tank to multiple lines (tall) + :: + :: indented by .tab, soft-wrapped at .edg + :: + ++ win + |= [tab=@ud edg=@ud] + :: output stack + :: + =| lug=wall + |^ ^- wall + ?@ tac + (rig (trip tac)) + ?- -.tac + %leaf (rig p.tac) + :: + %palm + =/ hom ram + ?: (lte (lent hom) (sub edg tab)) + (rig hom) + :: + =* for q.p.tac + =* lit q.tac + ?~ lit + (rig for) + ?~ t.lit + =: tab (add 2 tab) + lug $(tac i.lit) + == + (rig for) + :: + => .(lit `(list tank)`lit) + =/ lyn (mul 2 (lent lit)) + =. lug + |- ^- wall + ?~ lit + lug + =/ nyl (sub lyn 2) + %= ^$ + tac i.lit + tab (add tab nyl) + lug $(lit t.lit, lyn nyl) + == + (wig for) + :: + %rose + =/ hom ram + ?: (lte (lent hom) (sub edg tab)) + (rig hom) + :: + =* for q.p.tac + =* end r.p.tac + =* lit q.tac + =. lug + |- ^- wall + ?~ lit + ?~(end lug (rig end)) + %= ^$ + tac i.lit + tab (mod (add 2 tab) (mul 2 (div edg 3))) + lug $(lit t.lit) + == + ?~(for lug (wig for)) + == + :: +rig: indent tape and cons with output stack + :: + ++ rig + |= hom=tape + ^- wall + [(runt [tab ' '] hom) lug] + :: +wig: indent tape and cons with output stack + :: + :: joined with the top line if whitespace/indentation allow + :: + ++ wig + |= hom=tape + ^- wall + ?~ lug + (rig hom) + =/ wug :(add 1 tab (lent hom)) + ?. =+ mir=i.lug + |- ^- ? + ?~ mir | + ?| =(0 wug) + ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug))) + == + (rig hom) :: ^ XX regular form? + :_ t.lug + %+ runt [tab ' '] + (weld hom `tape`[' ' (slag wug i.lug)]) + -- + -- +++ show :: XX deprecated! + |= vem=* + |^ ^- tank + ?: ?=(@ vem) + [%leaf (mesc (trip vem))] + ?- vem + [s=~ c=*] + [%leaf '\'' (weld (mesc (tape +.vem)) `tape`['\'' ~])] + :: + [s=%a c=@] [%leaf (mesc (trip c.vem))] + [s=%b c=*] (shop c.vem |=(a=@ ~(rub at a))) + [s=[%c p=@] c=*] + :+ %palm + [['.' ~] ['-' ~] ~ ~] + [[%leaf (mesc (trip p.s.vem))] $(vem c.vem) ~] + :: + [s=%d c=*] (shop c.vem |=(a=@ ~(rud at a))) + [s=%k c=*] (tank c.vem) + [s=%h c=*] + :+ %rose + [['/' ~] ['/' ~] ~] + =+ yol=((list @ta) c.vem) + (turn yol |=(a=@ta [%leaf (trip a)])) + :: + [s=%l c=*] (shol c.vem) + [s=%o c=*] + %= $ + vem + :- [%m '%h::[%d %d].[%d %d]>'] + [-.c.vem +<-.c.vem +<+.c.vem +>-.c.vem +>+.c.vem ~] + == + :: + [s=%p c=*] (shop c.vem |=(a=@ ~(rup at a))) + [s=%q c=*] (shop c.vem |=(a=@ ~(r at a))) + [s=%r c=*] $(vem [[%r ' ' '{' '}'] c.vem]) + [s=%t c=*] (shop c.vem |=(a=@ ~(rt at a))) + [s=%v c=*] (shop c.vem |=(a=@ ~(ruv at a))) + [s=%x c=*] (shop c.vem |=(a=@ ~(rux at a))) + [s=[%m p=@] c=*] (shep p.s.vem c.vem) + [s=[%r p=@] c=*] + $(vem [[%r ' ' (cut 3 [0 1] p.s.vem) (cut 3 [1 1] p.s.vem)] c.vem]) + :: + [s=[%r p=@ q=@ r=@] c=*] + :+ %rose + :* p=(mesc (trip p.s.vem)) + q=(mesc (trip q.s.vem)) + r=(mesc (trip r.s.vem)) + == + |- ^- (list tank) + ?@ c.vem + ~ + [^$(vem -.c.vem) $(c.vem +.c.vem)] + :: + [s=%z c=*] $(vem [[%r %$ %$ %$] c.vem]) + * !! + == + ++ shep + |= [fom=@ gar=*] + ^- tank + =+ l=(met 3 fom) + =+ i=0 + :- %leaf + |- ^- tape + ?: (gte i l) + ~ + =+ c=(cut 3 [i 1] fom) + ?. =(37 c) + (weld (mesc [c ~]) $(i +(i))) + =+ d=(cut 3 [+(i) 1] fom) + ?. .?(gar) + ['\\' '#' $(i (add 2 i))] + (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar)) + :: + ++ shop + |= [aug=* vel=$-(a=@ tape)] + ^- tank + ?: ?=(@ aug) + [%leaf (vel aug)] + :+ %rose + [[' ' ~] ['[' ~] [']' ~]] + => .(aug `*`aug) + |- ^- (list tank) + ?: ?=(@ aug) + [^$ ~] + [^$(aug -.aug) $(aug +.aug)] + :: + ++ shol + |= lim=* + :+ %rose + [['.' ~] ~ ~] + |- ^- (list tank) + ?: ?=(@ lim) ~ + :_ $(lim +.lim) + ?+ -.lim (show '#') + ~ (show '$') + c=@ (show c.lim) + [%& %1] (show '.') + [%& c=@] + [%leaf '+' ~(rud at c.lim)] + :: + [%| @ ~] (show ',') + [%| n=@ ~ c=@] + [%leaf (weld (reap n.lim '^') ?~(c.lim "$" (trip c.lim)))] + == + -- +:: +:: 4d: parsing (tracing) ++| %parsing-tracing +:: +++ last |= [zyc=hair naz=hair] :: farther trace + ^- hair + ?: =(p.zyc p.naz) + ?:((gth q.zyc q.naz) zyc naz) + ?:((gth p.zyc p.naz) zyc naz) +:: +++ lust |= [weq=char naz=hair] :: detect newline + ^- hair + ?:(=(`@`10 weq) [+(p.naz) 1] [p.naz +(q.naz)]) +:: +:: 4e: parsing (combinators) ++| %parsing-combinators +:: +++ bend :: conditional comp + ~/ %bend + |* raq=_|*([a=* b=*] [~ u=[a b]]) + ~/ %fun + |* [vex=edge sab=rule] + ?~ q.vex + vex + =+ yit=(sab q.u.q.vex) + =+ yur=(last p.vex p.yit) + ?~ q.yit + [p=yur q=q.vex] + =+ vux=(raq p.u.q.vex p.u.q.yit) + ?~ vux + [p=yur q=q.vex] + [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]] +:: +++ comp + ~/ %comp + |* raq=_|*([a=* b=*] [a b]) :: arbitrary compose + ~/ %fun + |* [vex=edge sab=rule] + ~! +< + ?~ q.vex + vex + =+ yit=(sab q.u.q.vex) + =+ yur=(last p.vex p.yit) + ?~ q.yit + [p=yur q=q.yit] + [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]] +:: +++ fail |=(tub=nail [p=p.tub q=~]) :: never parse +++ glue :: add rule + ~/ %glue + |* bus=rule + ~/ %fun + |* [vex=edge sab=rule] + (plug vex ;~(pfix bus sab)) +:: +++ less :: no first and second + |* [vex=edge sab=rule] + ?~ q.vex + =+ roq=(sab) + [p=(last p.vex p.roq) q=q.roq] + (fail +<.sab) +:: +++ pfix :: discard first rule + ~/ %pfix + |* sam=[vex=edge sab=rule] + %. sam + (comp |*([a=* b=*] b)) +:: +++ plug :: first then second + ~/ %plug + |* [vex=edge sab=rule] + ?~ q.vex + vex + =+ yit=(sab q.u.q.vex) + =+ yur=(last p.vex p.yit) + ?~ q.yit + [p=yur q=q.yit] + [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]] +:: +++ pose :: first or second + ~/ %pose + |* [vex=edge sab=rule] + ?~ q.vex + =+ roq=(sab) + [p=(last p.vex p.roq) q=q.roq] + vex +:: +++ simu :: first and second + |* [vex=edge sab=rule] + ?~ q.vex + vex + =+ roq=(sab) + roq +:: +++ sfix :: discard second rule + ~/ %sfix + |* sam=[vex=edge sab=rule] + %. sam + (comp |*([a=* b=*] a)) +:: +:: 4f: parsing (rule builders) ++| %parsing-rule-builders +:: +++ bass :: leftmost base + |* [wuc=@ tyd=rule] + %+ cook + |= waq=(list @) + %+ roll + waq + =|([p=@ q=@] |.((add p (mul wuc q)))) + tyd +:: +++ boss :: rightmost base + |* [wuc=@ tyd=rule] + %+ cook + |= waq=(list @) + %+ reel + waq + =|([p=@ q=@] |.((add p (mul wuc q)))) + tyd +:: +++ cold :: replace w+ constant + ~/ %cold + |* [cus=* sef=rule] + ~/ %fun + |= tub=nail + =+ vex=(sef tub) + ?~ q.vex + vex + [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]] +:: +++ cook :: apply gate + ~/ %cook + |* [poq=gate sef=rule] + ~/ %fun + |= tub=nail + =+ vex=(sef tub) + ?~ q.vex + vex + [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]] +:: +++ easy :: always parse + ~/ %easy + |* huf=* + ~/ %fun + |= tub=nail + ^- (like _huf) + [p=p.tub q=[~ u=[p=huf q=tub]]] +:: +++ fuss + |= [sic=@t non=@t] + ;~(pose (cold %& (jest sic)) (cold %| (jest non))) +:: +++ full :: has to fully parse + |* sef=rule + |= tub=nail + =+ vex=(sef tub) + ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~])) +:: +++ funk :: add to tape first + |* [pre=tape sef=rule] + |= tub=nail + (sef p.tub (weld pre q.tub)) +:: +++ here :: place-based apply + ~/ %here + |* [hez=_|=([a=pint b=*] [a b]) sef=rule] + ~/ %fun + |= tub=nail + =+ vex=(sef tub) + ?~ q.vex + vex + [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]] +:: +++ inde |* sef=rule :: indentation block + |= nail ^+ (sef) + =+ [har tap]=[p q]:+< + =+ lev=(fil 3 (dec q.har) ' ') + =+ eol=(just `@t`10) + =+ =- roq=((star ;~(pose prn ;~(sfix eol (jest lev)) -)) har tap) + ;~(simu ;~(plug eol eol) eol) + ?~ q.roq roq + =+ vex=(sef har(q 1) p.u.q.roq) + =+ fur=p.vex(q (add (dec q.har) q.p.vex)) + ?~ q.vex vex(p fur) + =- vex(p fur, u.q -) + :+ &3.vex + &4.vex(q.p (add (dec q.har) q.p.&4.vex)) + =+ res=|4.vex + |- ?~ res |4.roq + ?. =(10 -.res) [-.res $(res +.res)] + (welp [`@t`10 (trip lev)] $(res +.res)) +:: +++ ifix + |* [fel=[rule rule] hof=rule] + ~! +< + ~! +<:-.fel + ~! +<:+.fel + ;~(pfix -.fel ;~(sfix hof +.fel)) +:: +++ jest :: match a cord + |= daf=@t + |= tub=nail + =+ fad=daf + |- ^- (like @t) + ?: =(`@`0 daf) + [p=p.tub q=[~ u=[p=fad q=tub]]] + ?: |(?=(~ q.tub) !=((end 3 daf) i.q.tub)) + (fail tub) + $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 daf)) +:: +++ just :: XX redundant, jest + ~/ %just :: match a char + |= daf=char + ~/ %fun + |= tub=nail + ^- (like char) + ?~ q.tub + (fail tub) + ?. =(daf i.q.tub) + (fail tub) + (next tub) +:: +++ knee :: callbacks + |* [gar=* sef=_|.(*rule)] + |= tub=nail + ^- (like _gar) + ((sef) tub) +:: +++ mask :: match char in set + ~/ %mask + |= bud=(list char) + ~/ %fun + |= tub=nail + ^- (like char) + ?~ q.tub + (fail tub) + ?. (lien bud |=(a=char =(i.q.tub a))) + (fail tub) + (next tub) +:: +++ more :: separated, * + |* [bus=rule fel=rule] + ;~(pose (most bus fel) (easy ~)) +:: +++ most :: separated, + + |* [bus=rule fel=rule] + ;~(plug fel (star ;~(pfix bus fel))) +:: +++ next :: consume a char + |= tub=nail + ^- (like char) + ?~ q.tub + (fail tub) + =+ zac=(lust i.q.tub p.tub) + [zac [~ i.q.tub [zac t.q.tub]]] +:: +++ perk :: parse cube fork + |* a=(pole @tas) + ?~ a fail + ;~ pose + (cold -.a (jest -.a)) + $(a +.a) + == +:: +++ pick :: rule for ++each + |* [a=rule b=rule] + ;~ pose + (stag %& a) + (stag %| b) + == +++ plus |*(fel=rule ;~(plug fel (star fel))) :: +++ punt |*([a=rule] ;~(pose (stag ~ a) (easy ~))) :: +++ sear :: conditional cook + |* [pyq=$-(* (unit)) sef=rule] + |= tub=nail + =+ vex=(sef tub) + ?~ q.vex + vex + =+ gey=(pyq p.u.q.vex) + ?~ gey + [p=p.vex q=~] + [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]] +:: +++ shim :: match char in range + ~/ %shim + |= [les=@ mos=@] + ~/ %fun + |= tub=nail + ^- (like char) + ?~ q.tub + (fail tub) + ?. ?&((gte i.q.tub les) (lte i.q.tub mos)) + (fail tub) + (next tub) +:: +++ stag :: add a label + ~/ %stag + |* [gob=* sef=rule] + ~/ %fun + |= tub=nail + =+ vex=(sef tub) + ?~ q.vex + vex + [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]] +:: +++ stet :: + |* leh=(list [?(@ [@ @]) rule]) + |- + ?~ leh + ~ + [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)] +:: +++ stew :: switch by first char + ~/ %stew + |* leh=(list [p=?(@ [@ @]) q=rule]) :: char+range keys + =+ ^= wor :: range complete lth + |= [ort=?(@ [@ @]) wan=?(@ [@ @])] + ?@ ort + ?@(wan (lth ort wan) (lth ort -.wan)) + ?@(wan (lth +.ort wan) (lth +.ort -.wan)) + =+ ^= hel :: build parser map + =+ hel=`(tree _?>(?=(^ leh) i.leh))`~ + |- ^+ hel + ?~ leh + ~ + =+ yal=$(leh t.leh) + |- ^+ hel + ?~ yal + [i.leh ~ ~] + ?: (wor p.i.leh p.n.yal) + =+ nuc=$(yal l.yal) + ?> ?=(^ nuc) + ?: (mor p.n.yal p.n.nuc) + [n.yal nuc r.yal] + [n.nuc l.nuc [n.yal r.nuc r.yal]] + =+ nuc=$(yal r.yal) + ?> ?=(^ nuc) + ?: (mor p.n.yal p.n.nuc) + [n.yal l.yal nuc] + [n.nuc [n.yal l.yal l.nuc] r.nuc] + ~% %fun ..^$ ~ + |= tub=nail + ?~ q.tub + (fail tub) + |- + ?~ hel + (fail tub) + ?: ?@ p.n.hel + =(p.n.hel i.q.tub) + ?&((gte i.q.tub -.p.n.hel) (lte i.q.tub +.p.n.hel)) + :: (q.n.hel [(lust i.q.tub p.tub) t.q.tub]) + (q.n.hel tub) + ?: (wor i.q.tub p.n.hel) + $(hel l.hel) + $(hel r.hel) +:: +++ slug :: + |* raq=_=>(~ |*([a=* b=*] [a b])) + |* [bus=rule fel=rule] + ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel))) +:: +++ star :: 0 or more times + |* fel=rule + (stir `(list _(wonk *fel))`~ |*([a=* b=*] [a b]) fel) +:: +++ stir + ~/ %stir + |* [rud=* raq=_=>(~ |*([a=* b=*] [a b])) fel=rule] + ~/ %fun + |= tub=nail + ^- (like _rud) + :: + :: lef: successful interim parse results (per .fel) + :: wag: initial accumulator (.rud in .tub at farthest success) + :: + =+ ^= [lef wag] + =| lef=(list _(fel tub)) + |- ^- [_lef (pair hair [~ u=(pair _rud nail)])] + =+ vex=(fel tub) + ?~ q.vex + :- lef + [p.vex [~ rud tub]] + $(lef [vex lef], tub q.u.q.vex) + :: + :: fold .lef into .wag, combining results with .raq + :: + %+ roll lef + |= _[vex=(fel tub) wag=wag] :: q.vex is always (some) + ^+ wag + :- (last p.vex p.wag) + [~ (raq p.u.+.q.vex p.u.q.wag) q.u.q.wag] +:: +++ stun :: parse several times + ~/ %stun + |* [lig=[@ @] fel=rule] + |= tub=nail + ^- (like (list _(wonk (fel)))) + ?: =(0 +.lig) + [p.tub [~ ~ tub]] + =+ vex=(fel tub) + ?~ q.vex + ?: =(0 -.lig) + [p.vex [~ ~ tub]] + vex + =+ ^= wag %= $ + -.lig ?:(=(0 -.lig) 0 (dec -.lig)) + +.lig ?:(=(0 +.lig) 0 (dec +.lig)) + tub q.u.q.vex + == + ?~ q.wag + wag + [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]] +:: +:: 4g: parsing (outside caller) ++| %parsing-outside-caller +:: +++ rash |*([naf=@ sab=rule] (scan (trip naf) sab)) +++ rose |* [los=tape sab=rule] + =+ vex=(sab [[1 1] los]) + =+ len=(lent los) + ?. =(+(len) q.p.vex) [%| p=(dec q.p.vex)] + ?~ q.vex + [%& p=~] + [%& p=[~ u=p.u.q.vex]] +++ rush |*([naf=@ sab=rule] (rust (trip naf) sab)) +++ rust |* [los=tape sab=rule] + =+ vex=((full sab) [[1 1] los]) + ?~(q.vex ~ [~ u=p.u.q.vex]) +++ scan |* [los=tape sab=rule] + =+ vex=((full sab) [[1 1] los]) + ?~ q.vex + ~_ (show [%m '{%d %d}'] p.p.vex q.p.vex ~) + ~_(leaf+"syntax error" !!) + p.u.q.vex +:: +:: 4h: parsing (ascii glyphs) ++| %parsing-ascii-glyphs +:: +++ ace (just ' ') :: spACE +++ bar (just '|') :: vertical BAR +++ bas (just '\\') :: Back Slash (escaped) +++ buc (just '$') :: dollars BUCks +++ cab (just '_') :: CABoose +++ cen (just '%') :: perCENt +++ col (just ':') :: COLon +++ com (just ',') :: COMma +++ doq (just '"') :: Double Quote +++ dot (just '.') :: dot dot dot ... +++ fas (just '/') :: Forward Slash +++ gal (just '<') :: Greater Left +++ gar (just '>') :: Greater Right +++ hax (just '#') :: Hash +++ hep (just '-') :: HyPhen +++ kel (just '{') :: Curly Left +++ ker (just '}') :: Curly Right +++ ket (just '^') :: CareT +++ lus (just '+') :: pLUS +++ mic (just ';') :: seMIColon +++ pal (just '(') :: Paren Left +++ pam (just '&') :: AMPersand pampersand +++ par (just ')') :: Paren Right +++ pat (just '@') :: AT pat +++ sel (just '[') :: Square Left +++ ser (just ']') :: Square Right +++ sig (just '~') :: SIGnature squiggle +++ soq (just '\'') :: Single Quote +++ tar (just '*') :: sTAR +++ tic (just '`') :: backTiCk +++ tis (just '=') :: 'tis tis, it is +++ wut (just '?') :: wut, what? +++ zap (just '!') :: zap! bang! crash!! +:: +:: 4i: parsing (useful idioms) ++| %parsing-useful-idioms +:: +++ alf ;~(pose low hig) :: alphabetic +++ aln ;~(pose low hig nud) :: alphanumeric +++ alp ;~(pose low hig nud hep) :: alphanumeric and - +++ bet ;~(pose (cold 2 hep) (cold 3 lus)) :: axis syntax - + +++ bin (bass 2 (most gon but)) :: binary to atom +++ but (cook |=(a=@ (sub a '0')) (shim '0' '1')) :: binary digit +++ cit (cook |=(a=@ (sub a '0')) (shim '0' '7')) :: octal digit +++ dem (bass 10 (most gon dit)) :: decimal to atom +++ dit (cook |=(a=@ (sub a '0')) (shim '0' '9')) :: decimal digit +++ dog ;~(plug dot gay) :: . number separator +++ dof ;~(plug hep gay) :: - @q separator +++ doh ;~(plug ;~(plug hep hep) gay) :: -- phon separator +++ dun (cold ~ ;~(plug hep hep)) :: -- (stop) to ~ +++ duz (cold ~ ;~(plug tis tis)) :: == (stet) to ~ +++ gah (mask [`@`10 ' ' ~]) :: newline or ace +++ gap (cold ~ ;~(plug gaq (star ;~(pose vul gah)))) :: plural space +++ gaq ;~ pose :: end of line + (just `@`10) + ;~(plug gah ;~(pose gah vul)) + vul + == +++ gaw (cold ~ (star ;~(pose vul gah))) :: classic white +++ gay ;~(pose gap (easy ~)) :: +++ gon ;~(pose ;~(plug bas gay fas) (easy ~)) :: long numbers \ / +++ gul ;~(pose (cold 2 gal) (cold 3 gar)) :: axis syntax < > +++ hex (bass 16 (most gon hit)) :: hex to atom +++ hig (shim 'A' 'Z') :: uppercase +++ hit ;~ pose :: hex digits + dit + (cook |=(a=char (sub a 87)) (shim 'a' 'f')) + (cook |=(a=char (sub a 55)) (shim 'A' 'F')) + == +++ iny :: indentation block + |* sef=rule + |= nail ^+ (sef) + =+ [har tap]=[p q]:+< + =+ lev=(fil 3 (dec q.har) ' ') + =+ eol=(just `@t`10) + =+ =- roq=((star ;~(pose prn ;~(sfix eol (jest lev)) -)) har tap) + ;~(simu ;~(plug eol eol) eol) + ?~ q.roq roq + =+ vex=(sef har(q 1) p.u.q.roq) + =+ fur=p.vex(q (add (dec q.har) q.p.vex)) + ?~ q.vex vex(p fur) + =- vex(p fur, u.q -) + :+ &3.vex + &4.vex(q.p (add (dec q.har) q.p.&4.vex)) + =+ res=|4.vex + |- ?~ res |4.roq + ?. =(10 -.res) [-.res $(res +.res)] + (welp [`@t`10 (trip lev)] $(res +.res)) +:: +++ low (shim 'a' 'z') :: lowercase +++ mes %+ cook :: hexbyte + |=([a=@ b=@] (add (mul 16 a) b)) + ;~(plug hit hit) +++ nix (boss 256 (star ;~(pose aln cab))) :: +++ nud (shim '0' '9') :: numeric +++ prn ;~(less (just `@`127) (shim 32 256)) :: non-control +++ qat ;~ pose :: chars in blockcord + prn + ;~(less ;~(plug (just `@`10) soz) (just `@`10)) + == +++ qit ;~ pose :: chars in a cord + ;~(less bas soq prn) + ;~(pfix bas ;~(pose bas soq mes)) :: escape chars + == +++ qut ;~ simu soq :: cord + ;~ pose + ;~ less soz + (ifix [soq soq] (boss 256 (more gon qit))) + == + =+ hed=;~(pose ;~(plug (plus ace) vul) (just '\0a')) + %- iny %+ ifix + :- ;~(plug soz hed) + ;~(plug (just '\0a') soz) + (boss 256 (star qat)) + == + == +++ soz ;~(plug soq soq soq) :: delimiting ''' +++ sym :: symbol + %+ cook + |=(a=tape (rap 3 ^-((list @) a))) + ;~(plug low (star ;~(pose nud low hep))) +:: +++ mixed-case-symbol + %+ cook + |=(a=tape (rap 3 ^-((list @) a))) + ;~(plug alf (star alp)) +:: +++ ven ;~ (comp |=([a=@ b=@] (peg a b))) :: +>- axis syntax + bet + =+ hom=`?`| + |= tub=nail + ^- (like @) + =+ vex=?:(hom (bet tub) (gul tub)) + ?~ q.vex + [p.tub [~ 1 tub]] + =+ wag=$(p.tub p.vex, hom !hom, tub q.u.q.vex) + ?> ?=(^ q.wag) + [p.wag [~ (peg p.u.q.vex p.u.q.wag) q.u.q.wag]] + == +++ vit :: base64 digit + ;~ pose + (cook |=(a=@ (sub a 65)) (shim 'A' 'Z')) + (cook |=(a=@ (sub a 71)) (shim 'a' 'z')) + (cook |=(a=@ (add a 4)) (shim '0' '9')) + (cold 62 (just '-')) + (cold 63 (just '+')) + == +++ vul %+ cold ~ :: comments + ;~ plug col col + (star prn) + (just `@`10) + == +:: +:: 4j: parsing (bases and base digits) ++| %parsing-bases-and-base-digits +:: +++ ab + |% + ++ bix (bass 16 (stun [2 2] six)) + ++ fem (sear |=(a=@ (cha:fa a)) aln) + ++ haf (bass 256 ;~(plug tep tiq (easy ~))) + ++ hef %+ sear |=(a=@ ?:(=(a 0) ~ (some a))) + %+ bass 256 + ;~(plug tip tiq (easy ~)) + ++ hif (bass 256 ;~(plug tip tiq (easy ~))) + ++ hof (bass 0x1.0000 ;~(plug hef (stun [1 3] ;~(pfix hep hif)))) + ++ huf (bass 0x1.0000 ;~(plug hef (stun [0 3] ;~(pfix hep hif)))) + ++ hyf (bass 0x1.0000 ;~(plug hif (stun [3 3] ;~(pfix hep hif)))) + ++ pev (bass 32 ;~(plug sev (stun [0 4] siv))) + ++ pew (bass 64 ;~(plug sew (stun [0 4] siw))) + ++ piv (bass 32 (stun [5 5] siv)) + ++ piw (bass 64 (stun [5 5] siw)) + ++ qeb (bass 2 ;~(plug seb (stun [0 3] sib))) + ++ qex (bass 16 ;~(plug sex (stun [0 3] hit))) + ++ qib (bass 2 (stun [4 4] sib)) + ++ qix (bass 16 (stun [4 4] six)) + ++ seb (cold 1 (just '1')) + ++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9')) + ++ sev ;~(pose sed sov) + ++ sew ;~(pose sed sow) + ++ sex ;~(pose sed sox) + ++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1')) + ++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9')) + ++ siv ;~(pose sid sov) + ++ siw ;~(pose sid sow) + ++ six ;~(pose sid sox) + ++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v')) + ++ sow ;~ pose + (cook |=(a=@ (sub a 87)) (shim 'a' 'z')) + (cook |=(a=@ (sub a 29)) (shim 'A' 'Z')) + (cold 62 (just '-')) + (cold 63 (just '~')) + == + ++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f')) + ++ ted (bass 10 ;~(plug sed (stun [0 2] sid))) + ++ tep (sear |=(a=@ ?:(=(a 'doz') ~ (ins:po a))) til) + ++ tip (sear |=(a=@ (ins:po a)) til) + ++ tiq (sear |=(a=@ (ind:po a)) til) + ++ tid (bass 10 (stun [3 3] sid)) + ++ til (boss 256 (stun [3 3] low)) + ++ urs %+ cook + |=(a=tape (rap 3 ^-((list @) a))) + (star ;~(pose nud low hep dot sig cab)) + ++ urt %+ cook + |=(a=tape (rap 3 ^-((list @) a))) + (star ;~(pose nud low hep dot sig)) + ++ urx %+ cook + |=(a=tape (rap 3 ^-((list @) a))) + %- star + ;~ pose + nud + low + hep + cab + (cold ' ' dot) + (cook tuft (ifix [sig dot] hex)) + ;~(pfix sig ;~(pose sig dot)) + == + ++ voy ;~(pfix bas ;~(pose bas soq bix)) + -- +++ ag + |% + ++ ape |*(fel=rule ;~(pose (cold `@`0 (just '0')) fel)) + ++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab))))) + ++ bip =+ tod=(ape qex:ab) + (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod)))) + ++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab))))) + ++ dim (ape dip) + ++ dip (bass 10 ;~(plug sed:ab (star sid:ab))) + ++ dum (bass 10 (plus sid:ab)) + ++ fed %+ cook fynd:ob + ;~ pose + %+ bass 0x1.0000.0000.0000.0000 :: oversized + ;~ plug + huf:ab + (plus ;~(pfix doh hyf:ab)) + == + hof:ab :: planet or moon + haf:ab :: star + tiq:ab :: galaxy + == + ++ feq %+ cook |=(a=(list @) (rep 4 (flop a))) + ;~ plug + ;~(pose hif:ab tiq:ab) + (star ;~(pfix dof hif:ab)) + == + ++ fim (sear den:fa (bass 58 (plus fem:ab))) + ++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab))))) + ++ lip =+ tod=(ape ted:ab) + (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod)))) + ++ mot ;~ pose + ;~ pfix + (just '1') + (cook |=(a=@ (add 10 (sub a '0'))) (shim '0' '2')) + == + sed:ab + == + ++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab))))) + ++ vum (bass 32 (plus siv:ab)) + ++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab))))) + -- +++ mu + |_ [top=@ bot=@] + ++ zag [p=(end 4 (add top bot)) q=bot] + ++ zig [p=(end 4 (add top (sub 0x1.0000 bot))) q=bot] + ++ zug (mix (lsh 4 top) bot) + -- +++ ne + |_ tig=@ + ++ c (cut 3 [tig 1] key:fa) + ++ d (add tig '0') + ++ x ?:((gte tig 10) (add tig 87) d) + ++ v ?:((gte tig 10) (add tig 87) d) + ++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x))) + -- +:: +:: 4k: atom printing ++| %atom-printing +:: +++ co + !: + ~% %co ..co ~ + =< |_ lot=coin + ++ rear |=(rom=tape rend(rep rom)) + ++ rent ~+ `@ta`(rap 3 rend) + ++ rend + ^- tape + ~+ + ?: ?=(%blob -.lot) + ['~' '0' ((v-co 1) (jam p.lot))] + ?: ?=(%many -.lot) + :- '.' + |- ^- tape + ?~ p.lot + ['_' '_' rep] + ['_' (weld (trip (wack rent(lot i.p.lot))) $(p.lot t.p.lot))] + =+ [yed=(end 3 p.p.lot) hay=(cut 3 [1 1] p.p.lot)] + |- ^- tape + ?+ yed (z-co q.p.lot) + %c ['~' '-' (weld (rip 3 (wood (tuft q.p.lot))) rep)] + %d + ?+ hay (z-co q.p.lot) + %a + =+ yod=(yore q.p.lot) + =? rep ?=(^ f.t.yod) ['.' (s-co f.t.yod)] + =? rep !&(?=(~ f) =(0 h) =(0 m) =(0 s)):t.yod + =. rep ['.' (y-co s.t.yod)] + =. rep ['.' (y-co m.t.yod)] + ['.' '.' (y-co h.t.yod)] + =. rep ['.' (a-co d.t.yod)] + =. rep ['.' (a-co m.yod)] + =? rep !a.yod ['-' rep] + ['~' (a-co y.yod)] + :: + %r + =+ yug=(yell q.p.lot) + =? rep ?=(^ f.yug) ['.' (s-co f.yug)] + :- '~' + ?: &(=(0 d.yug) =(0 m.yug) =(0 h.yug) =(0 s.yug)) + ['s' '0' rep] + =? rep !=(0 s.yug) ['.' 's' (a-co s.yug)] + =? rep !=(0 m.yug) ['.' 'm' (a-co m.yug)] + =? rep !=(0 h.yug) ['.' 'h' (a-co h.yug)] + =? rep !=(0 d.yug) ['.' 'd' (a-co d.yug)] + +.rep + == + :: + %f + ?: =(& q.p.lot) + ['.' 'y' rep] + ?:(=(| q.p.lot) ['.' 'n' rep] (z-co q.p.lot)) + :: + %n ['~' rep] + %i + ?+ hay (z-co q.p.lot) + %f ((ro-co [3 10 4] |=(a=@ ~(d ne a))) q.p.lot) + %s ((ro-co [4 16 8] |=(a=@ ~(x ne a))) q.p.lot) + == + :: + %p + =+ sxz=(fein:ob q.p.lot) + =+ dyx=(met 3 sxz) + :- '~' + ?: (lte dyx 1) + (weld (trip (tod:po sxz)) rep) + =+ dyy=(met 4 sxz) + =| imp=@ud + |- ^- tape + ?: =(imp dyy) + rep + %= $ + imp +(imp) + rep =/ log (cut 4 [imp 1] sxz) + ;: weld + (trip (tos:po (rsh 3 log))) + (trip (tod:po (end 3 log))) + ?:(=((mod imp 4) 0) ?:(=(imp 0) "" "--") "-") + rep + == == + :: + %q + :+ '.' '~' + =; res=(pair ? tape) + (weld q.res rep) + %+ roll + =* val q.p.lot + ?:(=(0 val) ~[0] (rip 3 val)) + |= [q=@ s=? r=tape] + :- !s + %+ weld + (trip (?:(s tod:po tos:po) q)) + ?.(&(s !=(r "")) r ['-' r]) + :: + %r + ?+ hay (z-co q.p.lot) + %d ['.' '~' (r-co (rlyd q.p.lot))] + %h ['.' '~' '~' (r-co (rlyh q.p.lot))] + %q ['.' '~' '~' '~' (r-co (rlyq q.p.lot))] + %s ['.' (r-co (rlys q.p.lot))] + == + :: + %u + ?: ?=(%c hay) + %+ welp ['0' 'c' (reap (pad:fa q.p.lot) '1')] + (c-co (enc:fa q.p.lot)) + :: + =; gam=(pair tape tape) + (weld p.gam ?:(=(0 q.p.lot) `tape`['0' ~] q.gam)) + ?+ hay [~ ((ox-co [10 3] |=(a=@ ~(d ne a))) q.p.lot)] + %b [['0' 'b' ~] ((ox-co [2 4] |=(a=@ ~(d ne a))) q.p.lot)] + %i [['0' 'i' ~] ((d-co 1) q.p.lot)] + %x [['0' 'x' ~] ((ox-co [16 4] |=(a=@ ~(x ne a))) q.p.lot)] + %v [['0' 'v' ~] ((ox-co [32 5] |=(a=@ ~(x ne a))) q.p.lot)] + %w [['0' 'w' ~] ((ox-co [64 5] |=(a=@ ~(w ne a))) q.p.lot)] + == + :: + %s + %+ weld + ?:((syn:si q.p.lot) "--" "-") + $(yed 'u', q.p.lot (abs:si q.p.lot)) + :: + %t + ?: =('a' hay) + ?: =('s' (cut 3 [2 1] p.p.lot)) + (weld (rip 3 q.p.lot) rep) + ['~' '.' (weld (rip 3 q.p.lot) rep)] + ['~' '~' (weld (rip 3 (wood q.p.lot)) rep)] + == + -- + =| rep=tape + =< |% + :: rendering idioms, output zero-padded to minimum lengths + :: + :: +a-co: decimal + :: +c-co: base58check + :: +d-co: decimal, takes minimum output digits + :: +r-co: floating point + :: +s-co: list of '.'-prefixed base16, 4 digit minimum + :: +v-co: base32, takes minimum output digits + :: +w-co: base64, takes minimum output digits + :: +x-co: base16, takes minimum output digits + :: +y-co: decimal, 2 digit minimum + :: +z-co: '0x'-prefixed base16 + :: + ++ a-co |=(dat=@ ((d-co 1) dat)) + ++ c-co (em-co [58 1] |=([? b=@ c=tape] [~(c ne b) c])) + ++ d-co |=(min=@ (em-co [10 min] |=([? b=@ c=tape] [~(d ne b) c]))) + :: + ++ r-co + |= a=dn + ?: ?=([%i *] a) (weld ?:(s.a "inf" "-inf") rep) + ?: ?=([%n *] a) (weld "nan" rep) + =; rep ?:(s.a rep ['-' rep]) + =/ f ((d-co 1) a.a) + =^ e e.a + =/ e=@s (sun:si (lent f)) + =/ sci :(sum:si e.a e -1) + ?: (syn:si (dif:si e.a --3)) [--1 sci] :: 12000 -> 12e3 e>+2 + ?: !(syn:si (dif:si sci -2)) [--1 sci] :: 0.001 -> 1e-3 e<-2 + [(sum:si sci --1) --0] :: 1.234e2 -> '.'@3 -> 123 .4 + =? rep !=(--0 e.a) + :(weld ?:((syn:si e.a) "e" "e-") ((d-co 1) (abs:si e.a))) + (weld (ed-co e f) rep) + :: + ++ s-co + |= esc=(list @) ^- tape + ?~ esc rep + ['.' =>(.(rep $(esc t.esc)) ((x-co 4) i.esc))] + :: + ++ v-co |=(min=@ (em-co [32 min] |=([? b=@ c=tape] [~(v ne b) c]))) + ++ w-co |=(min=@ (em-co [64 min] |=([? b=@ c=tape] [~(w ne b) c]))) + ++ x-co |=(min=@ (em-co [16 min] |=([? b=@ c=tape] [~(x ne b) c]))) + ++ y-co |=(dat=@ ((d-co 2) dat)) + ++ z-co |=(dat=@ `tape`['0' 'x' ((x-co 1) dat)]) + -- + |% + :: +em-co: format in numeric base + :: + :: in .bas, format .min digits of .hol with .par + :: + :: - .hol is processed least-significant digit first + :: - all available digits in .hol will be processed, but + :: .min digits can exceed the number available in .hol + :: - .par handles all accumulated output on each call, + :: and can edit it, prepend or append digits, &c + :: - until .hol is exhausted, .par's sample is [| digit output], + :: subsequently, it's [& 0 output] + :: + ++ em-co + |= [[bas=@ min=@] par=$-([? @ tape] tape)] + |= hol=@ + ^- tape + ?: &(=(0 hol) =(0 min)) + rep + =/ [dar=@ rad=@] (dvr hol bas) + %= $ + min ?:(=(0 min) 0 (dec min)) + hol dar + rep (par =(0 dar) rad rep) + == + :: + :: +ed-co: format in numeric base, with output length + :: + :: - like +em-co, but .par's sample will be [| digit output] + :: on the first call, regardless of the available digits in .hol + :: - used only for @r* floats + :: + ++ ed-co + |= [exp=@s int=tape] ^- tape + =/ [pos=? dig=@u] [=(--1 (cmp:si exp --0)) (abs:si exp)] + ?. pos + (into (weld (reap +(dig) '0') int) 1 '.') + =/ len (lent int) + ?: (lth dig len) (into int dig '.') + (weld int (reap (sub dig len) '0')) + :: + :: +ox-co: format '.'-separated digit sequences in numeric base + :: + :: in .bas, format each digit of .hol with .dug, + :: with '.' separators every .gop digits. + :: + :: - .hol is processed least-significant digit first + :: - .dug handles individual digits, output is prepended + :: - every segment but the last is zero-padded to .gop + :: + ++ ox-co + |= [[bas=@ gop=@] dug=$-(@ @)] + %+ em-co + [(pow bas gop) 0] + |= [top=? seg=@ res=tape] + %+ weld + ?:(top ~ `tape`['.' ~]) + %. seg + %+ em-co(rep res) + [bas ?:(top 0 gop)] + |=([? b=@ c=tape] [(dug b) c]) + :: + :: +ro-co: format '.'-prefixed bloqs in numeric base + :: + :: in .bas, for .buz bloqs 0 to .dop, format at least one + :: digit of .hol, prefixed with '.' + :: + :: - used only for @i* addresses + :: + ++ ro-co + |= [[buz=@ bas=@ dop=@] dug=$-(@ @)] + |= hol=@ + ^- tape + ?: =(0 dop) + rep + :- '.' + =/ pod (dec dop) + %. (cut buz [pod 1] hol) + %+ em-co(rep $(dop pod)) + [bas 1] + |=([? b=@ c=tape] [(dug b) c]) + -- +:: +:: 4l: atom parsing ++| %atom-parsing +:: +++ so + ~% %so + ~ + |% + ++ bisk + ~+ + ;~ pose + ;~ pfix (just '0') + ;~ pose + (stag %ub ;~(pfix (just 'b') bay:ag)) + (stag %uc ;~(pfix (just 'c') fim:ag)) + (stag %ui ;~(pfix (just 'i') dim:ag)) + (stag %ux ;~(pfix (just 'x') hex:ag)) + (stag %uv ;~(pfix (just 'v') viz:ag)) + (stag %uw ;~(pfix (just 'w') wiz:ag)) + == + == + (stag %ud dem:ag) + == + ++ crub + ~+ + ;~ pose + (cook |=(det=date `dime`[%da (year det)]) when) + :: + %+ cook + |= [a=(list [p=?(%d %h %m %s) q=@]) b=(list @)] + =+ rop=`tarp`[0 0 0 0 b] + |- ^- dime + ?~ a + [%dr (yule rop)] + ?- p.i.a + %d $(a t.a, d.rop (add q.i.a d.rop)) + %h $(a t.a, h.rop (add q.i.a h.rop)) + %m $(a t.a, m.rop (add q.i.a m.rop)) + %s $(a t.a, s.rop (add q.i.a s.rop)) + == + ;~ plug + %+ most + dot + ;~ pose + ;~(pfix (just 'd') (stag %d dim:ag)) + ;~(pfix (just 'h') (stag %h dim:ag)) + ;~(pfix (just 'm') (stag %m dim:ag)) + ;~(pfix (just 's') (stag %s dim:ag)) + == + ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~)) + == + :: + (stag %p fed:ag) + ;~(pfix dot (stag %ta urs:ab)) + ;~(pfix sig (stag %t urx:ab)) + ;~(pfix hep (stag %c (cook taft urx:ab))) + == + ++ nuck + ~/ %nuck |= a=nail %. a + %+ knee *coin |. ~+ + %- stew + ^. stet ^. limo + :~ :- ['a' 'z'] (cook |=(a=@ta [%$ %tas a]) sym) + :- ['0' '9'] (stag %$ bisk) + :- '-' (stag %$ tash) + :- '.' ;~(pfix dot perd) + :- '~' ;~(pfix sig ;~(pose twid (easy [%$ %n 0]))) + == + ++ nusk + ~+ + :(sear |=(a=@ta (rush a nuck)) wick urt:ab) + ++ perd + ~+ + ;~ pose + (stag %$ zust) + (stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk))) + == + ++ royl + ~+ + ;~ pose + (stag %rh royl-rh) + (stag %rq royl-rq) + (stag %rd royl-rd) + (stag %rs royl-rs) + == + :: + ++ royl-rh (cook rylh ;~(pfix ;~(plug sig sig) (cook royl-cell royl-rn))) + ++ royl-rq (cook rylq ;~(pfix ;~(plug sig sig sig) (cook royl-cell royl-rn))) + ++ royl-rd (cook ryld ;~(pfix sig (cook royl-cell royl-rn))) + ++ royl-rs (cook ryls (cook royl-cell royl-rn)) + :: + ++ royl-rn + =/ moo + |= a=tape + :- (lent a) + (scan a (bass 10 (plus sid:ab))) + ;~ pose + ;~ plug + (easy %d) + ;~(pose (cold | hep) (easy &)) + ;~ plug dim:ag + ;~ pose + ;~(pfix dot (cook moo (plus (shim '0' '9')))) + (easy [0 0]) + == + ;~ pose + ;~ pfix + (just 'e') + ;~(plug ;~(pose (cold | hep) (easy &)) dim:ag) + == + (easy [& 0]) + == + == + == + :: + ;~ plug + (easy %i) + ;~ sfix + ;~(pose (cold | hep) (easy &)) + (jest 'inf') + == + == + :: + ;~ plug + (easy %n) + (cold ~ (jest 'nan')) + == + == + :: + ++ royl-cell + |= rn + ^- dn + ?. ?=([%d *] +<) +< + =+ ^= h + (dif:si (new:si f.b i.b) (sun:si d.b)) + [%d a h (add (mul c.b (pow 10 d.b)) e.b)] + :: + ++ tash + ~+ + =+ ^= neg + |= [syn=? mol=dime] ^- dime + ?> =('u' (end 3 p.mol)) + [(cat 3 's' (rsh 3 p.mol)) (new:si syn q.mol)] + ;~ pfix hep + ;~ pose + (cook |=(a=dime (neg | a)) bisk) + ;~(pfix hep (cook |=(a=dime (neg & a)) bisk)) + == + == + :: + ++ twid + ~+ + ;~ pose + %+ stag %blob + %+ sear |=(a=@ (mole |.((cue a)))) + ;~(pfix (just '0') vum:ag) + :: + (stag %$ crub) + == + :: + ++ when + ~+ + ;~ plug + %+ cook + |=([a=@ b=?] [b a]) + ;~(plug dim:ag ;~(pose (cold | hep) (easy &))) + ;~(pfix dot mot:ag) :: month + ;~(pfix dot dip:ag) :: day + ;~ pose + ;~ pfix + ;~(plug dot dot) + ;~ plug + dum:ag + ;~(pfix dot dum:ag) + ;~(pfix dot dum:ag) + ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~)) + == + == + (easy [0 0 0 ~]) + == + == + :: + ++ zust + ~+ + ;~ pose + (stag %is bip:ag) + (stag %if lip:ag) + royl + (stag %f ;~(pose (cold & (just 'y')) (cold | (just 'n')))) + (stag %q ;~(pfix sig feq:ag)) + == + -- +:: +:: 4m: formatting functions ++| %formatting-functions +++ scot + ~/ %scot + |=(mol=dime ~(rent co %$ mol)) +++ scow + ~/ %scow + |=(mol=dime ~(rend co %$ mol)) +++ slat |=(mod=@tas |=(txt=@ta (slaw mod txt))) +++ slav |=([mod=@tas txt=@ta] (need (slaw mod txt))) +++ slaw + ~/ %slaw + |= [mod=@tas txt=@ta] + ^- (unit @) + ?+ mod + :: slow fallback case to the full slay + :: + =+ con=(slay txt) + ?.(&(?=([~ %$ @ @] con) =(p.p.u.con mod)) ~ [~ q.p.u.con]) + :: + %da + (rush txt ;~(pfix sig (cook year when:so))) + :: + %p + (rush txt ;~(pfix sig fed:ag)) + :: + %ud + (rush txt dem:ag) + :: + %ux + (rush txt ;~(pfix (jest '0x') hex:ag)) + :: + %uv + (rush txt ;~(pfix (jest '0v') viz:ag)) + :: + %ta + (rush txt ;~(pfix ;~(plug sig dot) urs:ab)) + :: + %tas + (rush txt sym) + == +:: +++ slay + |= txt=@ta ^- (unit coin) + =+ ^= vex + ?: (gth 0x7fff.ffff txt) :: XX petty cache + ~+ ((full nuck:so) [[1 1] (trip txt)]) + ((full nuck:so) [[1 1] (trip txt)]) + ?~ q.vex + ~ + [~ p.u.q.vex] +:: +++ smyt :: pretty print path + |= bon=path ^- tank + :+ %rose [['/' ~] ['/' ~] ~] + (turn bon |=(a=@ [%leaf (trip a)])) +:: +++ spat |=(pax=path (crip (spud pax))) :: render path to cord +++ spud |=(pax=path ~(ram re (smyt pax))) :: render path to tape +++ stab |=(zep=@t `path`(rash zep stap)) :: parse cord to path +++ stap :: path parser + %+ sear + |= p=path + ^- (unit path) + ?: ?=([~ ~] p) `~ + ?. =(~ (rear p)) `p + ~ + ;~(pfix fas (most fas urs:ab)) +:: +++ stip :: typed path parser + =< swot + |% + ++ swot |=(n=nail (;~(pfix fas (more fas spot)) n)) + :: + ++ spot + %+ sear (soft iota) + =- ;~(pose - (easy %$)) + %- stew + ^. stet ^. limo + :~ :- 'a'^'z' sym + :- '$' (cold %$ buc) + :- '0'^'9' bisk:so + :- '-' tash:so + :- '.' ;~(pfix dot zust:so) + :- '~' ;~(pfix sig ;~(pose crub:so (easy [%n ~]))) + :- '\'' (stag %t qut) + == + -- +:: +++ pout + |= =pith + ^- path + %+ turn pith + |= i=iota + ?@(i i (scot i)) +:: +++ pave + |= =path + ^- pith + %+ turn path + |= i=@ta + (fall (rush i spot:stip) [%ta i]) +:: +:: 4n: virtualization ++| %virtualization +:: +:: +mack: untyped, scry-less, unitary virtualization +:: +++ mack + |= [sub=* fol=*] + ^- (unit) + =/ ton (mink [sub fol] ~) + ?.(?=(%0 -.ton) ~ `product.ton) +:: +mink: raw virtual nock +:: +++ mink !. + ~/ %mink + |= $: [subject=* formula=*] + scry=$@(~ $-(^ (unit (unit)))) + == + =| trace=(list [@ta *]) + |^ ^- tone + ?+ formula [%2 trace] + [^ *] + =/ head $(formula -.formula) + ?. ?=(%0 -.head) head + =/ tail $(formula +.formula) + ?. ?=(%0 -.tail) tail + [%0 product.head product.tail] + :: + [%0 axis=@] + =/ part (frag axis.formula subject) + ?~ part [%2 trace] + [%0 u.part] + :: + [%1 constant=*] + [%0 constant.formula] + :: + [%2 subject=* formula=*] + =/ subject $(formula subject.formula) + ?. ?=(%0 -.subject) subject + =/ formula $(formula formula.formula) + ?. ?=(%0 -.formula) formula + %= $ + subject product.subject + formula product.formula + == + :: + [%3 argument=*] + =/ argument $(formula argument.formula) + ?. ?=(%0 -.argument) argument + [%0 .?(product.argument)] + :: + [%4 argument=*] + =/ argument $(formula argument.formula) + ?. ?=(%0 -.argument) argument + ?^ product.argument [%2 trace] + [%0 .+(product.argument)] + :: + [%5 a=* b=*] + =/ a $(formula a.formula) + ?. ?=(%0 -.a) a + =/ b $(formula b.formula) + ?. ?=(%0 -.b) b + [%0 =(product.a product.b)] + :: + [%6 test=* yes=* no=*] + =/ result $(formula test.formula) + ?. ?=(%0 -.result) result + ?+ product.result + [%2 trace] + %& $(formula yes.formula) + %| $(formula no.formula) + == + :: + [%7 subject=* next=*] + =/ subject $(formula subject.formula) + ?. ?=(%0 -.subject) subject + %= $ + subject product.subject + formula next.formula + == + :: + [%8 head=* next=*] + =/ head $(formula head.formula) + ?. ?=(%0 -.head) head + %= $ + subject [product.head subject] + formula next.formula + == + :: + [%9 axis=@ core=*] + =/ core $(formula core.formula) + ?. ?=(%0 -.core) core + =/ arm (frag axis.formula product.core) + ?~ arm [%2 trace] + %= $ + subject product.core + formula u.arm + == + :: + [%10 [axis=@ value=*] target=*] + ?: =(0 axis.formula) [%2 trace] + =/ target $(formula target.formula) + ?. ?=(%0 -.target) target + =/ value $(formula value.formula) + ?. ?=(%0 -.value) value + =/ mutant=(unit *) + (edit axis.formula product.target product.value) + ?~ mutant [%2 trace] + [%0 u.mutant] + :: + [%11 tag=@ next=*] + =/ next $(formula next.formula) + ?. ?=(%0 -.next) next + :- %0 + .* subject + [11 tag.formula 1 product.next] + :: + [%11 [tag=@ clue=*] next=*] + =/ clue $(formula clue.formula) + ?. ?=(%0 -.clue) clue + =/ next + =? trace + ?=(?(%hunk %hand %lose %mean %spot) tag.formula) + [[tag.formula product.clue] trace] + $(formula next.formula) + ?. ?=(%0 -.next) next + :- %0 + .* subject + [11 [tag.formula 1 product.clue] 1 product.next] + :: + [%12 ref=* path=*] + =/ ref $(formula ref.formula) + ?. ?=(%0 -.ref) ref + =/ path $(formula path.formula) + ?. ?=(%0 -.path) path + ?~ scry [%2 trace] + =/ result (scry product.ref product.path) + ?~ result + [%1 product.path] + ?~ u.result + [%2 [%hunk product.ref product.path] trace] + [%0 u.u.result] + == + :: + ++ frag + |= [axis=@ noun=*] + ^- (unit) + ?: =(0 axis) ~ + |- ^- (unit) + ?: =(1 axis) `noun + ?@ noun ~ + =/ pick (cap axis) + %= $ + axis (mas axis) + noun ?-(pick %2 -.noun, %3 +.noun) + == + :: + ++ edit + |= [axis=@ target=* value=*] + ^- (unit) + ?: =(1 axis) `value + ?@ target ~ + =/ pick (cap axis) + =/ mutant + %= $ + axis (mas axis) + target ?-(pick %2 -.target, %3 +.target) + == + ?~ mutant ~ + ?- pick + %2 `[u.mutant +.target] + %3 `[-.target u.mutant] + == + -- +:: +mock: virtual nock +:: +++ mock + |= [[sub=* fol=*] gul=$@(~ $-(^ (unit (unit))))] + (mook (mink [sub fol] gul)) +:: +mook: convert %tone to %toon, rendering stack frames +:: +++ mook + |= ton=tone + ^- toon + ?. ?=([%2 *] ton) + ton + |^ [%2 (turn skip rend)] + :: + ++ skip + ^+ trace.ton + =/ yel (lent trace.ton) + ?. (gth yel 1.024) trace.ton + %+ weld + (scag 512 trace.ton) + ^+ trace.ton + :_ (slag (sub yel 512) trace.ton) + :- %lose + (crip "[skipped {(scow %ud (sub yel 1.024))} frames]") + :: + :: +rend: raw stack frame to tank + :: + :: $% [%hunk ref=* path] :: failed scry ([~ ~]) + :: [%lose cord] :: skipped frames + :: [%hand *] :: mug any + :: [%mean $@(cord (trap tank))] :: ~_ et al + :: [%spot spot] :: source location + :: == + :: + ++ rend + |= [tag=@ta dat=*] + ^- tank + ?+ tag + :: + leaf+"mook.{(rip 3 tag)}" + :: + %hunk + ?@ dat leaf+"mook.hunk" + =/ sof=(unit path) ((soft path) +.dat) + ?~ sof leaf+"mook.hunk" + (smyt u.sof) + :: + %lose + ?^ dat leaf+"mook.lose" + leaf+(rip 3 dat) + :: + %hand + leaf+(scow %p (mug dat)) + :: + %mean + ?@ dat leaf+(rip 3 dat) + =/ mac (mack dat -.dat) + ?~ mac leaf+"####" + =/ sof ((soft tank) u.mac) + ?~ sof leaf+"mook.mean" + u.sof + :: + %spot + =/ sof=(unit spot) ((soft spot) dat) + ?~ sof leaf+"mook.spot" + :+ %rose [":" ~ ~] + :~ (smyt p.u.sof) + =* l p.q.u.sof + =* r q.q.u.sof + =/ ud |=(a=@u (scow %ud a)) + leaf+"<[{(ud p.l)} {(ud q.l)}].[{(ud p.r)} {(ud q.r)}]>" + == + == + -- +:: +mong: virtual slam +:: +++ mong + |= [[gat=* sam=*] gul=$-(^ (unit (unit)))] + ^- toon + ?. ?=([* ^] gat) [%2 ~] + (mock [gat(+< sam) %9 2 %0 1] gul) +:: +slum: slam a gate on a sample using raw nock, untyped +:: +++ slum + ~/ %slum + |= sub=[gat=* sam=*] + .*(sub [%9 2 %10 [6 %0 3] %0 2]) +:: +soft: virtual clam +:: +++ soft + |* han=$-(* *) + |=(fud=* (mole |.((han fud)))) +:: +vi: virtualization engine +:: +++ vi + ~% %vi ..vi + == + %mure mure + %mute mute + == + :: forward namespace? + :: + |_ for=? + :: +mole: typed unitary virtual + :: + ++ mole + ~/ %mole + |* tap=(trap) + ^- (unit _$:tap) + =/ mur (mure tap) + ?~(mur ~ `$:tap) + :: +mule: typed virtual + :: + ++ mule + ~/ %mule + |* tap=(trap) + =/ mud (mute tap) + ?- -.mud + %& [%& p=$:tap] + %| [%| p=p.mud] + == + :: +mure: untyped unitary virtual + :: + ++ mure + |= tap=(trap) + ^- (unit) + =/ gul + ?. for ~ + => ~ + |=(a=^ ``.*(a 12+[0+2 0+3])) + :: + =/ ton (mink [tap %9 2 %0 1] gul) + ?.(?=(%0 -.ton) ~ `product.ton) + :: +mute: untyped virtual + :: + ++ mute + |= tap=(trap) + ^- (each * (list tank)) + =/ gul + ?. for ~ + => ~ + |=(a=^ ``.*(a 12+[0+2 0+3])) + :: + =/ ton (mock [tap %9 2 %0 1] gul) + ?- -.ton + %0 [%& p.ton] + :: + %1 =/ sof=(unit path) ((soft path) p.ton) + [%| ?~(sof leaf+"mute.hunk" (smyt u.sof)) ~] + :: + %2 [%| p.ton] + == + -- +:: aliases +:: +++ mole mole:vi +++ mule mule:vi +:: +:: 4o: molds and mold builders ++| %molds-and-mold-builders +:: ++$ abel typo :: original sin: type ++$ alas (list (pair term hoon)) :: alias list ++$ atom @ :: just an atom ++$ aura @ta :: atom format ++$ base :: base mold + $@ $? %noun :: any noun + %cell :: any cell + %flag :: loobean + %null :: ~ == 0 + %void :: empty set + == :: + [%atom p=aura] :: atom +:: ++$ woof $@(@ [~ p=hoon]) :: simple embed ++$ chum $? lef=term :: jet name + [std=term kel=@] :: kelvin version + [ven=term pro=term kel=@] :: vendor and product + [ven=term pro=term ver=@ kel=@] :: all of the above + == :: ++$ coil $: p=garb :: name, wet=dry, vary + q=type :: context + r=(pair seminoun (map term tome)) :: chapters + == :: ++$ garb (trel (unit term) poly vair) :: core ++$ poly ?(%wet %dry) :: polarity ++$ foot $% [%dry p=hoon] :: dry arm, geometric + [%wet p=hoon] :: wet arm, generic + == :: ++$ link :: lexical segment + $% [%chat p=term] :: |chapter + [%cone p=aura q=atom] :: %constant + [%frag p=term] :: .face + [%funk p=term] :: +arm + [%plan p=term] :: $spec + == :: ++$ cuff (list link) :: parsed lex segments ++$ crib [summary=cord details=(list sect)] :: ++$ help [=cuff =crib] :: documentation ++$ limb $@ term :: wing element + $% [%& p=axis] :: by geometry + [%| p=@ud q=(unit term)] :: by name + == :: + :: XX more and better sanity + :: ++$ null ~ :: null, nil, etc ++$ onyx (list (pair type foot)) :: arm activation ++$ opal :: limb match + $% [%& p=type] :: leg + [%| p=axis q=(set [p=type q=foot])] :: arm + == :: ++$ pica (pair ? cord) :: & prose, | code ++$ palo (pair vein opal) :: wing trace, match ++$ pock (pair axis nock) :: changes ++$ port (each palo (pair type nock)) :: successful match ++$ spec :: structure definition + $~ [%base %null] :: + $% [%base p=base] :: base type + [%dbug p=spot q=spec] :: set debug + [%gist p=[%help p=help] q=spec] :: formal comment + [%leaf p=term q=@] :: constant atom + [%like p=wing q=(list wing)] :: reference + [%loop p=term] :: hygienic reference + [%made p=(pair term (list term)) q=spec] :: annotate synthetic + [%make p=hoon q=(list spec)] :: composed spec + [%name p=term q=spec] :: annotate simple + [%over p=wing q=spec] :: relative to subject + :: :: + [%bcgr p=spec q=spec] :: $>, filter: require + [%bcbc p=spec q=(map term spec)] :: $$, recursion + [%bcbr p=spec q=hoon] :: $|, verify + [%bccb p=hoon] :: $_, example + [%bccl p=[i=spec t=(list spec)]] :: $:, tuple + [%bccn p=[i=spec t=(list spec)]] :: $%, head pick + [%bcdt p=spec q=(map term spec)] :: $., read-write core + [%bcgl p=spec q=spec] :: $<, filter: exclude + [%bchp p=spec q=spec] :: $-, function core + [%bckt p=spec q=spec] :: $^, cons pick + [%bcls p=stud q=spec] :: $+, standard + [%bcfs p=spec q=(map term spec)] :: $/, write-only core + [%bcmc p=hoon] :: $;, manual + [%bcpm p=spec q=hoon] :: $&, repair + [%bcsg p=hoon q=spec] :: $~, default + [%bctc p=spec q=(map term spec)] :: $`, read-only core + [%bcts p=skin q=spec] :: $=, name + [%bcpt p=spec q=spec] :: $@, atom pick + [%bcwt p=[i=spec t=(list spec)]] :: $?, full pick + [%bczp p=spec q=(map term spec)] :: $!, opaque core + == :: ++$ tent :: model builder + $% [%| p=wing q=tent r=(list spec)] :: ~(p q r...) + [%& p=(list wing)] :: a.b:c.d + == :: ++$ tiki :: test case + $% [%& p=(unit term) q=wing] :: simple wing + [%| p=(unit term) q=hoon] :: named wing + == :: ++$ skin :: texture + $@ =term :: name/~[term %none] + $% [%base =base] :: base match + [%cell =skin =skin] :: pair + [%dbug =spot =skin] :: trace + [%leaf =aura =atom] :: atomic constant + [%help =help =skin] :: describe + [%name =term =skin] :: apply label + [%over =wing =skin] :: relative to + [%spec =spec =skin] :: cast to + [%wash depth=@ud] :: strip faces + == :: ++$ tome (pair what (map term hoon)) :: core chapter ++$ tope :: topographic type + $@ $? %& :: cell or atom + %| :: atom + == :: + (pair tope tope) :: cell +++ hoot :: hoon tools + |% + +$ beer $@(char [~ p=hoon]) :: simple embed + +$ mane $@(@tas [@tas @tas]) :: XML name+space + +$ manx $~([[%$ ~] ~] [g=marx c=marl]) :: dynamic XML node + +$ marl (list tuna) :: dynamic XML nodes + +$ mart (list [n=mane v=(list beer)]) :: dynamic XML attrs + +$ marx $~([%$ ~] [n=mane a=mart]) :: dynamic XML tag + +$ mare (each manx marl) :: node or nodes + +$ maru (each tuna marl) :: interp or nodes + +$ tuna :: maybe interpolation + $~ [[%$ ~] ~] + $^ manx + $: ?(%tape %manx %marl %call) + p=hoon + == + -- :: ++$ hoon :: hoon AST + $+ hoon + $~ [%zpzp ~] :: + $^ [p=hoon q=hoon] :: + $% :: + [%$ p=axis] :: simple leg + :: :: + [%base p=base] :: base spec + [%bust p=base] :: bunt base + [%dbug p=spot q=hoon] :: debug info in trace + [%eror p=tape] :: assembly error + [%hand p=type q=nock] :: premade result + [%note p=note q=hoon] :: annotate + [%fits p=hoon q=wing] :: underlying ?= + [%knit p=(list woof)] :: assemble string + [%leaf p=(pair term @)] :: symbol spec + [%limb p=term] :: take limb + [%lost p=hoon] :: not to be taken + [%rock p=term q=*] :: fixed constant + [%sand p=term q=*] :: unfixed constant + [%tell p=(list hoon)] :: render as tape + [%tune p=$@(term tune)] :: minimal face + [%wing p=wing] :: take wing + [%yell p=(list hoon)] :: render as tank + [%xray p=manx:hoot] :: ;foo; templating + :: :::::: cores + [%brbc sample=(lest term) body=spec] :: |$ + [%brcb p=spec q=alas r=(map term tome)] :: |_ + [%brcl p=hoon q=hoon] :: |: + [%brcn p=(unit term) q=(map term tome)] :: |% + [%brdt p=hoon] :: |. + [%brkt p=hoon q=(map term tome)] :: |^ + [%brhp p=hoon] :: |- + [%brsg p=spec q=hoon] :: |~ + [%brtr p=spec q=hoon] :: |* + [%brts p=spec q=hoon] :: |= + [%brpt p=(unit term) q=(map term tome)] :: |@ + [%brwt p=hoon] :: |? + :: :::::: tuples + [%clcb p=hoon q=hoon] :: :_ [q p] + [%clkt p=hoon q=hoon r=hoon s=hoon] :: :^ [p q r s] + [%clhp p=hoon q=hoon] :: :- [p q] + [%clls p=hoon q=hoon r=hoon] :: :+ [p q r] + [%clsg p=(list hoon)] :: :~ [p ~] + [%cltr p=(list hoon)] :: :* p as a tuple + :: :::::: invocations + [%cncb p=wing q=(list (pair wing hoon))] :: %_ + [%cndt p=hoon q=hoon] :: %. + [%cnhp p=hoon q=hoon] :: %- + [%cncl p=hoon q=(list hoon)] :: %: + [%cntr p=wing q=hoon r=(list (pair wing hoon))] :: %* + [%cnkt p=hoon q=hoon r=hoon s=hoon] :: %^ + [%cnls p=hoon q=hoon r=hoon] :: %+ + [%cnsg p=wing q=hoon r=(list hoon)] :: %~ + [%cnts p=wing q=(list (pair wing hoon))] :: %= + :: :::::: nock + [%dtkt p=spec q=hoon] :: .^ nock 11 + [%dtls p=hoon] :: .+ nock 4 + [%dttr p=hoon q=hoon] :: .* nock 2 + [%dtts p=hoon q=hoon] :: .= nock 5 + [%dtwt p=hoon] :: .? nock 3 + :: :::::: type conversion + [%ktbr p=hoon] :: ^| contravariant + [%ktdt p=hoon q=hoon] :: ^. self-cast + [%ktls p=hoon q=hoon] :: ^+ expression cast + [%kthp p=spec q=hoon] :: ^- structure cast + [%ktpm p=hoon] :: ^& covariant + [%ktsg p=hoon] :: ^~ constant + [%ktts p=skin q=hoon] :: ^= label + [%ktwt p=hoon] :: ^? bivariant + [%kttr p=spec] :: ^* example + [%ktcl p=spec] :: ^: filter + :: :::::: hints + [%sgbr p=hoon q=hoon] :: ~| sell on trace + [%sgcb p=hoon q=hoon] :: ~_ tank on trace + [%sgcn p=chum q=hoon r=tyre s=hoon] :: ~% general jet hint + [%sgfs p=chum q=hoon] :: ~/ function j-hint + [%sggl p=$@(term [p=term q=hoon]) q=hoon] :: ~< backward hint + [%sggr p=$@(term [p=term q=hoon]) q=hoon] :: ~> forward hint + [%sgbc p=term q=hoon] :: ~$ profiler hit + [%sgls p=@ q=hoon] :: ~+ cache=memoize + [%sgpm p=@ud q=hoon r=hoon] :: ~& printf=priority + [%sgts p=hoon q=hoon] :: ~= don't duplicate + [%sgwt p=@ud q=hoon r=hoon s=hoon] :: ~? tested printf + [%sgzp p=hoon q=hoon] :: ~! type on trace + :: :::::: miscellaneous + [%mcts p=marl:hoot] :: ;= list templating + [%mccl p=hoon q=(list hoon)] :: ;: binary to nary + [%mcfs p=hoon] :: ;/ [%$ [%$ p ~] ~] + [%mcgl p=spec q=hoon r=hoon s=hoon] :: ;< bind + [%mcsg p=hoon q=(list hoon)] :: ;~ kleisli arrow + [%mcmc p=spec q=hoon] :: ;; normalize + :: :::::: compositions + [%tsbr p=spec q=hoon] :: =| push bunt + [%tscl p=(list (pair wing hoon)) q=hoon] :: =: q w= p changes + [%tsfs p=skin q=hoon r=hoon] :: =/ typed variable + [%tsmc p=skin q=hoon r=hoon] :: =; =/(q p r) + [%tsdt p=wing q=hoon r=hoon] :: =. r with p as q + [%tswt p=wing q=hoon r=hoon s=hoon] :: =? conditional =. + [%tsgl p=hoon q=hoon] :: =< =>(q p) + [%tshp p=hoon q=hoon] :: =- =+(q p) + [%tsgr p=hoon q=hoon] :: => q w=subject p + [%tskt p=skin q=wing r=hoon s=hoon] :: =^ state machine + [%tsls p=hoon q=hoon] :: =+ q w=[p subject] + [%tssg p=(list hoon)] :: =~ hoon stack + [%tstr p=(pair term (unit spec)) q=hoon r=hoon] :: =* new style + [%tscm p=hoon q=hoon] :: =, overload p in q + :: :::::: conditionals + [%wtbr p=(list hoon)] :: ?| loobean or + [%wthp p=wing q=(list (pair spec hoon))] :: ?- pick case in q + [%wtcl p=hoon q=hoon r=hoon] :: ?: if=then=else + [%wtdt p=hoon q=hoon r=hoon] :: ?. ?:(p r q) + [%wtkt p=wing q=hoon r=hoon] :: ?^ if p is a cell + [%wtgl p=hoon q=hoon] :: ?< ?:(p !! q) + [%wtgr p=hoon q=hoon] :: ?> ?:(p q !!) + [%wtls p=wing q=hoon r=(list (pair spec hoon))] :: ?+ ?- w=default + [%wtpm p=(list hoon)] :: ?& loobean and + [%wtpt p=wing q=hoon r=hoon] :: ?@ if p is atom + [%wtsg p=wing q=hoon r=hoon] :: ?~ if p is null + [%wthx p=skin q=wing] :: ?# if q matches p + [%wtts p=spec q=wing] :: ?= if q matches p + [%wtzp p=hoon] :: ?! loobean not + :: :::::: special + [%zpcm p=hoon q=hoon] :: !, + [%zpgr p=hoon] :: !> + [%zpgl p=spec q=hoon] :: !< + [%zpmc p=hoon q=hoon] :: !; + [%zpts p=hoon] :: != + [%zppt p=(list wing) q=hoon r=hoon] :: !@ + [%zpwt p=$@(p=@ [p=@ q=@]) q=hoon] :: !? + [%zpzp ~] :: !! + == :: ++$ tyre (list [p=term q=hoon]) :: ++$ tyke (list (unit hoon)) :: +:: :::::: virtual nock ++$ nock $^ [p=nock q=nock] :: autocons + $% [%1 p=*] :: constant + [%2 p=nock q=nock] :: compose + [%3 p=nock] :: cell test + [%4 p=nock] :: increment + [%5 p=nock q=nock] :: equality test + [%6 p=nock q=nock r=nock] :: if, then, else + [%7 p=nock q=nock] :: serial compose + [%8 p=nock q=nock] :: push onto subject + [%9 p=@ q=nock] :: select arm and fire + [%10 p=[p=@ q=nock] q=nock] :: edit + [%11 p=$@(@ [p=@ q=nock]) q=nock] :: hint + [%12 p=nock q=nock] :: grab data from sky + [%0 p=@] :: axis select + == :: ++$ note :: type annotation + $% [%help p=help] :: documentation + [%know p=stud] :: global standard + [%made p=term q=(unit (list wing))] :: structure + == :: ++$ type $+ type + $~ %noun :: + $@ $? %noun :: any nouns + %void :: no noun + == :: + $% [%atom p=term q=(unit @)] :: atom / constant + [%cell p=type q=type] :: ordered pair + [%core p=type q=coil] :: object + [%face p=$@(term tune) q=type] :: namespace + [%fork p=(set type)] :: union + [%hint p=(pair type note) q=type] :: annotation + [%hold p=type q=hoon] :: lazy evaluation + == :: ++$ tony :: ++tone done right + $% [%0 p=tine q=*] :: success + [%1 p=(set)] :: blocks + [%2 p=(list [@ta *])] :: error ~_s + == :: ++$ tine :: partial noun + $@ ~ :: open + $% [%& p=tine q=tine] :: half-blocked + [%| p=(set)] :: fully blocked + == :: ++$ tool $@(term tune) :: type decoration ++$ tune :: complex + $~ [~ ~] :: + $: p=(map term (unit hoon)) :: aliases + q=(list hoon) :: bridges + == :: ++$ typo type :: old type ++$ vase [p=type q=*] :: type-value pair ++$ vise [p=typo q=*] :: old vase ++$ vial ?(%read %rite %both %free) :: co/contra/in/bi ++$ vair ?(%gold %iron %lead %zinc) :: in/contra/bi/co ++$ vein (list (unit axis)) :: search trace ++$ sect (list pica) :: paragraph ++$ whit :: prefix docs parse + $: bat=(map cuff (pair cord (list sect))) :: batch comment + == :: ++$ whiz cord :: postfix doc parse ++$ what (unit (pair cord (list sect))) :: help slogan/section ++$ wing (list limb) :: search path +:: +:: +block: abstract identity of resource awaited +:: ++$ block + path +:: +:: +result: internal interpreter result +:: ++$ result + $@(~ seminoun) +:: +:: +thunk: fragment constructor +:: ++$ thunk + $-(@ud (unit noun)) +:: +:: +seminoun: +:: ++$ seminoun + :: partial noun; blocked subtrees are ~ + :: + $~ [[%full / ~ ~] ~] + [mask=stencil data=noun] +:: +:: +stencil: noun knowledge map +:: ++$ stencil + $% :: + :: %half: noun has partial block substructure + :: + [%half left=stencil rite=stencil] + :: + :: %full: noun is either fully complete, or fully blocked + :: + [%full blocks=(set block)] + :: + :: %lazy: noun can be generated from virtual subtree + :: + [%lazy fragment=axis resolve=thunk] + == +:: ++$ output + :: ~: interpreter stopped + :: + %- unit + $% :: + :: %done: output is complete + :: + [%done p=noun] + :: + :: %wait: output is waiting for resources + :: + [%wait p=(list block)] + == +:: profiling ++$ doss + $: mon=moan :: sample count + hit=(map term @ud) :: hit points + cut=(map path hump) :: cut points + == ++$ moan :: sample metric + $: fun=@ud :: samples in C + noc=@ud :: samples in nock + glu=@ud :: samples in glue + mal=@ud :: samples in alloc + far=@ud :: samples in frag + coy=@ud :: samples in copy + euq=@ud :: samples in equal + == :: +:: ++$ hump + $: mon=moan :: sample count + out=(map path @ud) :: calls out of + inn=(map path @ud) :: calls into + == +-- +:: +~% %pen + + + == + %ap ap + %ut ut + == +:: layer-5 +:: +|% +:: +:: 5aa: new partial nock interpreter ++| %new-partial-nock-interpreter +:: +++ musk !. :: nock with block set + |% + ++ abet + :: simplify raw result + :: + |= $: :: noy: raw result + :: + noy=result + == + ^- output + :: propagate stop + :: + ?~ noy ~ + :- ~ + :: merge all blocking sets + :: + =/ blocks (squash mask.noy) + ?: =(~ blocks) + :: no blocks, data is complete + :: + done/data.noy + :: reduce block set to block list + :: + wait/~(tap in blocks) + :: + ++ araw + :: execute nock on partial subject + :: + |= $: :: bus: subject, a partial noun + :: fol: formula, a complete noun + :: + bus=seminoun + fol=noun + == + :: interpreter loop + :: + |- ^- result + ?@ fol + :: bad formula, stop + :: + ~ + ?: ?=(^ -.fol) + :: hed: interpret head + :: + =+ hed=$(fol -.fol) + :: propagate stop + :: + ?~ hed ~ + :: tal: interpret tail + :: + =+ tal=$(fol +.fol) + :: propagate stop + :: + ?~ tal ~ + :: combine + :: + (combine hed tal) + ?+ fol + :: bad formula; stop + :: + ~ + :: 0; fragment + :: + [%0 b=@] + :: if bad axis, stop + :: + ?: =(0 b.fol) ~ + :: reduce to fragment + :: + (fragment b.fol bus) + :: + :: 1; constant + :: + [%1 b=*] + :: constant is complete + :: + [full/~ b.fol] + :: + :: 2; recursion + :: + [%2 b=* c=*] + :: require complete formula + :: + %+ require + :: compute formula with current subject + :: + $(fol c.fol) + |= :: ryf: next formula + :: + ryf=noun + :: lub: next subject + :: + =+ lub=^$(fol b.fol) + :: propagate stop + :: + ?~ lub ~ + :: recurse + :: + ^$(fol ryf, bus lub) + :: + :: 3; probe + :: + [%3 b=*] + %+ require + $(fol b.fol) + |= :: fig: probe input + :: + fig=noun + :: yes if cell, no if atom + :: + [full/~ .?(fig)] + :: + :: 4; increment + :: + [%4 b=*] + %+ require + $(fol b.fol) + |= :: fig: increment input + :: + fig=noun + :: stop for cells, increment for atoms + :: + ?^(fig ~ [full/~ +(fig)]) + :: + :: 5; compare + :: + [%5 b=* c=*] + %+ require + $(fol b.fol) + |= :: hed: left input + :: + hed=noun + %+ require + ^$(fol c.fol) + |= :: tal: right input + :: + tal=noun + [full/~ =(hed tal)] + :: + :: 6; if-then-else + :: + [%6 b=* c=* d=*] + :: semantic expansion + :: + %+ require + $(fol b.fol) + |= :: fig: boolean + :: + fig=noun + :: apply proper booleans + :: + ?: =(& fig) ^$(fol c.fol) + ?: =(| fig) ^$(fol d.fol) + :: stop on bad test + :: + ~ + :: + :: 7; composition + :: + [%7 b=* c=*] + :: one: input + :: + =+ one=$(fol b.fol) + :: propagate stop + :: + ?~ one ~ + :: complete composition + :: + $(fol c.fol, bus one) + :: + :: 8; introduction + :: + [%8 b=* c=*] + :: one: input + :: + =+ one=$(fol b.fol) + :: propagate stop + :: + ?~ one ~ + :: complete introduction + :: + $(fol c.fol, bus (combine one bus)) + :: + :: 9; invocation + :: + [%9 b=* c=*] + :: semantic expansion + :: + ?^ b.fol ~ + :: one: core + :: + =+ one=$(fol c.fol) + :: propagate stop + :: + ?~ one ~ + :: if core is constant + :: + ?: ?=([[%full ~] *] one) + :: then call virtual nock directly + :: + =+ (mack data.one [%9 b.fol %0 1]) + :: propagate stop + :: + ?~ - ~ + :: produce result + :: + [[%full ~] u.-] + :: else complete call + :: + %+ require + :: retrieve formula + :: + (fragment b.fol one) + :: continue + :: + |=(noun ^$(bus one, fol +<)) + :: + :: 10; edit + :: + [%10 [b=@ c=*] d=*] + :: tar: target of edit + :: + =+ tar=$(fol d.fol) + :: propagate stop + :: + ?~ tar ~ + :: inn: inner value + :: + =+ inn=$(fol c.fol) + :: propagate stop + :: + ?~ inn ~ + (mutate b.fol inn tar) + :: + :: 11; static hint + :: + [%11 @ c=*] + :: ignore hint + :: + $(fol c.fol) + :: + :: 11; dynamic hint + :: + [%11 [b=* c=*] d=*] + :: noy: dynamic hint + :: + =+ noy=$(fol c.fol) + :: propagate stop + :: + ?~ noy ~ + :: if hint is a fully computed trace + :: + ?: &(?=(%spot b.fol) ?=([[%full ~] *] noy)) + :: compute within trace + :: + ~_((show %o +.noy) $(fol d.fol)) + :: else ignore hint + :: + $(fol d.fol) + == + :: + ++ apex + :: execute nock on partial subject + :: + |= $: :: bus: subject, a partial noun + :: fol: formula, a complete noun + :: + bus=seminoun + fol=noun + == + ~+ + ^- output + :: simplify result + :: + (abet (araw bus fol)) + :: + ++ combine + :: combine a pair of seminouns + :: + |= $: :: hed: head of pair + :: tal: tail of pair + :: + hed=seminoun + tal=seminoun + == + ^- seminoun + ?. ?& &(?=(%full -.mask.hed) ?=(%full -.mask.tal)) + =(=(~ blocks.mask.hed) =(~ blocks.mask.tal)) + == + :: default merge + :: + [half/[mask.hed mask.tal] [data.hed data.tal]] + :: both sides total + :: + ?: =(~ blocks.mask.hed) + :: both sides are complete + :: + [full/~ data.hed data.tal] + :: both sides are blocked + :: + [full/(~(uni in blocks.mask.hed) blocks.mask.tal) ~] + :: + ++ complete + :: complete any laziness + :: + |= bus=seminoun + ^- seminoun + ?- -.mask.bus + %full bus + %lazy :: fragment 1 is the whole thing + :: + ?: =(1 fragment.mask.bus) + :: blocked; we can't get fragment 1 while compiling it + :: + [[%full [~ ~ ~]] ~] + :: execute thunk + :: + =+ (resolve.mask.bus fragment.mask.bus) + :: if product is nil + :: + ?~ - + :: then blocked + :: + [[%full [~ ~ ~]] ~] + :: else use value + :: + [[%full ~] u.-] + %half :: recursive descent + :: + %+ combine + $(bus [left.mask.bus -.data.bus]) + $(bus [rite.mask.bus +.data.bus]) + == + :: + ++ fragment + :: seek to an axis in a seminoun + :: + |= $: :: axe: tree address of subtree + :: bus: partial noun + :: + axe=axis + bus=seminoun + == + ^- result + :: 1 is the root + :: + ?: =(1 axe) bus + :: now: top of axis (2 or 3) + :: lat: rest of axis + :: + =+ [now=(cap axe) lat=(mas axe)] + ?- -.mask.bus + %lazy :: propagate laziness + :: + bus(fragment.mask (peg fragment.mask.bus axe)) + :: + %full :: if fully blocked, produce self + :: + ?^ blocks.mask.bus bus + :: descending into atom, stop + :: + ?@ data.bus ~ + :: descend into complete cell + :: + $(axe lat, bus [full/~ ?:(=(2 now) -.data.bus +.data.bus)]) + :: + %half :: descend into partial cell + :: + %= $ + axe lat + bus ?: =(2 now) + [left.mask.bus -.data.bus] + [rite.mask.bus +.data.bus] + == == + :: + ++ mutate + :: change a single axis in a seminoun + :: + |= $: :: axe: axis within big to change + :: lit: (little) seminoun to insert within big at axe + :: big: seminoun to mutate + :: + axe=@ + lit=seminoun + big=seminoun + == + ^- result + :: stop on zero axis + :: + ?~ axe ~ + :: edit root of big means discard it + :: + ?: =(1 axe) lit + :: decompose axis into path of head-tail + :: + |- ^- result + ?: =(2 axe) + :: mutate head of cell + :: + =+ tal=(fragment 3 big) + :: propagate stop + :: + ?~ tal ~ + (combine lit tal) + ?: =(3 axe) + :: mutate tail of cell + :: + =+ hed=(fragment 2 big) + :: propagate stop + :: + ?~ hed ~ + (combine hed lit) + :: deeper axis: keep one side of big and + :: recurse into the other with smaller axe + :: + =+ mor=(mas axe) + =+ hed=(fragment 2 big) + :: propagate stop + :: + ?~ hed ~ + =+ tal=(fragment 3 big) + :: propagate stop + :: + ?~ tal ~ + ?: =(2 (cap axe)) + :: recurse into the head + :: + =+ mut=$(big hed, axe mor) + :: propagate stop + :: + ?~ mut ~ + (combine mut tal) + :: recurse into the tail + :: + =+ mut=$(big tal, axe mor) + :: propagate stop + :: + ?~ mut ~ + (combine hed mut) + :: + ++ require + :: require complete intermediate step + :: + |= $: noy=result + yen=$-(* result) + == + ^- result + :: propagate stop + :: + ?~ noy ~ + :: suppress laziness + :: + =/ bus=seminoun (complete noy) + ?< ?=(%lazy -.mask.bus) + :: if partial block, squash blocks and stop + :: + ?: ?=(%half -.mask.bus) [full/(squash mask.bus) ~] + :: if full block, propagate block + :: + ?: ?=(^ blocks.mask.bus) [mask.bus ~] + :: otherwise use complete noun + :: + (yen data.bus) + :: + ++ squash + :: convert stencil to block set + :: + |= tyn=stencil + ^- (set block) + ?- -.tyn + %lazy $(tyn -:(complete tyn ~)) + %full blocks.tyn + %half (~(uni in $(tyn left.tyn)) $(tyn rite.tyn)) + == + -- +:: +:: 5a: compiler utilities ++| %compiler-utilities +:: +++ bool :: make loobean + ^- type + (fork [%atom %f `%.y] [%atom %f `%.n] ~) +:: +++ cell :: make %cell type + ~/ %cell + |= [hed=type tal=type] + ^- type + ?:(=(%void hed) %void ?:(=(%void tal) %void [%cell hed tal])) +:: +++ core :: make %core type + ~/ %core + |= [pac=type con=coil] + ^- type + ?:(=(%void pac) %void [%core pac con]) +:: +++ hint + |= [p=(pair type note) q=type] + ^- type + ?: =(%void q) %void + ?: =(%noun q) %noun + [%hint p q] +:: +++ face :: make %face type + ~/ %face + |= [giz=$@(term tune) der=type] + ^- type + ?: =(%void der) + %void + [%face giz der] +:: +++ fork :: make %fork type + ~/ %fork + |= yed=(list type) + =| lez=(set type) + |- ^- type + ?~ yed + ?~ lez %void + ?: ?=([* ~ ~] lez) n.lez + [%fork lez] + %= $ + yed t.yed + lez + ?: =(%void i.yed) lez + ?: ?=([%fork *] i.yed) (~(uni in lez) p.i.yed) + (~(put in lez) i.yed) + == +:: +++ cove :: extract [0 *] axis + |= nug=nock + ?- nug + [%0 *] p.nug + [%11 *] $(nug q.nug) + * ~_(leaf+"cove" !!) + == +++ comb :: combine two formulas + ~/ %comb + |= [mal=nock buz=nock] + ^- nock + ?: ?&(?=([%0 *] mal) !=(0 p.mal)) + ?: ?&(?=([%0 *] buz) !=(0 p.buz)) + [%0 (peg p.mal p.buz)] + ?: ?=([%2 [%0 *] [%0 *]] buz) + [%2 [%0 (peg p.mal p.p.buz)] [%0 (peg p.mal p.q.buz)]] + [%7 mal buz] + ?: ?=([^ [%0 %1]] mal) + [%8 p.mal buz] + ?: =([%0 %1] buz) + mal + [%7 mal buz] +:: +++ cond :: ?: compile + ~/ %cond + |= [pex=nock yom=nock woq=nock] + ^- nock + ?: =([%1 &] pex) yom + ?: =([%1 |] pex) woq + ?: =([%0 0] pex) pex + [%6 pex yom woq] +:: +++ cons :: make formula cell + ~/ %cons + |= [vur=nock sed=nock] + ^- nock + :: this optimization can remove crashes which are essential + :: + :: ?: ?=([[%0 *] [%0 *]] +<) + :: ?: ?&(=(+(p.vur) p.sed) =((div p.vur 2) (div p.sed 2))) + :: [%0 (div p.vur 2)] + :: [vur sed] + ?: ?=([[%1 *] [%1 *]] +<) + [%1 p.vur p.sed] + [vur sed] +:: +++ fitz :: odor compatibility + ~/ %fitz + |= [yaz=term wix=term] + =+ ^= fiz + |= mot=@ta ^- [p=@ q=@ta] + =+ len=(met 3 mot) + ?: =(0 len) + [0 %$] + =+ tyl=(rsh [3 (dec len)] mot) + ?: &((gte tyl 'A') (lte tyl 'Z')) + [(sub tyl 64) (end [3 (dec len)] mot)] + [0 mot] + =+ [yoz=(fiz yaz) wux=(fiz wix)] + ?& ?| =(0 p.yoz) + =(0 p.wux) + &(!=(0 p.wux) (lte p.wux p.yoz)) + == + |- ?| =(%$ q.yoz) + =(%$ q.wux) + ?& =((end 3 q.yoz) (end 3 q.wux)) + $(q.yoz (rsh 3 q.yoz), q.wux (rsh 3 q.wux)) + == + == + == +:: +++ flan :: loobean & + ~/ %flan + |= [bos=nock nif=nock] + ^- nock + ?: ?| =(bos nif) + =([%1 |] bos) + =([%1 &] nif) + =([%0 0] bos) + == + bos + ?: ?| =([%1 &] bos) + =([%1 |] nif) + =([%0 0] nif) + == + nif + [%6 bos nif [%1 |]] +:: +++ flip :: loobean negation + ~/ %flip + |= dyr=nock + ^- nock + ?: =([%1 &] dyr) [%1 |] + ?: =([%1 |] dyr) [%1 &] + ?: =([%0 0] dyr) dyr + [%6 dyr [%1 |] %1 &] +:: +++ flor :: loobean | + ~/ %flor + |= [bos=nock nif=nock] + ^- nock + ?: ?| =(bos nif) + =([%1 &] bos) + =([%1 |] nif) + =([%0 0] bos) + == + bos + ?: ?| =([%1 |] bos) + =([%1 &] nif) + =([%0 0] nif) + == + nif + [%6 bos [%1 &] nif] +:: +++ hike + ~/ %hike + |= [a=axis pac=(list (pair axis nock))] + |^ =/ rel=(map axis nock) (roll pac insert) + =/ ord=(list axis) (sort ~(tap in ~(key by rel)) gth) + |- ^- nock + ?~ ord + [%0 a] + =/ b=axis i.ord + =/ c=nock (~(got by rel) b) + =/ d=nock $(ord t.ord) + [%10 [b c] d] + :: + ++ contains + |= [container=axis contained=axis] + ^- ? + =/ big=@ (met 0 container) + =/ small=@ (met 0 contained) + ?: (lte small big) | + =/ dif=@ (sub small big) + =(container (rsh [0 dif] contained)) + :: + ++ parent + |= a=axis + `axis`(rsh 0 a) + :: + ++ sibling + |= a=axis + ^- axis + ?~ (mod a 2) + +(a) + (dec a) + :: + ++ insert + |= [e=[axe=axis fol=nock] n=(map axis nock)] + ^- (map axis nock) + ?: =/ a=axis axe.e + |- ^- ? + ?: =(1 a) | + ?: (~(has by n) a) + & + $(a (parent a)) + :: parent already in + n + =. n + :: remove children + %+ roll ~(tap by n) + |= [[axe=axis fol=nock] m=_n] + ?. (contains axe.e axe) m + (~(del by m) axe) + =/ sib (sibling axe.e) + =/ un (~(get by n) sib) + ?~ un (~(put by n) axe.e fol.e) + :: replace sibling with parent + %= $ + n (~(del by n) sib) + e :- (parent sib) + ?: (gth sib axe.e) + (cons fol.e u.un) + (cons u.un fol.e) + == + -- +:: +++ jock + |= rad=? + |= lot=coin ^- hoon + ?- -.lot + ~ + ?:(rad [%rock p.lot] [%sand p.lot]) + :: + %blob + ?: rad + [%rock %$ p.lot] + ?@(p.lot [%sand %$ p.lot] [$(p.lot -.p.lot) $(p.lot +.p.lot)]) + :: + %many + [%cltr (turn p.lot |=(a=coin ^$(lot a)))] + == +:: +++ look + ~/ %look + |= [cog=term dab=(map term hoon)] + =+ axe=1 + |- ^- (unit [p=axis q=hoon]) + ?- dab + ~ ~ + :: + [* ~ ~] + ?:(=(cog p.n.dab) [~ axe q.n.dab] ~) + :: + [* ~ *] + ?: =(cog p.n.dab) + [~ (peg axe 2) q.n.dab] + ?: (gor cog p.n.dab) + ~ + $(axe (peg axe 3), dab r.dab) + :: + [* * ~] + ?: =(cog p.n.dab) + [~ (peg axe 2) q.n.dab] + ?: (gor cog p.n.dab) + $(axe (peg axe 3), dab l.dab) + ~ + :: + [* * *] + ?: =(cog p.n.dab) + [~ (peg axe 2) q.n.dab] + ?: (gor cog p.n.dab) + $(axe (peg axe 6), dab l.dab) + $(axe (peg axe 7), dab r.dab) + == +:: +++ loot + ~/ %loot + |= [cog=term dom=(map term tome)] + =+ axe=1 + |- ^- (unit [p=axis q=hoon]) + ?- dom + ~ ~ + :: + [* ~ ~] + %+ bind (look cog q.q.n.dom) + |=((pair axis hoon) [(peg axe p) q]) + :: + [* ~ *] + =+ yep=(look cog q.q.n.dom) + ?^ yep + [~ (peg (peg axe 2) p.u.yep) q.u.yep] + $(axe (peg axe 3), dom r.dom) + :: + [* * ~] + =+ yep=(look cog q.q.n.dom) + ?^ yep + [~ (peg (peg axe 2) p.u.yep) q.u.yep] + $(axe (peg axe 3), dom l.dom) + :: + [* * *] + =+ yep=(look cog q.q.n.dom) + ?^ yep + [~ (peg (peg axe 2) p.u.yep) q.u.yep] + =+ pey=$(axe (peg axe 6), dom l.dom) + ?^ pey pey + $(axe (peg axe 7), dom r.dom) + == +:: +:: 5b: macro expansion ++| %macro-expansions +:: +++ ah :: tiki engine + |_ tik=tiki + ++ blue + |= gen=hoon + ^- hoon + ?. &(?=(%| -.tik) ?=(~ p.tik)) gen + [%tsgr [%$ 3] gen] + :: + ++ teal + |= mod=spec + ^- spec + ?: ?=(%& -.tik) mod + [%over [%& 3]~ mod] + :: + ++ tele + |= syn=skin + ^- skin + ?: ?=(%& -.tik) syn + [%over [%& 3]~ syn] + :: + ++ gray + |= gen=hoon + ^- hoon + ?- -.tik + %& ?~(p.tik gen [%tstr [u.p.tik ~] [%wing q.tik] gen]) + %| [%tsls ?~(p.tik q.tik [%ktts u.p.tik q.tik]) gen] + == + :: + ++ puce + ^- wing + ?- -.tik + %& ?~(p.tik q.tik [u.p.tik ~]) + %| [[%& 2] ~] + == + :: + ++ wthp |= opt=(list (pair spec hoon)) + %+ gray %wthp + [puce (turn opt |=([a=spec b=hoon] [a (blue b)]))] + ++ wtkt |=([sic=hoon non=hoon] (gray [%wtkt puce (blue sic) (blue non)])) + ++ wtls |= [gen=hoon opt=(list (pair spec hoon))] + %+ gray %wtls + [puce (blue gen) (turn opt |=([a=spec b=hoon] [a (blue b)]))] + ++ wtpt |=([sic=hoon non=hoon] (gray [%wtpt puce (blue sic) (blue non)])) + ++ wtsg |=([sic=hoon non=hoon] (gray [%wtsg puce (blue sic) (blue non)])) + ++ wthx |=(syn=skin (gray [%wthx (tele syn) puce])) + ++ wtts |=(mod=spec (gray [%wtts (teal mod) puce])) + -- +:: +++ ax + =+ :* :: .dom: axis to home + :: .hay: wing to home + :: .cox: hygienic context + :: .bug: debug annotations + :: .nut: annotations + :: .def: default expression + :: + dom=`axis`1 + hay=*wing + cox=*(map term spec) + bug=*(list spot) + nut=*(unit note) + def=*(unit hoon) + == + |_ mod=spec + :: + ++ autoname + :: derive name from spec + :: + |- ^- (unit term) + ?- -.mod + %base ?.(?=([%atom *] p.mod) ~ ?:(=(%$ p.p.mod) `%atom `p.p.mod)) + %dbug $(mod q.mod) + %gist $(mod q.mod) + %leaf `p.mod + %loop `p.mod + %like ?~(p.mod ~ ?^(i.p.mod ?:(?=(%& -.i.p.mod) ~ q.i.p.mod) `i.p.mod)) + %make ~(name ap p.mod) + %made $(mod q.mod) + %over $(mod q.mod) + %name $(mod q.mod) + :: + %bcbc $(mod p.mod) + %bcbr $(mod p.mod) + %bccb ~(name ap p.mod) + %bccl $(mod i.p.mod) + %bccn $(mod i.p.mod) + %bcdt ~ + %bcgl $(mod q.mod) + %bcgr $(mod q.mod) + %bchp $(mod p.mod) + %bckt $(mod q.mod) + %bcls $(mod q.mod) + %bcfs ~ + %bcmc ~(name ap p.mod) + %bcpm $(mod p.mod) + %bcsg $(mod q.mod) + %bctc ~ + %bcts $(mod q.mod) + %bcpt $(mod q.mod) + %bcwt $(mod i.p.mod) + %bczp ~ + == + :: + ++ function + :: construct a function example + :: + |= [fun=spec arg=spec] + ^- hoon + :: minimal context as subject + :: + :+ %tsgr + :: context is example of both specs + :: + [example:clear(mod fun) example:clear(mod arg)] + :: produce an %iron (contravariant) core + :: + :- %ktbr + :: make an actual gate + :: + :+ %brcl + [%$ 2] + [%$ 15] + :: + ++ interface + :: construct a core example + :: + |= [variance=vair payload=spec arms=(map term spec)] + ^- hoon + :: attach proper variance control + :: + =- ?- variance + %gold - + %lead [%ktwt -] + %zinc [%ktpm -] + %iron [%ktbr -] + == + ^- hoon + :+ %tsgr example:clear(mod payload) + :+ %brcn ~ + =- [[%$ ~ -] ~ ~] + %- ~(gas by *(map term hoon)) + %+ turn + ~(tap by arms) + |= [=term =spec] + :: + :: note that we *don't* make arm specs in an interface + :: hygienic -- we leave them in context, to support + :: maximum programmer flexibility + :: + [term example:clear(mod spec)] + :: + ++ home + :: express a hoon against the original subject + :: + |= gen=hoon + ^- hoon + =/ ,wing + ?: =(1 dom) + hay + (weld hay `wing`[[%& dom] ~]) + ?~ - gen + [%tsgr [%wing -] gen] + :: + ++ clear + :: clear annotations + ^+ . + .(bug ~, def ~, nut ~) + :: + ++ basal + :: example base case + :: + |= bas=base + ?- bas + :: + [%atom *] + :: we may want sped + :: + [%sand p.bas ?:(=(%da p.bas) ~2000.1.1 0)] + :: + %noun + :: raw nock produces noun type + :: + =+([%rock %$ 0] [%ktls [%dttr - - [%rock %$ 1]] -]) + :: + %cell + :: reduce to pair of nouns + :: + =+($(bas %noun) [- -]) + :: + %flag + :: comparison produces boolean type + :: + =+([%rock %$ 0] [%ktls [%dtts - -] -]) + :: + %null + [%rock %n 0] + :: + %void + [%zpzp ~] + == + :: + ++ unfold + |= [fun=hoon arg=(list spec)] + ^- hoon + [%cncl fun (turn arg |=(spec ktcl/+<))] + :: + ++ unreel + |= [one=wing res=(list wing)] + ^- hoon + ?~(res [%wing one] [%tsgl [%wing one] $(one i.res, res t.res)]) + :: + ++ descend + :: record an axis to original subject + :: + |= axe=axis + +>(dom (peg axe dom)) + :: + ++ decorate + :: apply documentation to expression + :: + |= gen=hoon + ^- hoon + =- ?~(nut - [%note u.nut -]) + |- + ?~(bug gen [%dbug i.bug $(bug t.bug)]) + :: + ++ pieces + :: enumerate tuple wings + :: + |= =(list term) + ^- (^list wing) + (turn list |=(=term `wing`[term ~])) + :: + ++ spore + :: build default sample + :: + ^- hoon + :: sample is always typeless + :: + :+ %ktls + [%bust %noun] + :: consume debugging context + :: + %- decorate + :: use home as subject + :: + %- home + :: if default is set, use it + :: + ?^ def u.def + :: else map structure to expression + :: + ~+ + |- ^- hoon + ?- mod + [%base *] ?:(=(%void p.mod) [%rock %n 0] (basal p.mod)) + [%bcbc *] :: track hygienic recursion points lexically + :: + %= $ + mod p.mod + cox :: merge lexically and don't forget %$ + :: + (~(put by ^+(cox (~(uni by cox) q.mod))) %$ p.mod) + == + [%dbug *] [%dbug p.mod $(mod q.mod)] + [%gist *] $(mod q.mod) + [%leaf *] [%rock p.mod q.mod] + [%loop *] ~|([%loop p.mod] $(mod (~(got by cox) p.mod))) + [%like *] $(mod bcmc/(unreel p.mod q.mod)) + [%made *] $(mod q.mod) + [%make *] $(mod bcmc/(unfold p.mod q.mod)) + [%name *] $(mod q.mod) + [%over *] $(hay p.mod, mod q.mod) + :: + [%bcbr *] $(mod p.mod) + [%bccb *] [%rock %n 0] + [%bccl *] |- ^- hoon + ?~ t.p.mod ^$(mod i.p.mod) + :- ^$(mod i.p.mod) + $(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod) + [%bccn *] :: use last entry + :: + |- ^- hoon + ?~ t.p.mod ^$(mod i.p.mod) + $(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod) + [%bchp *] :: see under %bccb + :: + [%rock %n 0] + [%bcgl *] $(mod q.mod) + [%bcgr *] $(mod q.mod) + [%bckt *] $(mod q.mod) + [%bcls *] [%note [%know p.mod] $(mod q.mod)] + [%bcmc *] :: borrow sample + :: + [%tsgl [%$ 6] p.mod] + [%bcpm *] $(mod p.mod) + [%bcsg *] [%kthp q.mod p.mod] + [%bcts *] [%ktts p.mod $(mod q.mod)] + [%bcpt *] $(mod p.mod) + [%bcwt *] :: use last entry + :: + |- ^- hoon + ?~ t.p.mod ^$(mod i.p.mod) + $(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod) + [%bcdt *] [%rock %n 0] + [%bcfs *] [%rock %n 0] + [%bctc *] [%rock %n 0] + [%bczp *] [%rock %n 0] + == + :: + ++ example + :: produce a correctly typed default instance + :: + ~+ + ^- hoon + ?+ mod + :: in the general case, make and analyze a spore + :: + :+ %tsls + spore + ~(relative analyze:(descend 3) 2) + :: + [%base *] (decorate (basal p.mod)) + [%dbug *] example(mod q.mod, bug [p.mod bug]) + [%gist *] example(mod q.mod, nut `p.mod) + [%leaf *] (decorate [%rock p.mod q.mod]) + [%like *] example(mod bcmc/(unreel p.mod q.mod)) + [%loop *] [%limb p.mod] + [%made *] example(mod q.mod, nut `made/[p.p.mod `(pieces q.p.mod)]) + [%make *] example(mod bcmc/(unfold p.mod q.mod)) + [%name *] example(mod q.mod, nut `made/[p.mod ~]) + [%over *] example(hay p.mod, mod q.mod) + :: + [%bccb *] (decorate (home p.mod)) + [%bccl *] %- decorate + |- ^- hoon + ?~ t.p.mod + example:clear(mod i.p.mod) + :- example:clear(mod i.p.mod) + example:clear(i.p.mod i.t.p.mod, t.p.mod t.t.p.mod) + [%bchp *] (decorate (function:clear p.mod q.mod)) + [%bcmc *] (decorate (home [%tsgl [%limb %$] p.mod])) + [%bcsg *] [%ktls example(mod q.mod) (home p.mod)] + [%bcls *] (decorate [%note [%know p.mod] example(mod q.mod)]) + [%bcts *] (decorate [%ktts p.mod example:clear(mod q.mod)]) + [%bcdt *] (decorate (home (interface %gold p.mod q.mod))) + [%bcfs *] (decorate (home (interface %iron p.mod q.mod))) + [%bczp *] (decorate (home (interface %lead p.mod q.mod))) + [%bctc *] (decorate (home (interface %zinc p.mod q.mod))) + == + :: + ++ factory + :: make a normalizing gate (mold) + :: + ^- hoon + :: process annotations outside construct, to catch default + :: + ::TODO: try seeing if putting %gist in here fixes %brbc + ?: ?=(%dbug -.mod) factory(mod q.mod, bug [p.mod bug]) + ?: ?=(%bcsg -.mod) factory(mod q.mod, def `[%kthp q.mod p.mod]) + ^- hoon + :: if we recognize an indirection + :: + ?: &(=(~ def) ?=(?(%bcmc %like %loop %make) -.mod)) + :: then short-circuit it + :: + %- decorate + %- home + ?- -.mod + %bcmc p.mod + %like (unreel p.mod q.mod) + %loop [%limb p.mod] + %make (unfold p.mod q.mod) + == + :: else build a gate + :: + :+ %brcl + [%ktsg spore] + :+ %tsls + ~(relative analyze:(descend 7) 6) + :: trigger unifying equality + :: + :+ %tsls [%dtts $/14 $/2] + $/6 + :: + ++ analyze + :: normalize a fragment of the subject + :: + |_ $: :: axe: axis to fragment + :: + axe=axis + == + ++ basic + |= bas=base + ^- hoon + ?- bas + [%atom *] + :+ %ktls example + ^- hoon + :^ %zppt + [[[%| 0 `%ruth] ~] ~] + [%wtpt fetch-wing fetch [%zpzp ~]] + [%cnls [%limb %ruth] [%sand %ta p.bas] fetch] + :: + %cell + :+ %ktls example + =+ fetch-wing + :- [%wing [[%& %2] -]] + [%wing [[%& %3] -]] + :: + %flag + :^ %wtcl + [%dtts [%rock %$ &] [%$ axe]] + [%rock %f &] + :+ %wtgr + [%dtts [%rock %$ |] [%$ axe]] + [%rock %f |] + :: + %noun + fetch + :: + %null + :+ %wtgr + [%dtts [%bust %noun] [%$ axe]] + [%rock %n ~] + ::: + %void + [%zpzp ~] + == + ++ clear + .(..analyze ^clear) + :: + ++ fetch + :: load the fragment + :: + ^- hoon + [%$ axe] + :: + ++ fetch-wing + :: load, as a wing + :: + ^- wing + [[%& axe] ~] + :: + ++ choice + :: match full models, by trying them + :: + |= $: :: one: first option + :: rep: other options + :: + one=spec + rep=(list spec) + == + ^- hoon + :: if no other choices, construct head + :: + ?~ rep relative:clear(mod one) + :: build test + :: + :^ %wtcl + :: if we fit the type of this choice + :: + [%fits example:clear(mod one) fetch-wing] + :: build with this choice + :: + relative:clear(mod one) + :: continue through loop + :: + $(one i.rep, rep t.rep) + :: + ++ switch + |= $: :: one: first format + :: two: more formats + :: + one=spec + rep=(list spec) + == + |- ^- hoon + :: if no other choices, construct head + :: + ?~ rep relative:clear(mod one) + :: fin: loop completion + :: + =/ fin=hoon $(one i.rep, rep t.rep) + :: interrogate this instance + :: + :^ %wtcl + :: test if the head matches this wing + :: + :+ %fits + [%tsgl [%$ 2] example:clear(mod one)] + fetch-wing(axe (peg axe 2)) + :: if so, use this form + :: + relative:clear(mod one) + :: continue in the loop + :: + fin + :: + ++ relative + :: local constructor + :: + ~+ + ^- hoon + ?- mod + :: + :: base + :: + [%base *] + (decorate (basic:clear p.mod)) + :: + :: debug + :: + [%dbug *] + relative(mod q.mod, bug [p.mod bug]) + :: + :: formal comment + :: + [%gist *] + relative(mod q.mod, nut `p.mod) + :: + :: constant + :: + [%leaf *] + %- decorate + :+ %wtgr + [%dtts fetch [%rock %$ q.mod]] + [%rock p.mod q.mod] + :: + :: composite + :: + [%make *] + relative(mod bcmc/(unfold p.mod q.mod)) + :: + :: indirect + :: + [%like *] + relative(mod bcmc/(unreel p.mod q.mod)) + :: + :: loop + :: + [%loop *] + (decorate [%cnhp [%limb p.mod] fetch]) + :: + :: simple named structure + :: + [%name *] + relative(mod q.mod, nut `made/[p.mod ~]) + :: + :: synthetic named structure + :: + [%made *] + relative(mod q.mod, nut `made/[p.p.mod `(pieces q.p.mod)]) + :: + :: subjective + :: + [%over *] + relative(hay p.mod, mod q.mod) + :: + :: recursive, $$ + :: + [%bcbc *] + :: + :: apply semantically + :: + :+ %brkt + relative(mod p.mod, dom (peg 3 dom)) + =- [[%$ ~ -] ~ ~] + %- ~(gas by *(map term hoon)) + ^- (list (pair term hoon)) + %+ turn + ~(tap by q.mod) + |= [=term =spec] + [term relative(mod spec, dom (peg 3 dom))] + :: + :: normalize, $& + :: + [%bcpm *] + :: push the raw result + :: + :+ %tsls relative(mod p.mod) + :: push repair function + :: + :+ %tsls + [%tsgr $/3 q.mod] + :: push repaired product + :: + :+ %tsls + [%cnhp $/2 $/6] + :: sanity-check repaired product + :: + :+ %wtgr + :: either + :: + :~ %wtbr + :: the repair did not change anything + :: + [%dtts $/14 $/2] + :: when we fix it again, it stays fixed + :: + [%dtts $/2 [%cnhp $/6 $/2]] + == + $/2 + :: + :: verify, $| + :: + [%bcbr *] + ^- hoon + :: push the raw product + :: + :+ %tsls relative(mod p.mod) + ^- hoon + :: assert + :: + :+ %wtgr + :: run the verifier + :: + [%cnhp [%tsgr $/3 q.mod] $/2] + :: produce verified product + :: + $/2 + :: + :: special, $_ + :: + [%bccb *] + (decorate (home p.mod)) + :: + :: switch, $% + :: + [%bccn *] + (decorate (switch i.p.mod t.p.mod)) + :: + :: tuple, $: + :: + [%bccl *] + %- decorate + |- ^- hoon + ?~ t.p.mod + relative:clear(mod i.p.mod) + :- relative:clear(mod i.p.mod, axe (peg axe 2)) + %= relative + i.p.mod i.t.p.mod + t.p.mod t.t.p.mod + axe (peg axe 3) + == + :: + :: exclude, $< + :: + [%bcgl *] + :+ %tsls + relative:clear(mod q.mod) + :+ %wtgl + [%wtts [%over ~[&/3] p.mod] ~[&/4]] + $/2 + :: + :: require, $> + :: + [%bcgr *] + :+ %tsls + relative:clear(mod q.mod) + :+ %wtgr + [%wtts [%over ~[&/3] p.mod] ~[&/4]] + $/2 + :: + :: function + :: + [%bchp *] + %- decorate + =/ fun (function:clear p.mod q.mod) + ?^ def + [%ktls fun u.def] + fun + :: + :: bridge, $^ + :: + [%bckt *] + %- decorate + :^ %wtcl + [%dtwt fetch(axe (peg axe 2))] + relative:clear(mod p.mod) + relative:clear(mod q.mod) + :: + :: synthesis, $; + :: + [%bcmc *] + (decorate [%cncl (home p.mod) fetch ~]) + :: + :: default + :: + [%bcsg *] + relative(mod q.mod, def `[%kthp q.mod p.mod]) + :: + :: choice, $? + :: + [%bcwt *] + (decorate (choice i.p.mod t.p.mod)) + :: + :: name, $= + :: + [%bcts *] + [%ktts p.mod relative(mod q.mod)] + :: + :: branch, $@ + :: + [%bcpt *] + %- decorate + :^ %wtcl + [%dtwt fetch] + relative:clear(mod q.mod) + relative:clear(mod p.mod) + :: + [%bcls *] [%note [%know p.mod] relative(mod q.mod)] + [%bcdt *] (decorate (home (interface %gold p.mod q.mod))) + [%bcfs *] (decorate (home (interface %iron p.mod q.mod))) + [%bczp *] (decorate (home (interface %lead p.mod q.mod))) + [%bctc *] (decorate (home (interface %zinc p.mod q.mod))) + == + -- + -- +:: +++ ap :: hoon engine + ~% %ap + +>+ + == + %open open + %rake rake + == + |_ gen=hoon + :: + ++ grip + |= =skin + =| rel=wing + |- ^- hoon + ?- skin + @ + [%tsgl [%tune skin] gen] + [%base *] + ?: ?=(%noun base.skin) + gen + [%kthp skin gen] + :: + [%cell *] + =+ haf=~(half ap gen) + ?^ haf + :- $(skin skin.skin, gen p.u.haf) + $(skin ^skin.skin, gen q.u.haf) + :+ %tsls + gen + :- $(skin skin.skin, gen [%$ 4]) + $(skin ^skin.skin, gen [%$ 5]) + :: + [%dbug *] + [%dbug spot.skin $(skin skin.skin)] + :: + [%leaf *] + [%kthp skin gen] + :: + [%help *] + [%note [%help help.skin] $(skin skin.skin)] + :: + [%name *] + [%tsgl [%tune term.skin] $(skin skin.skin)] + :: + [%over *] + $(skin skin.skin, rel (weld wing.skin rel)) + :: + [%spec *] + :+ %kthp + ?~(rel spec.skin [%over rel spec.skin]) + $(skin skin.skin) + :: + [%wash *] + :+ %tsgl + :- %wing + |- ^- wing + ?: =(0 depth.skin) ~ + [[%| 0 ~] $(depth.skin (dec depth.skin))] + gen + == + :: + ++ name + |- ^- (unit term) + ?+ gen ~ + [%wing *] ?~ p.gen ~ + ?^ i.p.gen + ?:(?=(%& -.i.p.gen) ~ q.i.p.gen) + `i.p.gen + [%limb *] `p.gen + [%dbug *] $(gen ~(open ap gen)) + [%tsgl *] $(gen ~(open ap gen)) + [%tsgr *] $(gen q.gen) + == + :: + ++ feck + |- ^- (unit term) + ?- gen + [%sand %tas @] [~ q.gen] + [%dbug *] $(gen q.gen) + * ~ + == + :: + :: not used at present; see comment at %csng in ++open +:::: +::++ hail +:: |= axe=axis +:: =| air=(list (pair wing hoon)) +:: |- ^+ air +:: =+ hav=half +:: ?~ hav [[[[%| 0 ~] [%& axe] ~] gen] air] +:: $(gen p.u.hav, axe (peg axe 2), air $(gen q.u.hav, axe (peg axe 3))) +:: + ++ half + |- ^- (unit (pair hoon hoon)) + ?+ gen ~ + [^ *] `[p.gen q.gen] + [%dbug *] $(gen q.gen) + [%clcb *] `[q.gen p.gen] + [%clhp *] `[p.gen q.gen] + [%clkt *] `[p.gen %clls q.gen r.gen s.gen] + [%clsg *] ?~(p.gen ~ `[i.p.gen %clsg t.p.gen]) + [%cltr *] ?~ p.gen ~ + ?~(t.p.gen $(gen i.p.gen) `[i.p.gen %cltr t.p.gen]) + == +:::: + :: +flay: hoon to skin + :: + ++ flay + |- ^- (unit skin) + ?+ gen + =+(open ?:(=(- gen) ~ $(gen -))) + :: + [^ *] + =+ [$(gen p.gen) $(gen q.gen)] + ?~(-< ~ ?~(-> ~ `[%cell -<+ ->+])) + :: + [%base *] + `gen + :: + [%rock *] + ?@(q.gen `[%leaf p.gen q.gen] ~) + :: + [%cnts [@ ~] ~] + `i.p.gen + :: + [%tsgr *] + %+ biff reek(gen p.gen) + |= =wing + (bind ^$(gen q.gen) |=(=skin [%over wing skin])) + :: + [%limb @] + `p.gen + :: + [%note [%help *] *] + (bind $(gen q.gen) |=(=skin [%help p.p.gen skin])) + :: + [%wing *] + ?: ?=([@ ~] p.gen) + `i.p.gen + =/ depth 0 + |- ^- (unit skin) + ?~ p.gen `[%wash depth] + ?. =([%| 0 ~] i.p.gen) ~ + $(p.gen t.p.gen) + :: + [%kttr *] + `[%spec p.gen %base %noun] + :: + [%ktts *] + %+ biff $(gen q.gen) + |= =skin + ?@ p.gen `[%name p.gen skin] + ?. ?=([%name @ [%base %noun]] p.gen) ~ + `[%name term.p.gen skin] + == + :: + :: +open: desugarer + ++ open + ^- hoon + ?- gen + [~ *] [%cnts [[%& p.gen] ~] ~] + :: + [%base *] ~(factory ax `spec`gen) + [%bust *] ~(example ax %base p.gen) + [%ktcl *] ~(factory ax p.gen) + [%dbug *] q.gen + [%eror *] ~_((crip p.gen) !!) + :: + [%knit *] :: + :+ %tsgr [%ktts %v %$ 1] :: => v=. + :- %brhp :: |- + :+ %ktls :: ^+ + :- %brhp :: |- + :^ %wtcl :: ?: + [%bust %flag] :: ? + [%bust %null] :: ~ + :- [%ktts %i [%sand 'tD' *@]] :: :- i=~~ + [%ktts %t [%limb %$]] :: t=$ + |- ^- hoon :: + ?~ p.gen :: + [%bust %null] :: ~ + =+ res=$(p.gen t.p.gen) :: + ^- hoon :: + ?@ i.p.gen :: + [[%sand 'tD' i.p.gen] res] :: [~~{i.p.gen} {res}] + :+ %tsls :: + :- :+ %ktts :: ^= + %a :: a + :+ %ktls :: ^+ + [%limb %$] :: $ + [%tsgr [%limb %v] p.i.p.gen] :: =>(v {p.i.p.gen}) + [%ktts %b res] :: b=[res] + ^- hoon :: + :- %brhp :: |- + :^ %wtpt :: ?@ + [%a ~] :: a + [%limb %b] :: b + :- [%tsgl [%$ 2] [%limb %a]] :: :- -.a + :+ %cnts :: %= + [%$ ~] :: $ + [[[%a ~] [%tsgl [%$ 3] [%limb %a]]] ~] :: a +.a + :: + [%leaf *] ~(factory ax `spec`gen) + [%limb *] [%cnts [p.gen ~] ~] + [%tell *] [%cncl [%limb %noah] [%zpgr [%cltr p.gen]] ~] + [%wing *] [%cnts p.gen ~] + [%yell *] [%cncl [%limb %cain] [%zpgr [%cltr p.gen]] ~] + [%note *] q.gen + :: + ::TODO: does %gist need to be special cased here? + [%brbc *] =- ?~ - !! + :+ %brtr + [%bccl -] + |- + ?. ?=([%gist *] body.gen) + [%ktcl body.gen] + [%note p.body.gen $(body.gen q.body.gen)] + %+ turn `(list term)`sample.gen + |= =term + ^- spec + =/ tar [%base %noun] + [%bcts term [%bcsg tar [%bchp tar tar]]] + [%brcb *] :+ %tsls [%kttr p.gen] + :+ %brcn ~ + %- ~(run by r.gen) + |= =tome + :- p.tome + %- ~(run by q.tome) + |= =hoon + ?~ q.gen hoon + [%tstr [p.i.q.gen ~] q.i.q.gen $(q.gen t.q.gen)] + [%brcl *] [%tsls p.gen [%brdt q.gen]] + [%brdt *] :+ %brcn ~ + =- [[%$ ~ -] ~ ~] + (~(put by *(map term hoon)) %$ p.gen) + [%brkt *] :+ %tsgl [%limb %$] + :+ %brcn ~ + =+ zil=(~(get by q.gen) %$) + ?~ zil + %+ ~(put by q.gen) %$ + [*what [[%$ p.gen] ~ ~]] + %+ ~(put by q.gen) %$ + [p.u.zil (~(put by q.u.zil) %$ p.gen)] + [%brhp *] [%tsgl [%limb %$] [%brdt p.gen]] + [%brsg *] [%ktbr [%brts p.gen q.gen]] + [%brtr *] :+ %tsls [%kttr p.gen] + :+ %brpt ~ + =- [[%$ ~ -] ~ ~] + (~(put by *(map term hoon)) %$ q.gen) + [%brts *] :+ %brcb p.gen + =- [~ [[%$ ~ -] ~ ~]] + (~(put by *(map term hoon)) %$ q.gen) + [%brwt *] [%ktwt %brdt p.gen] + :: + [%clkt *] [p.gen q.gen r.gen s.gen] + [%clls *] [p.gen q.gen r.gen] + [%clcb *] [q.gen p.gen] + [%clhp *] [p.gen q.gen] + [%clsg *] + |- ^- hoon + ?~ p.gen + [%rock %n ~] + [i.p.gen $(p.gen t.p.gen)] + :: + [%cltr *] + |- ^- hoon + ?~ p.gen + [%zpzp ~] + ?~ t.p.gen + i.p.gen + [i.p.gen $(p.gen t.p.gen)] + :: + [%kttr *] [%ktsg ~(example ax p.gen)] + [%cncb *] [%ktls [%wing p.gen] %cnts p.gen q.gen] + [%cndt *] [%cncl q.gen [p.gen ~]] + [%cnkt *] [%cncl p.gen q.gen r.gen s.gen ~] + [%cnls *] [%cncl p.gen q.gen r.gen ~] + [%cnhp *] [%cncl p.gen q.gen ~] + :: this probably should work, but doesn't + :: + :: [%cncl *] [%cntr [%$ ~] p.gen [[[[%& 6] ~] [%cltr q.gen]] ~]] + [%cncl *] [%cnsg [%$ ~] p.gen q.gen] + [%cnsg *] + :: this complex matching system is a leftover from the old + :: "electroplating" era. %cnsg should be removed and replaced + :: with the commented-out %cncl above. but something is broken. + :: + :^ %cntr p.gen q.gen + =+ axe=6 + |- ^- (list [wing hoon]) + ?~ r.gen ~ + ?~ t.r.gen [[[[%| 0 ~] [%& axe] ~] i.r.gen] ~] + :- [[[%| 0 ~] [%& (peg axe 2)] ~] i.r.gen] + $(axe (peg axe 3), r.gen t.r.gen) + :: + [%cntr *] + ?: =(~ r.gen) + [%tsgr q.gen [%wing p.gen]] + :+ %tsls + q.gen + :+ %cnts + (weld p.gen `wing`[[%& 2] ~]) + (turn r.gen |=([p=wing q=hoon] [p [%tsgr [%$ 3] q]])) + :: + [%ktdt *] [%ktls [%cncl p.gen q.gen ~] q.gen] + [%kthp *] [%ktls ~(example ax p.gen) q.gen] + [%ktts *] (grip(gen q.gen) p.gen) + :: + [%sgbr *] + :+ %sggr + :- %mean + =+ fek=~(feck ap p.gen) + ?^ fek [%rock %tas u.fek] + [%brdt [%cncl [%limb %cain] [%zpgr [%tsgr [%$ 3] p.gen]] ~]] + q.gen + :: + [%sgcb *] [%sggr [%mean [%brdt p.gen]] q.gen] + [%sgcn *] + :+ %sggl + :- %fast + :- %clls + :+ [%rock %$ p.gen] + [%zpts q.gen] + :- %clsg + =+ nob=`(list hoon)`~ + |- ^- (list hoon) + ?~ r.gen + nob + [[[%rock %$ p.i.r.gen] [%zpts q.i.r.gen]] $(r.gen t.r.gen)] + s.gen + :: + [%sgfs *] [%sgcn p.gen [%$ 7] ~ q.gen] + [%sggl *] [%tsgl [%sggr p.gen [%$ 1]] q.gen] + [%sgbc *] [%sggr [%live [%rock %$ p.gen]] q.gen] + [%sgls *] [%sggr [%memo %rock %$ p.gen] q.gen] + [%sgpm *] + :+ %sggr + [%slog [%sand %$ p.gen] [%cncl [%limb %cain] [%zpgr q.gen] ~]] + r.gen + :: + [%sgts *] [%sggr [%germ p.gen] q.gen] + [%sgwt *] + :+ %tsls + :^ %wtcl q.gen [%sgpm p.gen r.gen %bust %null] + [%bust %null] + [%tsgr $+3 s.gen] + :: + [%mcts *] + |- + ?~ p.gen [%bust %null] + ?- -.i.p.gen + ^ [[%xray i.p.gen] $(p.gen t.p.gen)] + %manx [p.i.p.gen $(p.gen t.p.gen)] + %tape [[%mcfs p.i.p.gen] $(p.gen t.p.gen)] + %call [%cncl p.i.p.gen [$(p.gen t.p.gen)]~] + %marl =- [%cndt [p.i.p.gen $(p.gen t.p.gen)] -] + ^- hoon + :+ %tsbr [%base %cell] + :+ %brpt ~ + ^- (map term tome) + =- [[%$ ~ -] ~ ~] + ^- (map term hoon) + :_ [~ ~] + =+ sug=[[%& 12] ~] + :- %$ + :^ %wtsg sug + [%cnts sug [[[[%& 1] ~] [%$ 13]] ~]] + [%cnts sug [[[[%& 3] ~] [%cnts [%$ ~] [[sug [%$ 25]] ~]]] ~]] + == + :: + [%mccl *] + ?- q.gen + ~ [%zpzp ~] + [* ~] i.q.gen + ^ + :+ %tsls + p.gen + =+ yex=`(list hoon)`q.gen + |- ^- hoon + ?- yex + [* ~] [%tsgr [%$ 3] i.yex] + [* ^] [%cncl [%$ 2] [%tsgr [%$ 3] i.yex] $(yex t.yex) ~] + ~ !! + == + == + :: + [%mcfs *] =+(zoy=[%rock %ta %$] [%clsg [zoy [%clsg [zoy p.gen] ~]] ~]) + [%mcgl *] [%cnls [%cnhp q ktcl+p] r [%brts p [%tsgr $+3 s]]]:gen + :: + [%mcsg *] :: ;~ + |- ^- hoon + ?- q.gen + ~ ~_(leaf+"open-mcsg" !!) + ^ + :+ %tsgr [%ktts %v %$ 1] :: => v=. + |- ^- hoon :: + ?: ?=(~ t.q.gen) :: + [%tsgr [%limb %v] i.q.gen] :: =>(v {i.q.gen}) + :+ %tsls [%ktts %a $(q.gen t.q.gen)] :: =+ ^= a + :+ %tsls :: {$(q.gen t.q.gen)} + [%ktts %b [%tsgr [%limb %v] i.q.gen]] :: =+ ^= b + :+ %tsls :: =>(v {i.q.gen}) + :+ %ktts %c :: =+ c=,.+6.b + :+ %tsgl :: + [%wing [%| 0 ~] [%& 6] ~] :: + [%limb %b] :: + :- %brdt :: |. + :^ %cnls :: %+ + [%tsgr [%limb %v] p.gen] :: =>(v {p.gen}) + [%cncl [%limb %b] [%limb %c] ~] :: (b c) + :+ %cnts [%a ~] :: a(,.+6 c) + [[[[%| 0 ~] [%& 6] ~] [%limb %c]] ~] :: + == :: + :: + [%mcmc *] :: ;; + [%cnhp ~(factory ax p.gen) q.gen] + :: + [%tsbr *] + [%tsls [%kttr p.gen] q.gen] + :: + [%tstr *] + :+ %tsgl + r.gen + [%tune [[p.p.gen ~ ?~(q.p.gen q.gen [%kthp u.q.p.gen q.gen])] ~ ~] ~] + :: + [%tscl *] + [%tsgr [%cncb [[%& 1] ~] p.gen] q.gen] + :: + [%tsfs *] + [%tsls [%ktts p.gen q.gen] r.gen] + :: + [%tsmc *] [%tsfs p.gen r.gen q.gen] + [%tsdt *] + [%tsgr [%cncb [[%& 1] ~] [[p.gen q.gen] ~]] r.gen] + [%tswt *] :: =? + [%tsdt p.gen [%wtcl q.gen r.gen [%wing p.gen]] s.gen] + :: + [%tskt *] :: =^ + =+ wuy=(weld q.gen `wing`[%v ~]) :: + :+ %tsgr [%ktts %v %$ 1] :: => v=. + :+ %tsls [%ktts %a %tsgr [%limb %v] r.gen] :: =+ a==>(v \r.gen) + :^ %tsdt wuy [%tsgl [%$ 3] [%limb %a]] + :+ %tsgr :- :+ %ktts [%over [%v ~] p.gen] + [%tsgl [%$ 2] [%limb %a]] + [%limb %v] + s.gen + :: + [%tsgl *] [%tsgr q.gen p.gen] + [%tsls *] [%tsgr [p.gen [%$ 1]] q.gen] + [%tshp *] [%tsls q.gen p.gen] + [%tssg *] + |- ^- hoon + ?~ p.gen [%$ 1] + ?~ t.p.gen i.p.gen + [%tsgr i.p.gen $(p.gen t.p.gen)] + :: + [%wtbr *] + |- + ?~(p.gen [%rock %f 1] [%wtcl i.p.gen [%rock %f 0] $(p.gen t.p.gen)]) + :: + [%wtdt *] [%wtcl p.gen r.gen q.gen] + [%wtgl *] [%wtcl p.gen [%zpzp ~] q.gen] + [%wtgr *] [%wtcl p.gen q.gen [%zpzp ~]] + [%wtkt *] [%wtcl [%wtts [%base %atom %$] p.gen] r.gen q.gen] + :: + [%wthp *] + |- + ?~ q.gen + [%lost [%wing p.gen]] + :^ %wtcl + [%wtts p.i.q.gen p.gen] + q.i.q.gen + $(q.gen t.q.gen) + :: + [%wtls *] + [%wthp p.gen (weld r.gen `_r.gen`[[[%base %noun] q.gen] ~])] + :: + [%wtpm *] + |- + ?~(p.gen [%rock %f 0] [%wtcl i.p.gen $(p.gen t.p.gen) [%rock %f 1]]) + :: + [%xray *] + |^ :- [(open-mane n.g.p.gen) %clsg (turn a.g.p.gen open-mart)] + [%mcts c.p.gen] + :: + ++ open-mane + |= a=mane:hoot + ?@(a [%rock %tas a] [[%rock %tas -.a] [%rock %tas +.a]]) + :: + ++ open-mart + |= [n=mane:hoot v=(list beer:hoot)] + [(open-mane n) %knit v] + -- + :: + [%wtpt *] [%wtcl [%wtts [%base %atom %$] p.gen] q.gen r.gen] + [%wtsg *] [%wtcl [%wtts [%base %null] p.gen] q.gen r.gen] + [%wtts *] [%fits ~(example ax p.gen) q.gen] + [%wtzp *] [%wtcl p.gen [%rock %f 1] [%rock %f 0]] + [%zpgr *] + [%cncl [%limb %onan] [%zpmc [%kttr [%bcmc %limb %abel]] p.gen] ~] + :: + [%zpwt *] + ?: ?: ?=(@ p.gen) + (lte hoon-version p.gen) + &((lte hoon-version p.p.gen) (gte hoon-version q.p.gen)) + q.gen + ~_(leaf+"hoon-version" !!) + :: + * gen + == + :: + ++ rake ~>(%mean.'rake-hoon' (need reek)) + ++ reek + ^- (unit wing) + ?+ gen ~ + [~ *] `[[%& p.gen] ~] + [%limb *] `[p.gen ~] + [%wing *] `p.gen + [%cnts * ~] `p.gen + [%dbug *] reek(gen q.gen) + == + ++ rusk + ^- term + =+ wig=rake + ?. ?=([@ ~] wig) + ~>(%mean.'rusk-hoon' !!) + i.wig + -- +:: +:: 5c: compiler backend and prettyprinter ++| %compiler-backend-and-prettyprinter +:: +++ ut + ~% %ut + +>+ + == + %ar ar + %fan fan + %rib rib + %vet vet + %blow blow + %burp burp + %busk busk + %buss buss + %crop crop + %duck duck + %dune dune + %dunk dunk + %epla epla + %emin emin + %emul emul + %feel feel + %felt felt + %fine fine + %fire fire + %fish fish + %fond fond + %fund fund + %funk funk + %fuse fuse + %gain gain + %lose lose + %mile mile + %mine mine + %mint mint + %moot moot + %mull mull + %nest nest + %peel peel + %play play + %peek peek + %repo repo + %rest rest + %sink sink + %tack tack + %toss toss + %wrap wrap + == + =+ :* fan=*(set [type hoon]) + rib=*(set [type type hoon]) + vet=`?`& + == + =+ sut=`type`%noun + |% + ++ clip + |= ref=type + ?> ?|(!vet (nest(sut ref) & sut)) + ref + :: + :: +ar: texture engine + :: + ++ ar !: + ~% %ar + +> + == + %fish fish + %gain gain + %lose lose + == + |_ [ref=type =skin] + :: + :: +fish: make a $nock that tests a .ref at .axis for .skin + :: + ++ fish + |= =axis + ^- nock + ?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]]) + ?- -.skin + :: + %base + ?- base.skin + %cell $(skin [%cell [%base %noun] [%base %noun]]) + %flag ?: (~(nest ut bool) | ref) + [%1 &] + %+ flan + $(skin [%base %atom %$]) + %+ flor + [%5 [%0 axis] [%1 &]] + [%5 [%0 axis] [%1 |]] + %noun [%1 &] + %null $(skin [%leaf %n ~]) + %void [%1 |] + [%atom *] ?: (~(nest ut [%atom %$ ~]) | ref) + [%1 &] + ?: (~(nest ut [%cell %noun %noun]) | ref) + [%1 |] + (flip [%3 %0 axis]) + == + :: + %cell + ?: (~(nest ut [%atom %$ ~]) | ref) [%1 |] + %+ flan + ?: (~(nest ut [%cell %noun %noun]) | ref) + [%1 &] + [%3 %0 axis] + %+ flan + $(ref (peek(sut ref) %free 2), axis (peg axis 2), skin skin.skin) + $(ref (peek(sut ref) %free 3), axis (peg axis 3), skin ^skin.skin) + :: + %leaf + ?: (~(nest ut [%atom %$ `atom.skin]) | ref) + [%1 &] + [%5 [%1 atom.skin] [%0 axis]] + :: + %dbug $(skin skin.skin) + %help $(skin skin.skin) + %name $(skin skin.skin) + %over ::NOTE might need to guard with +feel, crashing is too strict + =+ ~| %oops-guess-you-needed-feel-after-all + fid=(fend %read wing.skin) + $(sut p.fid, axis (peg axis q.fid), skin skin.skin) + %spec =/ hit (~(play ut sut) ~(example ax spec.skin)) + ?> (~(nest ut hit) & ref) + $(skin skin.skin) + %wash [%1 &] + == + :: + :: +gain: make a $type by restricting .ref to .skin + :: + ++ gain + |- ^- type + ?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]]) + ?- -.skin + :: + %base + ?- base.skin + %cell $(skin [%cell [%base %noun] [%base %noun]]) + %flag (fork $(skin [%leaf %f &]) $(skin [%leaf %f |]) ~) + %null $(skin [%leaf %n ~]) + %void %void + %noun ?:((~(nest ut %void) | ref) %void ref) + [%atom *] + =| gil=(set type) + |- ^- type + ?- ref + %void %void + %noun [%atom p.base.skin ~] + [%atom *] ?. (fitz p.base.skin p.ref) + ~>(%mean.'atom-mismatch' !!) + :+ %atom + (max p.base.skin p.ref) + q.ref + [%cell *] %void + [%core *] %void + [%face *] $(ref q.ref) + [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) + [%hint *] (hint p.ref $(ref q.ref)) + [%hold *] ?: (~(has in gil) ref) %void + $(gil (~(put in gil) ref), ref repo(sut ref)) + == + == + :: + %cell + =| gil=(set type) + |- ^- type + ?- ref + %void %void + %noun =+ ^$(skin skin.skin) + ?: =(%void -) %void + (cell - ^$(skin ^skin.skin)) + [%atom *] %void + [%cell *] =+ ^$(skin skin.skin, ref p.ref) + ?: =(%void -) %void + (cell - ^$(skin ^skin.skin, ref q.ref)) + [%core *] =+ ^$(skin skin.skin, ref p.ref) + ?: =(%void -) %void + ?. =(%noun ^skin.skin) + (cell - ^$(skin ^skin.skin, ref %noun)) + [%core - q.ref] + [%face *] $(ref q.ref) + [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) + [%hint *] (hint p.ref $(ref q.ref)) + [%hold *] ?: (~(has in gil) ref) %void + $(gil (~(put in gil) ref), ref repo(sut ref)) + == + :: + %leaf + =| gil=(set type) + |- ^- type + ?- ref + %void %void + %noun [%atom aura.skin `atom.skin] + [%atom *] ?: &(?=(^ q.ref) !=(atom.skin u.q.ref)) + %void + ?. (fitz aura.skin p.ref) + ~>(%mean.'atom-mismatch' !!) + :+ %atom + (max aura.skin p.ref) + `atom.skin + [%cell *] %void + [%core *] %void + [%face *] $(ref q.ref) + [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) + [%hint *] (hint p.ref $(ref q.ref)) + [%hold *] ?: (~(has in gil) ref) %void + $(gil (~(put in gil) ref), ref repo(sut ref)) + == + :: + %dbug $(skin skin.skin) + %help (hint [sut %help help.skin] $(skin skin.skin)) + %name (face term.skin $(skin skin.skin)) + %over $(skin skin.skin, sut (~(play ut sut) %wing wing.skin)) + %spec =/ hit (~(play ut sut) ~(example ax spec.skin)) + ?> (~(nest ut hit) & $(skin skin.skin)) + (~(fuse ut ref) hit) + %wash =- $(ref (~(play ut ref) -)) + :- %wing + |- ^- wing + ?: =(0 depth.skin) ~ + [[%| 0 ~] $(depth.skin (dec depth.skin))] + == + :: + :: +lose: make a $type by restricting .ref to exclude .skin + :: + ++ lose + |- ^- type + ?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]]) + ?- -.skin + :: + %base + ?- base.skin + %cell $(skin [%cell [%base %noun] [%base %noun]]) + %flag $(ref $(skin [%leaf %f &]), skin [%leaf %f |]) + %null $(skin [%leaf %n ~]) + %void ref + %noun %void + [%atom *] + =| gil=(set type) + |- ^- type + ?- ref + %void %void + %noun [%cell %noun %noun] + [%atom *] %void + [%cell *] ref + [%core *] ref + [%face *] (face p.ref $(ref q.ref)) + [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) + [%hint *] (hint p.ref $(ref q.ref)) + [%hold *] ?: (~(has in gil) ref) %void + $(gil (~(put in gil) ref), ref repo(sut ref)) + == + == + :: + %cell + =| gil=(set type) + |- ^- type + ?- ref + %void %void + %noun ?. =([%cell [%base %noun] [%base %noun]] skin) + ref + [%atom %$ ~] + [%atom *] ref + [%cell *] =/ lef ^$(skin skin.skin, ref p.ref) + =/ rig ^$(skin ^skin.skin, ref q.ref) + (fork (cell lef rig) (cell lef q.ref) (cell p.ref rig) ~) + [%core *] =+ ^$(skin skin.skin, ref p.ref) + ?: =(%void -) %void + ?. =(%noun ^skin.skin) + (cell - ^$(skin ^skin.skin, ref %noun)) + [%core - q.ref] + [%face *] $(ref q.ref) + [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) + [%hint *] (hint p.ref $(ref q.ref)) + [%hold *] ?: (~(has in gil) ref) %void + $(gil (~(put in gil) ref), ref repo(sut ref)) + == + :: + %leaf + =| gil=(set type) + |- ^- type + ?- ref + %void %void + %noun %noun + [%atom *] ?: =(q.ref `atom.skin) + %void + ref + [%cell *] ref + [%core *] ref + [%face *] (face p.ref $(ref q.ref)) + [%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type)))) + [%hint *] (hint p.ref $(ref q.ref)) + [%hold *] ?: (~(has in gil) ref) %void + $(gil (~(put in gil) ref), ref repo(sut ref)) + == + :: + %dbug $(skin skin.skin) + %help $(skin skin.skin) + %name $(skin skin.skin) + %over ::TODO if we guard in +fish (+feel), we have to guard again here + $(skin skin.skin, sut (~(play ut sut) %wing wing.skin)) + %spec =/ hit (~(play ut sut) ~(example ax spec.skin)) + ?> (~(nest ut hit) & $(skin skin.skin)) + (~(crop ut ref) hit) + %wash ref + == + -- + :: + ++ blow + |= [gol=type gen=hoon] + ^- [type nock] + =+ pro=(mint gol gen) + =+ jon=(apex:musk bran q.pro) + ?: |(?=(~ jon) ?=(%wait -.u.jon)) + [p.pro q.pro] + [p.pro %1 p.u.jon] + :: + ++ bran + ~+ + =+ gil=*(set type) + |- ~+ ^- seminoun:musk + ?- sut + %noun [full/[~ ~ ~] ~] + %void [full/[~ ~ ~] ~] + [%atom *] ?~(q.sut [full/[~ ~ ~] ~] [full/~ u.q.sut]) + [%cell *] (combine:musk $(sut p.sut) $(sut q.sut)) + [%core *] %+ combine:musk + p.r.q.sut + $(sut p.sut) + [%face *] $(sut repo) + [%fork *] [full/[~ ~ ~] ~] + [%hint *] $(sut repo) + [%hold *] ?: (~(has in gil) sut) + [full/[~ ~ ~] ~] + $(sut repo, gil (~(put in gil) sut)) + == + :: + ++ burp + :: expel undigested seminouns + :: + ^- type + ~+ + =- ?.(=(sut -) - sut) + ?+ sut sut + [%cell *] [%cell burp(sut p.sut) burp(sut q.sut)] + [%core *] :+ %core + burp(sut p.sut) + :* p.q.sut + burp(sut q.q.sut) + :_ q.r.q.sut + ?: ?=([[%full ~] *] p.r.q.sut) + p.r.q.sut + [[%full ~ ~ ~] ~] + == + [%face *] [%face p.sut burp(sut q.sut)] + [%fork *] [%fork (~(run in p.sut) |=(type burp(sut +<)))] + [%hint *] (hint [burp(sut p.p.sut) q.p.sut] burp(sut q.sut)) + [%hold *] [%hold burp(sut p.sut) q.sut] + == + :: + ++ busk + ~/ %busk + |= gen=hoon + ^- type + [%face [~ [gen ~]] sut] + :: + ++ buss + ~/ %buss + |= [cog=term gen=hoon] + ^- type + [%face [[[cog ~ gen] ~ ~] ~] sut] + :: + ++ crop + ~/ %crop + |= ref=type + =+ bix=*(set [type type]) + =< dext + |% + ++ dext + ^- type + ~_ leaf+"crop" + :: ~_ (dunk 'dext: sut') + :: ~_ (dunk(sut ref) 'dext: ref') + ?: |(=(sut ref) =(%noun ref)) + %void + ?: =(%void ref) + sut + ?- sut + [%atom *] + ?+ ref sint + [%atom *] ?^ q.sut + ?^(q.ref ?:(=(q.ref q.sut) %void sut) %void) + ?^(q.ref sut %void) + [%cell *] sut + == + :: + [%cell *] + ?+ ref sint + [%atom *] sut + [%cell *] ?. (nest(sut p.ref) | p.sut) sut + (cell p.sut dext(sut q.sut, ref q.ref)) + == + :: + [%core *] ?:(?=(?([%atom *] [%cell *]) ref) sut sint) + [%face *] (face p.sut dext(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type dext(sut +<)))) + [%hint *] (hint p.sut dext(sut q.sut)) + [%hold *] ?< (~(has in bix) [sut ref]) + dext(sut repo, bix (~(put in bix) [sut ref])) + %noun dext(sut repo) + %void %void + == + :: + ++ sint + ^- type + ?+ ref !! + [%core *] sut + [%face *] dext(ref repo(sut ref)) + [%fork *] =+ yed=~(tap in p.ref) + |- ^- type + ?~ yed sut + $(yed t.yed, sut dext(ref i.yed)) + [%hint *] dext(ref repo(sut ref)) + [%hold *] dext(ref repo(sut ref)) + == + -- + :: + ++ cool + |= [pol=? hyp=wing ref=type] + ^- type + =+ fid=(find %both hyp) + ?- -.fid + %| sut + %& =< q + %+ take p.p.fid + |=(a=type ?:(pol (fuse(sut a) ref) (crop(sut a) ref))) + == + :: + ++ duck ^-(tank ~(duck us sut)) + ++ dune |.(duck) + ++ dunk + |= paz=term ^- tank + :+ %palm + [['.' ~] ['-' ~] ~ ~] + [[%leaf (mesc (trip paz))] duck ~] + :: + ++ elbo + |= [lop=palo rig=(list (pair wing hoon))] + ^- type + ?: ?=(%& -.q.lop) + |- ^- type + ?~ rig + p.q.lop + =+ zil=(play q.i.rig) + =+ dar=(tack(sut p.q.lop) p.i.rig zil) + %= $ + rig t.rig + p.q.lop q.dar + == + =+ hag=~(tap in q.q.lop) + %- fire + |- ^+ hag + ?~ rig + hag + =+ zil=(play q.i.rig) + =+ dix=(toss p.i.rig zil hag) + %= $ + rig t.rig + hag q.dix + == + :: + ++ ergo + |= [lop=palo rig=(list (pair wing hoon))] + ^- (pair type nock) + =+ axe=(tend p.lop) + =| hej=(list (pair axis nock)) + ?: ?=(%& -.q.lop) + =- [p.- (hike axe q.-)] + |- ^- (pair type (list (pair axis nock))) + ?~ rig + [p.q.lop hej] + =+ zil=(mint %noun q.i.rig) + =+ dar=(tack(sut p.q.lop) p.i.rig p.zil) + %= $ + rig t.rig + p.q.lop q.dar + hej [[p.dar q.zil] hej] + == + =+ hag=~(tap in q.q.lop) + =- [(fire p.-) [%9 p.q.lop (hike axe q.-)]] + |- ^- (pair (list (pair type foot)) (list (pair axis nock))) + ?~ rig + [hag hej] + =+ zil=(mint %noun q.i.rig) + =+ dix=(toss p.i.rig p.zil hag) + %= $ + rig t.rig + hag q.dix + hej [[p.dix q.zil] hej] + == + :: + ++ endo + |= [lop=(pair palo palo) dox=type rig=(list (pair wing hoon))] + ^- (pair type type) + ?: ?=(%& -.q.p.lop) + ?> ?=(%& -.q.q.lop) + |- ^- (pair type type) + ?~ rig + [p.q.p.lop p.q.q.lop] + =+ zil=(mull %noun dox q.i.rig) + =+ ^= dar + :- p=(tack(sut p.q.p.lop) p.i.rig p.zil) + q=(tack(sut p.q.q.lop) p.i.rig q.zil) + ?> =(p.p.dar p.q.dar) + %= $ + rig t.rig + p.q.p.lop q.p.dar + p.q.q.lop q.q.dar + == + ?> ?=(%| -.q.q.lop) + ?> =(p.q.p.lop p.q.q.lop) + =+ hag=[p=~(tap in q.q.p.lop) q=~(tap in q.q.q.lop)] + =- [(fire p.-) (fire(vet |) q.-)] + |- ^- (pair (list (pair type foot)) (list (pair type foot))) + ?~ rig + hag + =+ zil=(mull %noun dox q.i.rig) + =+ ^= dix + :- p=(toss p.i.rig p.zil p.hag) + q=(toss p.i.rig q.zil q.hag) + ?> =(p.p.dix p.q.dix) + %= $ + rig t.rig + hag [q.p.dix q.q.dix] + == + :: + ++ et + |_ [hyp=wing rig=(list (pair wing hoon))] + :: + ++ play + ^- type + =+ lug=(find %read hyp) + ?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.p.lug)) + (elbo p.lug rig) + :: + ++ mint + |= gol=type + =- ?>(?|(!vet (nest(sut gol) & p.-)) -) + ^- (pair type nock) + =+ lug=(find %read hyp) + ?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.lug)) + (ergo p.lug rig) + :: + ++ mull + |= [gol=type dox=type] + =- ?>(?|(!vet (nest(sut gol) & p.-)) -) + ^- (pair type type) + =+ lug=[p=(find %read hyp) q=(find(sut dox) %read hyp)] + ?: ?=(%| -.p.lug) + ?> &(?=(%| -.q.lug) ?=(~ rig)) + [p.p.p.lug p.p.q.lug] + ?> ?=(%& -.q.lug) + (endo [p.p.lug p.q.lug] dox rig) + -- + :: + ++ epla + ~/ %epla + |= [hyp=wing rig=(list (pair wing hoon))] + ^- type + ~(play et hyp rig) + :: + ++ emin + ~/ %emin + |= [gol=type hyp=wing rig=(list (pair wing hoon))] + ^- (pair type nock) + (~(mint et hyp rig) gol) + :: + ++ emul + ~/ %emul + |= [gol=type dox=type hyp=wing rig=(list (pair wing hoon))] + ^- (pair type type) + (~(mull et hyp rig) gol dox) + :: + ++ felt !! + :: :: + ++ feel :: detect existence + |= rot=(list wing) + ^- ? + =. rot (flop rot) + |- ^- ? + ?~ rot & + =/ yep (fond %free i.rot) + ?~ yep | + ?- -.yep + %& %= $ + rot t.rot + sut p:(fine %& p.yep) + == + %| ?- -.p.yep + %& | + %| %= $ + rot t.rot + sut p:(fine %| p.p.yep) + == + == == + :: + ++ fond + ~/ %fond + |= [way=vial hyp=wing] + => |% + ++ pony :: raw match + $@ ~ :: void + %+ each :: natural/abnormal + palo :: arm or leg + %+ each :: abnormal + @ud :: unmatched + (pair type nock) :: synthetic + -- + ^- pony + ?~ hyp + [%& ~ %& sut] + =+ mor=$(hyp t.hyp) + ?- -.mor + %| + ?- -.p.mor + %& mor + %| + =+ fex=(mint(sut p.p.p.mor) %noun [%wing i.hyp ~]) + [%| %| p.fex (comb q.p.p.mor q.fex)] + == + :: + %& + =. sut + =* lap q.p.mor + ?- -.lap + %& p.lap + %| (fork (turn ~(tap in q.lap) head)) + == + => :_ + + :* axe=`axis`1 + lon=p.p.mor + heg=?^(i.hyp i.hyp [%| p=0 q=(some i.hyp)]) + == + ?: ?=(%& -.heg) + [%& [`p.heg lon] %& (peek way p.heg)] + =| gil=(set type) + =< $ + |% ++ here ?: =(0 p.heg) + [%& [~ `axe lon] %& sut] + [%| %& (dec p.heg)] + ++ lose [%| %& p.heg] + ++ stop ?~(q.heg here lose) + ++ twin |= [hax=pony yor=pony] + ^- pony + ~_ leaf+"find-fork" + ?: =(hax yor) hax + ?~ hax yor + ?~ yor hax + ?: ?=(%| -.hax) + ?> ?& ?=(%| -.yor) + ?=(%| -.p.hax) + ?=(%| -.p.yor) + =(q.p.p.hax q.p.p.yor) + == + :+ %| + %| + [(fork p.p.p.hax p.p.p.yor ~) q.p.p.hax] + ?> ?=(%& -.yor) + ?> =(p.p.hax p.p.yor) + ?: &(?=(%& -.q.p.hax) ?=(%& -.q.p.yor)) + :+ %& p.p.hax + [%& (fork p.q.p.hax p.q.p.yor ~)] + ?> &(?=(%| -.q.p.hax) ?=(%| -.q.p.yor)) + ?> =(p.q.p.hax p.q.p.yor) + =+ wal=(~(uni in q.q.p.hax) q.q.p.yor) + :+ %& p.p.hax + [%| p.q.p.hax wal] + ++ $ + ^- pony + ?- sut + %void ~ + %noun stop + [%atom *] stop + [%cell *] + ?~ q.heg here + =+ taf=$(axe (peg axe 2), sut p.sut) + ?~ taf ~ + ?: |(?=(%& -.taf) ?=(%| -.p.taf)) + taf + $(axe (peg axe 3), p.heg p.p.taf, sut q.sut) + :: + [%core *] + ?~ q.heg here + =^ zem p.heg + =+ zem=(loot u.q.heg q.r.q.sut) + ?~ zem [~ p.heg] + ?:(=(0 p.heg) [zem 0] [~ (dec p.heg)]) + ?^ zem + :+ %& + [`axe lon] + =/ zut ^- foot + ?- q.p.q.sut + %wet [%wet q.u.zem] + %dry [%dry q.u.zem] + == + [%| (peg 2 p.u.zem) [[sut zut] ~ ~]] + =+ pec=(peel way r.p.q.sut) + ?. sam.pec lose + ?: con.pec $(sut p.sut, axe (peg axe 3)) + $(sut (peek(sut p.sut) way 2), axe (peg axe 6)) + :: + [%hint *] + $(sut repo) + :: + [%face *] + ?: ?=(~ q.heg) here(sut q.sut) + =* zot p.sut + ?@ zot + ?:(=(u.q.heg zot) here(sut q.sut) lose) + =< main + |% + ++ main + ^- pony + =+ tyr=(~(get by p.zot) u.q.heg) + ?~ tyr + next + ?~ u.tyr + $(sut q.sut, lon [~ lon], p.heg +(p.heg)) + ?. =(0 p.heg) + next(p.heg (dec p.heg)) + =+ tor=(fund way u.u.tyr) + ?- -.tor + %& [%& (weld p.p.tor `vein`[~ `axe lon]) q.p.tor] + %| [%| %| p.p.tor (comb [%0 axe] q.p.tor)] + == + ++ next + |- ^- pony + ?~ q.zot + ^$(sut q.sut, lon [~ lon]) + =+ tiv=(mint(sut q.sut) %noun i.q.zot) + =+ fid=^$(sut p.tiv, lon ~, axe 1, gil ~) + ?~ fid ~ + ?: ?=([%| %& *] fid) + $(q.zot t.q.zot, p.heg p.p.fid) + =/ vat=(pair type nock) + ?- -.fid + %& (fine %& p.fid) + %| (fine %| p.p.fid) + == + [%| %| p.vat (comb (comb [%0 axe] q.tiv) q.vat)] + -- + :: + [%fork *] + =+ wiz=(turn ~(tap in p.sut) |=(a=type ^$(sut a))) + ?~ wiz ~ + |- ^- pony + ?~ t.wiz i.wiz + (twin i.wiz $(wiz t.wiz)) + :: + [%hold *] + ?: (~(has in gil) sut) + ~ + $(gil (~(put in gil) sut), sut repo) + == + -- + == + :: + ++ find + ~/ %find + |= [way=vial hyp=wing] + ^- port + ~_ (show [%c %find] %l hyp) + =- ?@ - !! + ?- -< + %& [%& p.-] + %| ?- -.p.- + %| [%| p.p.-] + %& !! + == == + (fond way hyp) + :: + ++ fend + |= [way=vial hyp=wing] + ^- (pair type axis) + =+ fid=(find way hyp) + ~> %mean.'fend-fragment' + ?> &(?=(%& -.fid) ?=(%& -.q.p.fid)) + [p.q.p.fid (tend p.p.fid)] + :: + ++ fund + ~/ %fund + |= [way=vial gen=hoon] + ^- port + =+ hup=~(reek ap gen) + ?~ hup + [%| (mint %noun gen)] + (find way u.hup) + :: + ++ fine + ~/ %fine + |= tor=port + ^- (pair type nock) + ?- -.tor + %| p.tor + %& =+ axe=(tend p.p.tor) + ?- -.q.p.tor + %& [`type`p.q.p.tor %0 axe] + %| [(fire ~(tap in q.q.p.tor)) [%9 p.q.p.tor %0 axe]] + == == + :: + ++ fire + |= hag=(list [p=type q=foot]) + ^- type + ?: ?=([[* [%wet ~ %1]] ~] hag) + p.i.hag + %- fork + %+ turn + hag.$ + |= [p=type q=foot] + ?. ?=([%core *] p) + ~_ (dunk %fire-type) + ~_ leaf+"expected-fork-to-be-core" + ~_ (dunk(sut p) %fork-type) + ~>(%mean.'fire-core' !!) + :- %hold + =+ dox=[%core q.q.p q.p(r.p %gold)] + ?: ?=(%dry -.q) + :: ~_ (dunk(sut [%cell q.q.p p.p]) %fire-dry) + ?> ?|(!vet (nest(sut q.q.p) & p.p)) + [dox p.q] + ?> ?=(%wet -.q) + :: ~_ (dunk(sut [%cell q.q.p p.p]) %fire-wet) + =. p.p (redo(sut p.p) q.q.p) + ?> ?| !vet + (~(has in rib) [sut dox p.q]) + !=(** (mull(sut p, rib (~(put in rib) sut dox p.q)) %noun dox p.q)) + == + [p p.q] + :: + ++ fish + ~/ %fish + |= axe=axis + =+ vot=*(set type) + |- ^- nock + ?- sut + %void [%1 1] + %noun [%1 0] + [%atom *] ?~ q.sut + (flip [%3 %0 axe]) + [%5 [%1 u.q.sut] [%0 axe]] + [%cell *] + %+ flan + [%3 %0 axe] + (flan $(sut p.sut, axe (peg axe 2)) $(sut q.sut, axe (peg axe 3))) + :: + [%core *] ~>(%mean.'fish-core' !!) + [%face *] $(sut q.sut) + [%fork *] =+ yed=~(tap in p.sut) + |- ^- nock + ?~(yed [%1 1] (flor ^$(sut i.yed) $(yed t.yed))) + [%hint *] $(sut q.sut) + [%hold *] + ?: (~(has in vot) sut) + ~>(%mean.'fish-loop' !!) + => %=(. vot (~(put in vot) sut)) + $(sut repo) + == + :: + ++ fuse + ~/ %fuse + |= ref=type + =+ bix=*(set [type type]) + |- ^- type + ?: ?|(=(sut ref) =(%noun ref)) + sut + ?- sut + [%atom *] + ?- ref + [%atom *] =+ foc=?:((fitz p.ref p.sut) p.sut p.ref) + ?^ q.sut + ?^ q.ref + ?: =(q.sut q.ref) + [%atom foc q.sut] + %void + [%atom foc q.sut] + [%atom foc q.ref] + [%cell *] %void + * $(sut ref, ref sut) + == + [%cell *] + ?- ref + [%cell *] (cell $(sut p.sut, ref p.ref) $(sut q.sut, ref q.ref)) + * $(sut ref, ref sut) + == + :: + [%core *] $(sut repo) + [%face *] (face p.sut $(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hint *] (hint p.sut $(sut q.sut)) + [%hold *] + ?: (~(has in bix) [sut ref]) + ~>(%mean.'fuse-loop' !!) + $(sut repo, bix (~(put in bix) [sut ref])) + :: + %noun ref + %void %void + == + :: + ++ gain + ~/ %gain + |= gen=hoon ^- type + (chip & gen) + :: + ++ hemp + :: generate formula from foot + :: + |= [hud=poly gol=type gen=hoon] + ^- nock + ~+ + =+ %hemp-141 + ?- hud + %dry q:(mint gol gen) + %wet q:(mint(vet |) gol gen) + == + :: + ++ laze + :: produce lazy core generator for static execution + :: + |= [nym=(unit term) hud=poly dom=(map term tome)] + ~+ + ^- seminoun + =+ %hemp-141 + :: tal: map from battery axis to foot + :: + =; tal=(map @ud hoon) + :: produce lazy battery + :: + :_ ~ + :+ %lazy 1 + |= axe=@ud + ^- (unit noun) + %+ bind (~(get by tal) axe) + |= gen=hoon + %. [hud %noun gen] + hemp(sut (core sut [nym hud %gold] sut [[%lazy 1 ..^$] ~] dom)) + :: + %- ~(gas by *(map @ud hoon)) + =| yeb=(list (pair @ud hoon)) + =+ axe=1 + |^ ?- dom + ~ yeb + [* ~ ~] (chapter q.q.n.dom) + [* * ~] %= $ + dom l.dom + axe (peg axe 3) + yeb (chapter(axe (peg axe 2)) q.q.n.dom) + == + [* ~ *] %= $ + dom r.dom + axe (peg axe 3) + yeb (chapter(axe (peg axe 2)) q.q.n.dom) + == + [* * *] %= $ + dom r.dom + axe (peg axe 7) + yeb %= $ + dom l.dom + axe (peg axe 6) + yeb (chapter(axe (peg axe 2)) q.q.n.dom) + == == == + ++ chapter + |= dab=(map term hoon) + ^+ yeb + ?- dab + ~ yeb + [* ~ ~] [[axe q.n.dab] yeb] + [* * ~] %= $ + dab l.dab + axe (peg axe 3) + yeb [[(peg axe 2) q.n.dab] yeb] + == + [* ~ *] %= $ + dab r.dab + axe (peg axe 3) + yeb [[(peg axe 2) q.n.dab] yeb] + == + [* * *] %= $ + dab r.dab + axe (peg axe 7) + yeb %= $ + dab l.dab + axe (peg axe 6) + yeb [[(peg axe 2) q.n.dab] yeb] + == == == + -- + :: + ++ lose + ~/ %lose + |= gen=hoon ^- type + (chip | gen) + :: + ++ chip + ~/ %chip + |= [how=? gen=hoon] ^- type + ?: ?=([%wtts *] gen) + (cool how q.gen (play ~(example ax p.gen))) + ?: ?=([%wthx *] gen) + =+ fid=(find %both q.gen) + ?- -.fid + %| sut + %& =< q + %+ take p.p.fid + |=(a=type ?:(how ~(gain ar a p.gen) ~(lose ar a p.gen))) + == + ?: ?&(how ?=([%wtpm *] gen)) + |-(?~(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen)))) + ?: ?&(!how ?=([%wtbr *] gen)) + |-(?~(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen)))) + =+ neg=~(open ap gen) + ?:(=(neg gen) sut $(gen neg)) + :: + ++ bake + |= [dox=type hud=poly dab=(map term hoon)] + ^- * + ?: ?=(~ dab) + ~ + =+ ^= dov + :: this seems wrong but it's actually right + :: + ?- hud + %dry (mull %noun dox q.n.dab) + %wet ~ + == + ?- dab + [* ~ ~] dov + [* ~ *] [dov $(dab r.dab)] + [* * ~] [dov $(dab l.dab)] + [* * *] [dov $(dab l.dab) $(dab r.dab)] + == + :: + ++ balk + |= [dox=type hud=poly dom=(map term tome)] + ^- * + ?: ?=(~ dom) + ~ + =+ dov=(bake dox hud q.q.n.dom) + ?- dom + [* ~ ~] dov + [* ~ *] [dov $(dom r.dom)] + [* * ~] [dov $(dom l.dom)] + [* * *] [dov $(dom l.dom) $(dom r.dom)] + == + :: + ++ mile + :: mull all chapters and feet in a core + :: + |= [dox=type mel=vair nym=(unit term) hud=poly dom=(map term tome)] + ^- (pair type type) + =+ yet=(core sut [nym hud %gold] sut (laze nym hud dom) dom) + =+ hum=(core dox [nym hud %gold] dox (laze nym hud dom) dom) + =+ (balk(sut yet) hum hud dom) + [yet hum] + :: + ++ mine + :: mint all chapters and feet in a core + :: + |= [gol=type mel=vair nym=(unit term) hud=poly dom=(map term tome)] + ^- (pair type nock) + |^ + =/ log (chapters-check (core-check gol)) + =/ dog (get-tomes log) + =- :_ [%1 dez] + (core sut [nym hud mel] sut [[%full ~] dez] dom) + ^= dez + =. sut (core sut [nym hud %gold] sut (laze nym hud dom) dom) + |- ^- ?(~ ^) + ?: ?=(~ dom) + ~ + =/ dov=?(~ ^) + =/ dab=(map term hoon) q.q.n.dom + =/ dag (arms-check dab (get-arms dog p.n.dom)) + |- ^- ?(~ ^) + ?: ?=(~ dab) + ~ + =/ gog (get-arm-type log dag p.n.dab) + =+ vad=(hemp hud gog q.n.dab) + ?- dab + [* ~ ~] vad + [* ~ *] [vad $(dab r.dab)] + [* * ~] [vad $(dab l.dab)] + [* * *] [vad $(dab l.dab) $(dab r.dab)] + == + ?- dom + [* ~ ~] dov + [* ~ *] [dov $(dom r.dom)] + [* * ~] [dov $(dom l.dom)] + [* * *] [dov $(dom l.dom) $(dom r.dom)] + == + :: + :: all the below arms are used for gol checking and should have no + :: effect other than giving more specific errors + :: + :: +gol-type: all the possible types we could be expecting. + :: + +$ gol-type + $~ %noun + $@ %noun + $% [%cell p=type q=type] + [%core p=type q=coil] + [%fork p=(set gol-type)] + == + :: +core-check: check that we're looking for a core + :: + ++ core-check + |= log=type + |- ^- gol-type + ?+ log $(log repo(sut log)) + %noun (nice log &) + %void (nice %noun |) + [%atom *] (nice %noun |) + [%cell *] (nice log (nest(sut p.log) & %noun)) + [%core *] (nice log(r.p.q %gold) &) + [%fork *] + =/ tys ~(tap in p.log) + :- %fork + |- ^- (set gol-type) + ?~ tys + ~ + =/ a ^$(log i.tys) + =/ b $(tys t.tys) + (~(put in b) a) + == + :: +chapters-check: check we have the expected number of chapters + :: + ++ chapters-check + |= log=gol-type + |- ^- gol-type + ?- log + %noun (nice log &) + [%cell *] (nice log &) + [%core *] ~_ leaf+"core-number-of-chapters" + (nice log =(~(wyt by dom) ~(wyt by q.r.q.log))) + [%fork *] + =/ tys ~(tap in p.log) + |- ^- gol-type + ?~ tys + log + =/ a ^$(log i.tys) + =/ b $(tys t.tys) + log + == + :: +get-tomes: get map of tomes if exists + :: + ++ get-tomes + |= log=gol-type + ^- (unit (map term tome)) + ?- log + %noun ~ + [%cell *] ~ + [%fork *] ~ :: maybe could be more aggressive + [%core *] `q.r.q.log + == + :: +get-arms: get arms in tome + :: + ++ get-arms + |= [dog=(unit (map term tome)) nam=term] + ^- (unit (map term hoon)) + %+ bind dog + |= a=(map term tome) + ~_ leaf+"unexpcted-chapter.{(trip nam)}" + q:(~(got by a) nam) + :: +arms-check: check we have the expected number of arms + :: + ++ arms-check + |= [dab=(map term hoon) dag=(unit (map term hoon))] + ?~ dag + dag + =/ a + =/ exp ~(wyt by u.dag) + =/ hav ~(wyt by dab) + ~_ =/ expt (scow %ud exp) + =/ havt (scow %ud hav) + leaf+"core-number-of-arms.exp={expt}.hav={havt}" + ~_ =/ missing ~(tap in (~(dif in ~(key by u.dag)) ~(key by dab))) + leaf+"missing.{}" + ~_ =/ extra ~(tap in (~(dif in ~(key by dab)) ~(key by u.dag))) + leaf+"extra.{}" + ~_ =/ have ~(tap in ~(key by dab)) + leaf+"have.{}" + (nice dag =(exp hav)) + a + :: +get-arm-type: get expected type of this arm + :: + ++ get-arm-type + |= [log=gol-type dag=(unit (map term hoon)) nam=term] + ^- type + %- fall :_ %noun + %+ bind dag + |= a=(map term hoon) + =/ gen=hoon + ~_ leaf+"unexpected-arm.{(trip nam)}" + (~(got by a) nam) + (play(sut log) gen) + :: + ++ nice + |* [typ=* gud=?] + ?: gud + typ + ~_ leaf+"core-nice" + !! + -- + :: + ++ mint + ~/ %mint + |= [gol=type gen=hoon] + ^- [p=type q=nock] + ::~& %pure-mint + |^ ^- [p=type q=nock] + ?: ?&(=(%void sut) !?=([%dbug *] gen)) + ?. |(!vet ?=([%lost *] gen) ?=([%zpzp *] gen)) + ~>(%mean.'mint-vain' !!) + [%void %0 0] + ?- gen + :: + [^ *] + =+ hed=$(gen p.gen, gol %noun) + =+ tal=$(gen q.gen, gol %noun) + [(nice (cell p.hed p.tal)) (cons q.hed q.tal)] + :: + [%brcn *] (grow %gold p.gen %dry [%$ 1] q.gen) + [%brpt *] (grow %gold p.gen %wet [%$ 1] q.gen) + :: + [%cnts *] (~(mint et p.gen q.gen) gol) + :: + [%dtkt *] + =+ nef=$(gen [%kttr p.gen]) + [p.nef [%12 [%1 hoon-version p.nef] q:$(gen q.gen, gol %noun)]] + :: + [%dtls *] [(nice [%atom %$ ~]) [%4 q:$(gen p.gen, gol [%atom %$ ~])]] + [%sand *] [(nice (play gen)) [%1 q.gen]] + [%rock *] [(nice (play gen)) [%1 q.gen]] + :: + [%dttr *] + [(nice %noun) [%2 q:$(gen p.gen, gol %noun) q:$(gen q.gen, gol %noun)]] + :: + [%dtts *] + [(nice bool) [%5 q:$(gen p.gen, gol %noun) q:$(gen q.gen, gol %noun)]] + :: + [%dtwt *] [(nice bool) [%3 q:$(gen p.gen, gol %noun)]] + [%hand *] [p.gen q.gen] + [%ktbr *] =+(vat=$(gen p.gen) [(nice (wrap(sut p.vat) %iron)) q.vat]) + :: + [%ktls *] + =+(hif=(nice (play p.gen)) [hif q:$(gen q.gen, gol hif)]) + :: + [%ktpm *] =+(vat=$(gen p.gen) [(nice (wrap(sut p.vat) %zinc)) q.vat]) + [%ktsg *] (blow gol p.gen) + [%tune *] [(face p.gen sut) [%0 %1]] + [%ktwt *] =+(vat=$(gen p.gen) [(nice (wrap(sut p.vat) %lead)) q.vat]) + :: + [%note *] + =+ hum=$(gen q.gen) + [(hint [sut p.gen] p.hum) q.hum] + :: + [%sgzp *] ~_(duck(sut (play p.gen)) $(gen q.gen)) + [%sggr *] + =+ hum=$(gen q.gen) + :: ?: &(huz !?=(%|(@ [?(%sgcn %sgls) ^]) p.gen)) + :: hum + :- p.hum + :+ %11 + ?- p.gen + @ p.gen + ^ [p.p.gen q:$(gen q.p.gen, gol %noun)] + == + q.hum + :: + [%tsgr *] + =+ fid=$(gen p.gen, gol %noun) + =+ dov=$(sut p.fid, gen q.gen) + [p.dov (comb q.fid q.dov)] + :: + [%tscm *] + $(gen q.gen, sut (busk p.gen)) + :: + [%wtcl *] + =+ nor=$(gen p.gen, gol bool) + =+ [fex=(gain p.gen) wux=(lose p.gen)] + :: + :: if either branch is impossible, eliminate it + :: (placing the conditional in a dynamic hint to preserve crashes) + :: + =+ ^= [ned duy] + ?- - + [%void %void] |+[%0 0] + [%void *] &+[%1 |] + [* %void] &+[%1 &] + * |+q.nor + == + =+ hiq=$(sut fex, gen q.gen) + =+ ran=$(sut wux, gen r.gen) + =+ fol=(cond duy q.hiq q.ran) + [(fork p.hiq p.ran ~) ?.(ned fol [%11 [%toss q.nor] fol])] + :: + [%wthx *] + :- (nice bool) + =+ fid=(fend %read [[%& 1] q.gen]) + (~(fish ar `type`p.fid `skin`p.gen) q.fid) + :: + [%fits *] + :- (nice bool) + =+ ref=(play p.gen) + =+ fid=(find %read q.gen) + ~| [%test q.gen] + |- ^- nock + ?- -.fid + %& ?- -.q.p.fid + %& (fish(sut ref) (tend p.p.fid)) + %| $(fid [%| (fine fid)]) + == + %| [%7 q.p.fid (fish(sut ref) 1)] + == + :: + [%dbug *] + ~_ (show %o p.gen) + =+ hum=$(gen q.gen) + [p.hum [%11 [%spot %1 p.gen] q.hum]] + :: + [%zpcm *] [(nice (play p.gen)) [%1 q.gen]] :: XX validate! + [%lost *] + ?: vet + ~_ (dunk(sut (play p.gen)) 'lost') + ~>(%mean.'mint-lost' !!) + [%void [%0 0]] + :: + [%zpmc *] + =+ vos=$(gol %noun, gen q.gen) + =+ ref=p:$(gol %noun, gen p.gen) + [(nice (cell ref p.vos)) (cons [%1 burp(sut p.vos)] q.vos)] + :: + [%zpgl *] + =/ typ (nice (play [%kttr p.gen])) + =/ val + =< q + %_ $ + gol %noun + gen + :^ %wtcl + :+ %cncl [%limb %levi] + :~ [%tsgr [%zpgr [%kttr p.gen]] [%$ 2]] + [%tsgr q.gen [%$ 2]] + == + [%tsgr q.gen [%$ 3]] + [%zpzp ~] + == + [typ val] + :: + [%zpts *] [(nice %noun) [%1 q:$(vet |, gen p.gen)]] + [%zppt *] ?.((feel p.gen) $(gen q.gen) $(gen r.gen)) + :: + [%zpzp ~] [%void [%0 0]] + * + =+ doz=~(open ap gen) + ?: =(doz gen) + ~_ (show [%c 'hoon'] [%q gen]) + ~>(%mean.'mint-open' !!) + $(gen doz) + == + :: + ++ nice + |= typ=type + ~_ leaf+"mint-nice" + ?> ?|(!vet (nest(sut gol) & typ)) + typ + :: + ++ grow + |= [mel=vair nym=(unit term) hud=poly ruf=hoon dom=(map term tome)] + ^- [p=type q=nock] + =+ dan=^$(gen ruf, gol %noun) + =+ pul=(mine gol mel nym hud dom) + [(nice p.pul) (cons q.pul q.dan)] + -- + :: + ++ moot + =+ gil=*(set type) + |- ^- ? + ?- sut + [%atom *] | + [%cell *] |($(sut p.sut) $(sut q.sut)) + [%core *] $(sut p.sut) + [%face *] $(sut q.sut) + [%fork *] (levy ~(tap in p.sut) |=(type ^$(sut +<))) + [%hint *] $(sut q.sut) + [%hold *] |((~(has in gil) sut) $(gil (~(put in gil) sut), sut repo)) + %noun | + %void & + == + :: + ++ mull + ~/ %mull + |= [gol=type dox=type gen=hoon] + |^ ^- [p=type q=type] + ?: =(%void sut) + ~>(%mean.'mull-none' !!) + ?- gen + :: + [^ *] + =+ hed=$(gen p.gen, gol %noun) + =+ tal=$(gen q.gen, gol %noun) + [(nice (cell p.hed p.tal)) (cell q.hed q.tal)] + :: + [%brcn *] (grow %gold p.gen %dry [%$ 1] q.gen) + [%brpt *] (grow %gold p.gen %wet [%$ 1] q.gen) + [%cnts *] (~(mull et p.gen q.gen) gol dox) + [%dtkt *] =+($(gen q.gen, gol %noun) $(gen [%kttr p.gen])) + [%dtls *] =+($(gen p.gen, gol [%atom %$ ~]) (beth [%atom %$ ~])) + [%sand *] (beth (play gen)) + [%rock *] (beth (play gen)) + :: + [%dttr *] + =+([$(gen p.gen, gol %noun) $(gen q.gen, gol %noun)] (beth %noun)) + :: + [%dtts *] + =+([$(gen p.gen, gol %noun) $(gen q.gen, gol %noun)] (beth bool)) + :: + [%dtwt *] =+($(gen p.gen, gol %noun) (beth bool)) :: XX =| + [%hand *] [p.gen p.gen] + [%ktbr *] + =+(vat=$(gen p.gen) [(wrap(sut p.vat) %iron) (wrap(sut q.vat) %iron)]) + :: + [%ktls *] + =+ hif=[p=(nice (play p.gen)) q=(play(sut dox) p.gen)] + =+($(gen q.gen, gol p.hif) hif) + :: + [%ktpm *] + =+(vat=$(gen p.gen) [(wrap(sut p.vat) %zinc) (wrap(sut q.vat) %zinc)]) + :: + [%tune *] + [(face p.gen sut) (face p.gen dox)] + :: + [%ktwt *] + =+(vat=$(gen p.gen) [(wrap(sut p.vat) %lead) (wrap(sut q.vat) %lead)]) + :: + [%note *] + =+ vat=$(gen q.gen) + [(hint [sut p.gen] p.vat) (hint [dox p.gen] q.vat)] + :: + [%ktsg *] $(gen p.gen) + [%sgzp *] ~_(duck(sut (play p.gen)) $(gen q.gen)) + [%sggr *] $(gen q.gen) + [%tsgr *] + =+ lem=$(gen p.gen, gol %noun) + $(gen q.gen, sut p.lem, dox q.lem) + :: + [%tscm *] + =/ boc (busk p.gen) + =/ nuf (busk(sut dox) p.gen) + $(gen q.gen, sut boc, dox nuf) + :: + [%wtcl *] + =+ nor=$(gen p.gen, gol bool) + =+ ^= hiq ^- [p=type q=type] + =+ fex=[p=(gain p.gen) q=(gain(sut dox) p.gen)] + ?: =(%void p.fex) + :- %void + ?: =(%void q.fex) + %void + ~>(%mean.'if-z' (play(sut q.fex) q.gen)) + ?: =(%void q.fex) + ~>(%mean.'mull-bonk-b' !!) + $(sut p.fex, dox q.fex, gen q.gen) + =+ ^= ran ^- [p=type q=type] + =+ wux=[p=(lose p.gen) q=(lose(sut dox) p.gen)] + ?: =(%void p.wux) + :- %void + ?: =(%void q.wux) + %void + ~>(%mean.'if-a' (play(sut q.wux) r.gen)) + ?: =(%void q.wux) + ~>(%mean.'mull-bonk-c' !!) + $(sut p.wux, dox q.wux, gen r.gen) + [(nice (fork p.hiq p.ran ~)) (fork q.hiq q.ran ~)] + :: + [%fits *] + =+ waz=[p=(play p.gen) q=(play(sut dox) p.gen)] + =+ ^= syx :- p=(cove q:(mint %noun [%wing q.gen])) + q=(cove q:(mint(sut dox) %noun [%wing q.gen])) + =+ pov=[p=(fish(sut p.waz) p.syx) q=(fish(sut q.waz) q.syx)] + ?. &(=(p.syx q.syx) =(p.pov q.pov)) + ~>(%mean.'mull-bonk-a' !!) + (beth bool) + :: + [%wthx *] + ~> %mean.'mull-bonk-x' + =+ :- new=[type=p axis=q]:(fend %read [[%& 1] q.gen]) + old=[type=p axis=q]:(fend(sut dox) %read [[%& 1] q.gen]) + ?> =(axis.old axis.new) + ?> (nest(sut type.old) & type.new) + (beth bool) + :: + [%dbug *] ~_((show %o p.gen) $(gen q.gen)) + [%zpcm *] [(nice (play p.gen)) (play(sut dox) p.gen)] + [%lost *] + ?: vet + :: ~_ (dunk(sut (play p.gen)) 'also') + ~>(%mean.'mull-skip' !!) + (beth %void) + :: + [%zpts *] (beth %noun) + :: + [%zpmc *] + =+ vos=$(gol %noun, gen q.gen) :: XX validate! + [(nice (cell (play p.gen) p.vos)) (cell (play(sut dox) p.gen) q.vos)] + :: + [%zpgl *] + :: XX is this right? + (beth (play [%kttr p.gen])) + :: + [%zppt *] + =+ [(feel p.gen) (feel(sut dox) p.gen)] + ?. =(-< ->) + ~>(%mean.'mull-bonk-f' !!) + ?. -< + $(gen q.gen) + $(gen r.gen) + :: + [%zpzp *] (beth %void) + * + =+ doz=~(open ap gen) + ?: =(doz gen) + ~_ (show [%c 'hoon'] [%q gen]) + ~>(%mean.'mull-open' !!) + $(gen doz) + == + :: + ++ beth + |= typ=type + [(nice typ) typ] + :: + ++ nice + |= typ=type + :: ~_ (dunk(sut gol) 'need') + :: ~_ (dunk(sut typ) 'have') + ~_ leaf+"mull-nice" + ?> ?|(!vet (nest(sut gol) & typ)) + typ + :: + ++ grow + |= [mel=vair nym=(unit term) hud=poly ruf=hoon dom=(map term tome)] + :: make al + ~_ leaf+"mull-grow" + ^- [p=type q=type] + =+ dan=^$(gen ruf, gol %noun) + =+ yaz=(mile(sut p.dan) q.dan mel nym hud dom) + [(nice p.yaz) q.yaz] + -- + ++ meet |=(ref=type &((nest | ref) (nest(sut ref) | sut))) + :: :: + ++ miss :: nonintersection + |= $: :: ref: symmetric type + :: + ref=type + == + :: intersection of sut and ref is empty + :: + ^- ? + =| gil=(set (set type)) + =< dext + |% + ++ dext + ^- ? + :: + ?: =(ref sut) + (nest(sut %void) | sut) + ?- sut + %void & + %noun (nest(sut %void) | ref) + [%atom *] sint + [%cell *] sint + [%core *] sint(sut [%cell %noun %noun]) + [%fork *] %+ levy ~(tap in p.sut) + |=(type dext(sut +<)) + [%face *] dext(sut q.sut) + [%hint *] dext(sut q.sut) + [%hold *] =+ (~(gas in *(set type)) `(list type)`[sut ref ~]) + ?: (~(has in gil) -) + & + %= dext + sut repo + gil (~(put in gil) -) + == == + ++ sint + ?+ ref dext(sut ref, ref sut) + [%atom *] ?. ?=([%atom *] sut) & + ?& ?=(^ q.ref) + ?=(^ q.sut) + !=(q.ref q.sut) + == + [%cell *] ?. ?=([%cell *] sut) & + ?| dext(sut p.sut, ref p.ref) + dext(sut q.sut, ref q.ref) + == == + -- + ++ mite |=(ref=type |((nest | ref) (nest(sut ref) & sut))) + ++ nest + ~/ %nest + |= [tel=? ref=type] + =| $: seg=(set type) :: degenerate sut + reg=(set type) :: degenerate ref + gil=(set [p=type q=type]) :: assume nest + == + =< dext + ~% %nest-in ..$ ~ + |% + ++ deem + |= [mel=vair ram=vair] + ^- ? + ?. |(=(mel ram) =(%lead mel) =(%gold ram)) | + ?- mel + %lead & + %gold meet + %iron dext(sut (peek(sut ref) %rite 2), ref (peek %rite 2)) + %zinc dext(sut (peek %read 2), ref (peek(sut ref) %read 2)) + == + :: + ++ deep + |= $: dom=(map term tome) + vim=(map term tome) + == + ^- ? + ?: ?=(~ dom) =(vim ~) + ?: ?=(~ vim) | + ?& =(p.n.dom p.n.vim) + $(dom l.dom, vim l.vim) + $(dom r.dom, vim r.vim) + :: + =+ [dab hem]=[q.q.n.dom q.q.n.vim] + |- ^- ? + ?: ?=(~ dab) =(hem ~) + ?: ?=(~ hem) | + ?& =(p.n.dab p.n.hem) + $(dab l.dab, hem l.hem) + $(dab r.dab, hem r.hem) + %= dext + sut (play q.n.dab) + ref (play(sut ref) q.n.hem) + == == == + :: + ++ dext + =< $ + ~% %nest-dext + ~ + |. + ^- ? + =- ?: - & + ?. tel | + ~_ (dunk %need) + ~_ (dunk(sut ref) %have) + ~> %mean.'nest-fail' + !! + ?: =(sut ref) & + ?- sut + %void sint + %noun & + [%atom *] ?. ?=([%atom *] ref) sint + ?& (fitz p.sut p.ref) + |(?=(~ q.sut) =(q.sut q.ref)) + == + [%cell *] ?. ?=([%cell *] ref) sint + ?& dext(sut p.sut, ref p.ref, seg ~, reg ~) + dext(sut q.sut, ref q.ref, seg ~, reg ~) + == + [%core *] ?. ?=([%core *] ref) sint + ?: =(q.sut q.ref) dext(sut p.sut, ref p.ref) + ?& =(q.p.q.sut q.p.q.ref) :: same wet/dry + meet(sut q.q.sut, ref p.sut) + dext(sut q.q.ref, ref p.ref) + (deem(sut q.q.sut, ref q.q.ref) r.p.q.sut r.p.q.ref) + ?: =(%wet q.p.q.sut) =(q.r.q.sut q.r.q.ref) + ?| (~(has in gil) [sut ref]) + %. [q.r.q.sut q.r.q.ref] + %= deep + gil (~(put in gil) [sut ref]) + sut sut(p q.q.sut, r.p.q %gold) + ref ref(p q.q.ref, r.p.q %gold) + == == + == + [%face *] dext(sut q.sut) + [%fork *] ?. ?=(?([%atom *] %noun [%cell *] [%core *]) ref) sint + (lien ~(tap in p.sut) |=(type dext(tel |, sut +<))) + [%hint *] dext(sut q.sut) + [%hold *] ?: (~(has in seg) sut) | + ?: (~(has in gil) [sut ref]) & + %= dext + sut repo + seg (~(put in seg) sut) + gil (~(put in gil) [sut ref]) + == == + :: + ++ meet &(dext dext(sut ref, ref sut)) + ++ sint + ^- ? + ?- ref + %noun | + %void & + [%atom *] | + [%cell *] | + [%core *] dext(ref repo(sut ref)) + [%face *] dext(ref q.ref) + [%fork *] (levy ~(tap in p.ref) |=(type dext(ref +<))) + [%hint *] dext(ref q.ref) + [%hold *] ?: (~(has in reg) ref) & + ?: (~(has in gil) [sut ref]) & + %= dext + ref repo(sut ref) + reg (~(put in reg) ref) + gil (~(put in gil) [sut ref]) + == == + -- + :: + ++ peek + ~/ %peek + |= [way=?(%read %rite %both %free) axe=axis] + ^- type + ?: =(1 axe) + sut + =+ [now=(cap axe) lat=(mas axe)] + =+ gil=*(set type) + |- ^- type + ?- sut + [%atom *] %void + [%cell *] ?:(=(2 now) ^$(sut p.sut, axe lat) ^$(sut q.sut, axe lat)) + [%core *] + ?. =(3 now) %noun + =+ pec=(peel way r.p.q.sut) + =/ tow + ?: =(1 lat) 1 + (cap lat) + %= ^$ + axe lat + sut + ?: ?| =([& &] pec) + &(sam.pec =(tow 2)) + &(con.pec =(tow 3)) + == + p.sut + ~_ leaf+"payload-block" + ?. =(way %read) !! + %+ cell + ?.(sam.pec %noun ^$(sut p.sut, axe 2)) + ?.(con.pec %noun ^$(sut p.sut, axe 3)) + == + :: + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hold *] + ?: (~(has in gil) sut) + %void + $(gil (~(put in gil) sut), sut repo) + :: + %void %void + %noun %noun + * $(sut repo) + == + :: + ++ peel + |= [way=vial met=?(%gold %iron %lead %zinc)] + ^- [sam=? con=?] + ?: ?=(%gold met) [& &] + ?- way + %both [| |] + %free [& &] + %read [?=(%zinc met) |] + %rite [?=(%iron met) |] + == + :: + ++ play + ~/ %play + => .(vet |) + |= gen=hoon + ^- type + ?- gen + [^ *] (cell $(gen p.gen) $(gen q.gen)) + [%brcn *] (core sut [p.gen %dry %gold] sut *seminoun q.gen) + [%brpt *] (core sut [p.gen %wet %gold] sut *seminoun q.gen) + [%cnts *] ~(play et p.gen q.gen) + [%dtkt *] $(gen [%kttr p.gen]) + [%dtls *] [%atom %$ ~] + [%rock *] |- ^- type + ?@ q.gen [%atom p.gen `q.gen] + [%cell $(q.gen -.q.gen) $(q.gen +.q.gen)] + [%sand *] ?@ q.gen + ?: =(%n p.gen) ?>(=(0 q.gen) [%atom p.gen `q.gen]) + ?: =(%f p.gen) ?>((lte q.gen 1) bool) + [%atom p.gen ~] + $(-.gen %rock) + [%tune *] (face p.gen sut) + [%dttr *] %noun + [%dtts *] bool + [%dtwt *] bool + [%hand *] p.gen + [%ktbr *] (wrap(sut $(gen p.gen)) %iron) + [%ktls *] $(gen p.gen) + [%ktpm *] (wrap(sut $(gen p.gen)) %zinc) + [%ktsg *] $(gen p.gen) + [%ktwt *] (wrap(sut $(gen p.gen)) %lead) + [%note *] (hint [sut p.gen] $(gen q.gen)) + [%sgzp *] ~_(duck(sut ^$(gen p.gen)) $(gen q.gen)) + [%sggr *] $(gen q.gen) + [%tsgr *] $(gen q.gen, sut $(gen p.gen)) + [%tscm *] $(gen q.gen, sut (busk p.gen)) + [%wtcl *] =+ [fex=(gain p.gen) wux=(lose p.gen)] + %- fork :~ + ?:(=(%void fex) %void $(sut fex, gen q.gen)) + ?:(=(%void wux) %void $(sut wux, gen r.gen)) + == + [%fits *] bool + [%wthx *] bool + [%dbug *] ~_((show %o p.gen) $(gen q.gen)) + [%zpcm *] $(gen p.gen) + [%lost *] %void + [%zpmc *] (cell $(gen p.gen) $(gen q.gen)) + [%zpgl *] (play [%kttr p.gen]) + [%zpts *] %noun + [%zppt *] ?.((feel p.gen) $(gen q.gen) $(gen r.gen)) + [%zpzp *] %void + * =+ doz=~(open ap gen) + ?: =(doz gen) + ~_ (show [%c 'hoon'] [%q gen]) + ~> %mean.'play-open' + !! + $(gen doz) + == + :: :: + ++ redo :: refurbish faces + ~/ %redo + |= $: :: ref: raw payload + :: + ref=type + == + :: :type: subject refurbished to reference namespace + :: + ^- type + :: hos: subject tool stack + :: wec: reference tool stack set + :: gil: repetition set + :: + =| hos=(list tool) + =/ wec=(set (list tool)) [~ ~ ~] + =| gil=(set (pair type type)) + =< :: errors imply subject/reference mismatch + :: + ~| %redo-match + :: reduce by subject + :: + dext + |% + :: :: + ++ dear :: resolve tool stack + :: :(unit (list tool)): unified tool stack + :: + ^- (unit (list tool)) + :: empty implies void + :: + ?~ wec `~ + :: any reference faces must be clear + :: + ?. ?=([* ~ ~] wec) + ~& [%dear-many wec] + ~ + :- ~ + :: har: single reference tool stack + :: + =/ har n.wec + :: len: lengths of [sut ref] face stacks + :: + =/ len [p q]=[(lent hos) (lent har)] + :: lip: length of sut-ref face stack overlap + :: + :: AB + :: BC + :: + :: +lip is (lent B), where +hay is forward AB + :: and +liv is forward BC (stack BA and CB). + :: + :: overlap is a weird corner case. +lip is + :: almost always 0. brute force is fine. + :: + =/ lip + =| lup=(unit @ud) + =| lip=@ud + |- ^- @ud + ?: |((gth lip p.len) (gth lip q.len)) + (fall lup 0) + :: lep: overlap candidate: suffix of subject face stack + :: + =/ lep (slag (sub p.len lip) hos) + :: lap: overlap candidate: prefix of reference face stack + :: + =/ lap (scag lip har) + :: save any match and continue + :: + $(lip +(lip), lup ?.(=(lep lap) lup `lip)) + :: ~& [har+har hos+hos len+len lip+lip] + :: produce combined face stack (forward ABC, stack CBA) + :: + (weld hos (slag lip har)) + :: :: + ++ dext :: subject traverse + :: :type: refurbished subject + :: + ^- type + :: check for trivial cases + :: + ?: ?| =(sut ref) + ?=(?(%noun %void [?(%atom %core) *]) ref) + == + done + :: ~_ (dunk 'redo: dext: sut') + :: ~_ (dunk(sut ref) 'redo: dext: ref') + ?- sut + ?(%noun %void [?(%atom %core) *]) + :: reduce reference and reassemble leaf + :: + done:(sint &) + :: + [%cell *] + :: reduce reference to match subject + :: + => (sint &) + ?> ?=([%cell *] sut) + :: leaf with possible recursive descent + :: + %= done + sut + :: clear face stacks for descent + :: + =: hos ~ + wec [~ ~ ~] + == + :: descend into cell + :: + :+ %cell + dext(sut p.sut, ref (peek(sut ref) %free 2)) + dext(sut q.sut, ref (peek(sut ref) %free 3)) + == + :: + [%face *] + :: push face on subject stack, and descend + :: + dext(hos [p.sut hos], sut q.sut) + :: + [%hint *] + :: work through hint + :: + (hint p.sut dext(sut q.sut)) + :: + [%fork *] + :: reconstruct each case in fork + :: + (fork (turn ~(tap in p.sut) |=(type dext(sut +<)))) + :: + [%hold *] + :: reduce to hard + :: + => (sint |) + ?> ?=([%hold *] sut) + ?: (~(has in fan) [p.sut q.sut]) + :: repo loop; redo depends on its own product + :: + done:(sint &) + ?: (~(has in gil) [sut ref]) + :: type recursion, stop renaming + :: + done:(sint |) + :: restore unchanged holds + :: + =+ repo + =- ?:(=(- +<) sut -) + dext(sut -, gil (~(put in gil) sut ref)) + == + :: :: + ++ done :: complete assembly + ^- type + :: :type: subject refurbished + :: + :: lov: combined face stack + :: + =/ lov + =/ lov dear + ?~ lov + :: ~_ (dunk 'redo: dear: sut') + :: ~_ (dunk(sut ref) 'redo: dear: ref') + ~& [%wec wec] + !! + (need lov) + :: recompose faces + :: + |- ^- type + ?~ lov sut + $(lov t.lov, sut (face i.lov sut)) + :: + ++ sint :: reduce by reference + |= $: :: hod: expand holds + :: + hod=? + == + :: ::.: reference with face/fork/hold reduced + :: + ^+ . + :: =- ~> %slog.[0 (dunk 'sint: sut')] + :: ~> %slog.[0 (dunk(sut ref) 'sint: ref')] + :: ~> %slog.[0 (dunk(sut =>(- ref)) 'sint: pro')] + :: - + ?+ ref . + [%hint *] $(ref q.ref) + [%face *] + :: extend all stacks in set + :: + %= $ + ref q.ref + wec (~(run in wec) |=((list tool) [p.ref +<])) + == + :: + [%fork *] + :: reconstruct all relevant cases + :: + =- :: ~> %slog.[0 (dunk 'fork: sut')] + :: ~> %slog.[0 (dunk(sut ref) 'fork: ref')] + :: ~> %slog.[0 (dunk(sut (fork ->)) 'fork: pro')] + +(wec -<, ref (fork ->)) + =/ moy ~(tap in p.ref) + |- ^- (pair (set (list tool)) (list type)) + ?~ moy [~ ~] + :: head recurse + :: + =/ mor $(moy t.moy) + :: prune reference cases outside subject + :: + ?: (miss i.moy) mor + :: unify all cases + :: + =/ dis ^$(ref i.moy) + [(~(uni in p.mor) wec.dis) [ref.dis q.mor]] + :: + [%hold *] + ?. hod . + $(ref repo(sut ref)) + == + -- + :: + ++ repo + ^- type + ?- sut + [%core *] [%cell %noun p.sut] + [%face *] q.sut + [%hint *] q.sut + [%hold *] (rest [[p.sut q.sut] ~]) + %noun (fork [%atom %$ ~] [%cell %noun %noun] ~) + * ~>(%mean.'repo-fltt' !!) + == + :: + ++ rest + ~/ %rest + |= leg=(list [p=type q=hoon]) + ^- type + ?: (lien leg |=([p=type q=hoon] (~(has in fan) [p q]))) + ~>(%mean.'rest-loop' !!) + => .(fan (~(gas in fan) leg)) + %- fork + %~ tap in + %- ~(gas in *(set type)) + (turn leg |=([p=type q=hoon] (play(sut p) q))) + :: + ++ sink + =< $ + ~% %sink ..sink ~ + |% + ++ $ + ^- cord + ?- sut + %void 'void' + %noun 'noun' + [%atom *] (rap 3 'atom ' p.sut ' ' ?~(q.sut '~' u.q.sut) ~) + [%cell *] (rap 3 'cell ' (mup p.sut) ' ' (mup q.sut) ~) + [%face *] (rap 3 'face ' ?@(p.sut p.sut (mup p.sut)) ' ' (mup q.sut) ~) + [%fork *] (rap 3 'fork ' (mup p.sut) ~) + [%hint *] (rap 3 'hint ' (mup p.sut) ' ' (mup q.sut) ~) + [%hold *] (rap 3 'hold ' (mup p.sut) ' ' (mup q.sut) ~) + :: + [%core *] + %+ rap 3 + :~ 'core ' + (mup p.sut) + ' ' + ?~(p.p.q.sut '~' u.p.p.q.sut) + ' ' + q.p.q.sut + ' ' + r.p.q.sut + ' ' + (mup q.q.sut) + ' ' + (mup p.r.q.sut) + == + == + :: + ++ mup |=(* (scot %p (mug +<))) + -- + :: + ++ take + |= [vit=vein duz=$-(type type)] + ^- (pair axis type) + :- (tend vit) + =. vit (flop vit) + |- ^- type + ?~ vit (duz sut) + ?~ i.vit + |- ^- type + ?+ sut ^$(vit t.vit) + [%face *] (face p.sut ^$(vit t.vit, sut q.sut)) + [%hint *] (hint p.sut ^$(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hold *] $(sut repo) + == + =+ vil=*(set type) + |- ^- type + ?: =(1 u.i.vit) + ^$(vit t.vit) + =+ [now lat]=(cap u.i.vit)^(mas u.i.vit) + ?- sut + %noun $(sut [%cell %noun %noun]) + %void %void + [%atom *] %void + [%cell *] ?: =(2 now) + (cell $(sut p.sut, u.i.vit lat) q.sut) + (cell p.sut $(sut q.sut, u.i.vit lat)) + [%core *] ?: =(2 now) + $(sut repo) + (core $(sut p.sut, u.i.vit lat) q.sut) + [%face *] (face p.sut $(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hint *] (hint p.sut $(sut q.sut)) + [%hold *] ?: (~(has in vil) sut) + %void + $(sut repo, vil (~(put in vil) sut)) + == + :: + ++ tack + |= [hyp=wing mur=type] + ~_ (show [%c %tack] %l hyp) + =+ fid=(find %rite hyp) + ?> ?=(%& -.fid) + (take p.p.fid |=(type mur)) + :: + ++ tend + |= vit=vein + ^- axis + ?~(vit 1 (peg $(vit t.vit) ?~(i.vit 1 u.i.vit))) + :: + ++ toss + ~/ %toss + |= [hyp=wing mur=type men=(list [p=type q=foot])] + ^- [p=axis q=(list [p=type q=foot])] + =- [(need p.wib) q.wib] + ^= wib + |- ^- [p=(unit axis) q=(list [p=type q=foot])] + ?~ men + [*(unit axis) ~] + =+ geq=(tack(sut p.i.men) hyp mur) + =+ mox=$(men t.men) + [(mate p.mox `_p.mox`[~ p.geq]) [[q.geq q.i.men] q.mox]] + :: + ++ wrap + ~/ %wrap + |= yoz=?(%lead %iron %zinc) + ~_ leaf+"wrap" + ^- type + ?+ sut sut + [%cell *] (cell $(sut p.sut) $(sut q.sut)) + [%core *] ?>(|(=(%gold r.p.q.sut) =(%lead yoz)) sut(r.p.q yoz)) + [%face *] (face p.sut $(sut q.sut)) + [%fork *] (fork (turn ~(tap in p.sut) |=(type ^$(sut +<)))) + [%hint *] (hint p.sut $(sut q.sut)) + [%hold *] $(sut repo) + == + -- +++ us :: prettyprinter + => |% + +$ cape [p=(map @ud wine) q=wine] :: + +$ wine :: + $@ $? %noun :: + %path :: + %type :: + %void :: + %wall :: + %wool :: + %yarn :: + == :: + $% [%mato p=term] :: + [%core p=(list @ta) q=wine] :: + [%face p=term q=wine] :: + [%list p=term q=wine] :: + [%pear p=term q=@] :: + [%bcwt p=(list wine)] :: + [%plot p=(list wine)] :: + [%stop p=@ud] :: + [%tree p=term q=wine] :: + [%unit p=term q=wine] :: + [%name p=stud q=wine] :: + == :: + -- + |_ sut=type + ++ dash + |= [mil=tape lim=char lam=tape] + ^- tape + =/ esc (~(gas in *(set @tD)) lam) + :- lim + |- ^- tape + ?~ mil [lim ~] + ?: ?| =(lim i.mil) + =('\\' i.mil) + (~(has in esc) i.mil) + == + ['\\' i.mil $(mil t.mil)] + ?: (lte ' ' i.mil) + [i.mil $(mil t.mil)] + ['\\' ~(x ne (rsh 2 i.mil)) ~(x ne (end 2 i.mil)) $(mil t.mil)] + :: + ++ deal |=(lum=* (dish dole lum)) + ++ dial + |= ham=cape + =+ gid=*(set @ud) + =< `tank`-:$ + |% + ++ many + |= haz=(list wine) + ^- [(list tank) (set @ud)] + ?~ haz [~ gid] + =^ mor gid $(haz t.haz) + =^ dis gid ^$(q.ham i.haz) + [[dis mor] gid] + :: + ++ $ + ^- [tank (set @ud)] + ?- q.ham + %noun :_(gid [%leaf '*' ~]) + %path :_(gid [%leaf '/' ~]) + %type :_(gid [%leaf '#' 't' ~]) + %void :_(gid [%leaf '#' '!' ~]) + %wool :_(gid [%leaf '*' '"' '"' ~]) + %wall :_(gid [%leaf '*' '\'' '\'' ~]) + %yarn :_(gid [%leaf '"' '"' ~]) + [%mato *] :_(gid [%leaf '@' (trip p.q.ham)]) + [%core *] + =^ cox gid $(q.ham q.q.ham) + :_ gid + :+ %rose + [[' ' ~] ['<' ~] ['>' ~]] + |- ^- (list tank) + ?~ p.q.ham [cox ~] + [[%leaf (rip 3 i.p.q.ham)] $(p.q.ham t.p.q.ham)] + :: + [%face *] + =^ cox gid $(q.ham q.q.ham) + :_(gid [%palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] cox ~]) + :: + [%list *] + =^ cox gid $(q.ham q.q.ham) + :_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~]) + :: + [%bcwt *] + =^ coz gid (many p.q.ham) + :_(gid [%rose [[' ' ~] ['?' '(' ~] [')' ~]] coz]) + :: + [%plot *] + =^ coz gid (many p.q.ham) + :_(gid [%rose [[' ' ~] ['[' ~] [']' ~]] coz]) + :: + [%pear *] + :_(gid [%leaf '%' ~(rend co [%$ p.q.ham q.q.ham])]) + :: + [%stop *] + =+ num=~(rend co [%$ %ud p.q.ham]) + ?: (~(has in gid) p.q.ham) + :_(gid [%leaf '#' num]) + =^ cox gid + %= $ + gid (~(put in gid) p.q.ham) + q.ham (~(got by p.ham) p.q.ham) + == + :_(gid [%palm [['.' ~] ~ ~ ~] [%leaf ['^' '#' num]] cox ~]) + :: + [%tree *] + =^ cox gid $(q.ham q.q.ham) + :_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~]) + :: + [%unit *] + =^ cox gid $(q.ham q.q.ham) + :_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~]) + :: + [%name *] + :_ gid + ?@ p.q.ham (cat 3 '#' mark.p.q.ham) + (rap 3 '#' auth.p.q.ham '+' (spat type.p.q.ham) ~) + == + -- + :: + ++ dish !: + |= [ham=cape lum=*] ^- tank + ~| [%dish-h ?@(q.ham q.ham -.q.ham)] + %- need + =| gil=(set [@ud *]) + |- ^- (unit tank) + ?- q.ham + %noun + %= $ + q.ham + ?: ?=(@ lum) + [%mato %$] + :- %plot + |- ^- (list wine) + [%noun ?:(?=(@ +.lum) [[%mato %$] ~] $(lum +.lum))] + == + :: + %path + :- ~ + :+ %rose + [['/' ~] ['/' ~] ~] + |- ^- (list tank) + ?~ lum ~ + ?@ lum !! + ?> ?=(@ -.lum) + [[%leaf (rip 3 -.lum)] $(lum +.lum)] + :: + %type + =+ tyr=|.((dial dole)) + =+ vol=tyr(sut lum) + =+ cis=;;(tank .*(vol [%9 2 %0 1])) + :^ ~ %palm + [~ ~ ~ ~] + [[%leaf '#' 't' '/' ~] cis ~] + :: + %wall + :- ~ + :+ %rose + [[' ' ~] ['<' '|' ~] ['|' '>' ~]] + |- ^- (list tank) + ?~ lum ~ + ?@ lum !! + [[%leaf (trip ;;(@ -.lum))] $(lum +.lum)] + :: + %wool + :- ~ + :+ %rose + [[' ' ~] ['<' '<' ~] ['>' '>' ~]] + |- ^- (list tank) + ?~ lum ~ + ?@ lum !! + [(need ^$(q.ham %yarn, lum -.lum)) $(lum +.lum)] + :: + %yarn + [~ %leaf (dash (tape lum) '"' "\{")] + :: + %void + ~ + :: + [%mato *] + ?. ?=(@ lum) + ~ + :+ ~ + %leaf + ?+ (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig))) + ~(rend co [%$ p.q.ham lum]) + %$ ~(rend co [%$ %ud lum]) + %t (dash (rip 3 lum) '\'' ~) + %tas ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])] + == + :: + [%core *] + :: XX needs rethinking for core metal + :: ?. ?=(^ lum) ~ + :: => .(lum `*`lum) + :: =- ?~(tok ~ [~ %rose [[' ' ~] ['<' ~] ['>' ~]] u.tok]) + :: ^= tok + :: |- ^- (unit (list tank)) + :: ?~ p.q.ham + :: =+ den=^$(q.ham q.q.ham) + :: ?~(den ~ [~ u.den ~]) + :: =+ mur=$(p.q.ham t.p.q.ham, lum +.lum) + :: ?~(mur ~ [~ [[%leaf (rip 3 i.p.q.ham)] u.mur]]) + [~ (dial ham)] + :: + [%face *] + =+ wal=$(q.ham q.q.ham) + ?~ wal + ~ + [~ %palm [['=' ~] ~ ~ ~] [%leaf (trip p.q.ham)] u.wal ~] + :: + [%list *] + ?: =(~ lum) + [~ %leaf '~' ~] + =- ?~ tok + ~ + [~ %rose [[' ' ~] ['~' '[' ~] [']' ~]] u.tok] + ^= tok + |- ^- (unit (list tank)) + ?: ?=(@ lum) + ?.(=(~ lum) ~ [~ ~]) + =+ [for=^$(q.ham q.q.ham, lum -.lum) aft=$(lum +.lum)] + ?. &(?=(^ for) ?=(^ aft)) + ~ + [~ u.for u.aft] + :: + [%bcwt *] + |- ^- (unit tank) + ?~ p.q.ham + ~ + =+ wal=^$(q.ham i.p.q.ham) + ?~ wal + $(p.q.ham t.p.q.ham) + wal + :: + [%plot *] + =- ?~ tok + ~ + [~ %rose [[' ' ~] ['[' ~] [']' ~]] u.tok] + ^= tok + |- ^- (unit (list tank)) + ?~ p.q.ham + ~ + ?: ?=([* ~] p.q.ham) + =+ wal=^$(q.ham i.p.q.ham) + ?~(wal ~ [~ [u.wal ~]]) + ?@ lum + ~ + =+ gim=^$(q.ham i.p.q.ham, lum -.lum) + ?~ gim + ~ + =+ myd=$(p.q.ham t.p.q.ham, lum +.lum) + ?~ myd + ~ + [~ u.gim u.myd] + :: + [%pear *] + ?. =(lum q.q.ham) + ~ + =. p.q.ham + (rash p.q.ham ;~(sfix (cook crip (star low)) (star hig))) + =+ fox=$(q.ham [%mato p.q.ham]) + ?> ?=([~ %leaf ^] fox) + ?: ?=(?(%n %tas) p.q.ham) + fox + [~ %leaf '%' p.u.fox] + :: + [%stop *] + ?: (~(has in gil) [p.q.ham lum]) ~ + =+ kep=(~(get by p.ham) p.q.ham) + ?~ kep + ~|([%stop-loss p.q.ham] !!) + $(gil (~(put in gil) [p.q.ham lum]), q.ham u.kep) + :: + [%tree *] + =- ?~ tok + ~ + [~ %rose [[' ' ~] ['{' ~] ['}' ~]] u.tok] + ^= tok + =+ tuk=*(list tank) + |- ^- (unit (list tank)) + ?: =(~ lum) + [~ tuk] + ?. ?=([n=* l=* r=*] lum) + ~ + =+ rol=$(lum r.lum) + ?~ rol + ~ + =+ tim=^$(q.ham q.q.ham, lum n.lum) + ?~ tim + ~ + $(lum l.lum, tuk [u.tim u.rol]) + :: + [%unit *] + ?@ lum + ?.(=(~ lum) ~ [~ %leaf '~' ~]) + ?. =(~ -.lum) + ~ + =+ wal=$(q.ham q.q.ham, lum +.lum) + ?~ wal + ~ + [~ %rose [[' ' ~] ['[' ~] [']' ~]] [%leaf '~' ~] u.wal ~] + :: + [%name *] + $(q.ham q.q.ham) + == + :: + ++ doge + |= ham=cape + =- ?+ woz woz + [%list * [%mato %'ta']] %path + [%list * [%mato %'t']] %wall + [%list * [%mato %'tD']] %yarn + [%list * %yarn] %wool + == + ^= woz + ^- wine + ?. ?=([%stop *] q.ham) + ?: ?& ?= [%bcwt [%pear %n %0] [%plot [%pear %n %0] [%face *] ~] ~] + q.ham + =(1 (met 3 p.i.t.p.i.t.p.q.ham)) + == + [%unit =<([p q] i.t.p.i.t.p.q.ham)] + q.ham + =+ may=(~(get by p.ham) p.q.ham) + ?~ may + q.ham + =+ nul=[%pear %n 0] + ?. ?& ?=([%bcwt *] u.may) + ?=([* * ~] p.u.may) + |(=(nul i.p.u.may) =(nul i.t.p.u.may)) + == + q.ham + =+ din=?:(=(nul i.p.u.may) i.t.p.u.may i.p.u.may) + ?: ?& ?=([%plot [%face *] [%face * %stop *] ~] din) + =(p.q.ham p.q.i.t.p.din) + =(1 (met 3 p.i.p.din)) + =(1 (met 3 p.i.t.p.din)) + == + :+ %list + (cat 3 p.i.p.din p.i.t.p.din) + q.i.p.din + ?: ?& ?= $: %plot + [%face *] + [%face * %stop *] + [[%face * %stop *] ~] + == + din + =(p.q.ham p.q.i.t.p.din) + =(p.q.ham p.q.i.t.t.p.din) + =(1 (met 3 p.i.p.din)) + =(1 (met 3 p.i.t.p.din)) + =(1 (met 3 p.i.t.t.p.din)) + == + :+ %tree + %^ cat + 3 + p.i.p.din + (cat 3 p.i.t.p.din p.i.t.t.p.din) + q.i.p.din + q.ham + :: + ++ dole + ^- cape + =+ gil=*(set type) + =+ dex=[p=*(map type @) q=*(map @ wine)] + =< [q.p q] + |- ^- [p=[p=(map type @) q=(map @ wine)] q=wine] + =- [p.tez (doge q.p.tez q.tez)] + ^= tez + ^- [p=[p=(map type @) q=(map @ wine)] q=wine] + ?: (~(meet ut sut) -:!>(*type)) + [dex %type] + ?- sut + %noun [dex sut] + %void [dex sut] + [%atom *] [dex ?~(q.sut [%mato p.sut] [%pear p.sut u.q.sut])] + [%cell *] + =+ hin=$(sut p.sut) + =+ yon=$(dex p.hin, sut q.sut) + :- p.yon + :- %plot + ?:(?=([%plot *] q.yon) [q.hin p.q.yon] [q.hin q.yon ~]) + :: + [%core *] + =+ yad=$(sut p.sut) + :- p.yad + =+ ^= doy ^- [p=(list @ta) q=wine] + ?: ?=([%core *] q.yad) + [p.q.yad q.q.yad] + [~ q.yad] + :- %core + :_ q.doy + :_ p.doy + %^ cat 3 + %~ rent co + :+ %$ %ud + %- ~(rep by (~(run by q.r.q.sut) |=(tome ~(wyt by q.+<)))) + |=([[@ a=@u] b=@u] (add a b)) + %^ cat 3 + ?-(r.p.q.sut %gold '.', %iron '|', %lead '?', %zinc '&') + =+ gum=(mug q.r.q.sut) + %+ can 3 + :~ [1 (add 'a' (mod gum 26))] + [1 (add 'a' (mod (div gum 26) 26))] + [1 (add 'a' (mod (div gum 676) 26))] + == + :: + [%hint *] + =+ yad=$(sut q.sut) + ?. ?=(%know -.q.p.sut) yad + [p.yad [%name p.q.p.sut q.yad]] + :: + [%face *] + =+ yad=$(sut q.sut) + ?^(p.sut yad [p.yad [%face p.sut q.yad]]) + :: + [%fork *] + =+ yed=(sort ~(tap in p.sut) aor) + =- [p [%bcwt q]] + |- ^- [p=[p=(map type @) q=(map @ wine)] q=(list wine)] + ?~ yed + [dex ~] + =+ mor=$(yed t.yed) + =+ dis=^$(dex p.mor, sut i.yed) + [p.dis q.dis q.mor] + :: + [%hold *] + =+ hey=(~(get by p.dex) sut) + ?^ hey + [dex [%stop u.hey]] + ?: (~(has in gil) sut) + =+ dyr=+(~(wyt by p.dex)) + [[(~(put by p.dex) sut dyr) q.dex] [%stop dyr]] + =+ rom=$(gil (~(put in gil) sut), sut ~(repo ut sut)) + =+ rey=(~(get by p.p.rom) sut) + ?~ rey + rom + [[p.p.rom (~(put by q.p.rom) u.rey q.rom)] [%stop u.rey]] + == + :: + ++ duck (dial dole) + -- +++ cain sell :: $-(vase tank) +++ noah text :: $-(vase tape) +++ onan seer :: $-(vise vase) +++ levi :: $-([type type] ?) + |= [a=type b=type] + (~(nest ut a) & b) +:: +++ text :: tape pretty-print + |= vax=vase ^- tape + ~(ram re (sell vax)) +:: +++ seem |=(toy=typo `type`toy) :: promote typo +++ seer |=(vix=vise `vase`vix) :: promote vise +:: +:: +sell: pretty-print a vase to a tank using +deal. +:: +++ sell + ~/ %sell + |= vax=vase + ^- tank + ~| %sell + (~(deal us p.vax) q.vax) +:: +:: +skol: $-(type tank) using duck. +:: +++ skol + |= typ=type + ^- tank + ~(duck ut typ) +:: +++ slam :: slam a gate + |= [gat=vase sam=vase] ^- vase + =+ :- ^= typ ^- type + [%cell p.gat p.sam] + ^= gen ^- hoon + [%cnsg [%$ ~] [%$ 2] [%$ 3] ~] + =+ gun=(~(mint ut typ) %noun gen) + [p.gun (slum q.gat q.sam)] +:: +:: +slab: states whether you can access an arm in a type. +:: +:: .way: the access type ($vial): read, write, or read-and-write. +:: The fourth case of $vial, %free, is not permitted because it would +:: allow you to discover "private" information about a type, +:: information which you could not make use of in (law-abiding) hoon anyway. +:: +++ slab :: test if contains + |= [way=?(%read %rite %both) cog=@tas typ=type] + ?= [%& *] + (~(fond ut typ) way ~[cog]) +:: +++ slap + |= [vax=vase gen=hoon] ^- vase :: untyped vase .* + =+ gun=(~(mint ut p.vax) %noun gen) + [p.gun .*(q.vax q.gun)] +:: +++ slub + |= [vax=vase gen=hoon] ^- vase :: memoized slap + =/ gun + => [vax=p=p.vax gen=gen ut=ut] + ~> %memo./hoon/mint + (~(mint ut p.vax) %noun gen) + [p.gun .*(q.vax q.gun)] +:: +++ slog :: deify printf + =| pri=@ :: priority level + |= a=tang ^+ same :: .= ~&(%a 1) + ?~(a same ~>(%slog.[pri i.a] $(a t.a))) :: ((slog ~[>%a<]) 1) +:: :: +++ mean :: crash with trace + |= a=tang + ^+ !! + ?~ a !! + ~_(i.a $(a t.a)) +:: +++ road + |* =(trap *) + ^+ $:trap + =/ res (mule trap) + ?- -.res + %& p.res + %| (mean p.res) + == +:: +++ slew :: get axis in vase + |= [axe=@ vax=vase] + =/ typ |. (~(peek ut p.vax) %free axe) + |- ^- (unit vase) + ?: =(1 axe) `[$:typ q.vax] + ?@ q.vax ~ + $(axe (mas axe), q.vax ?-((cap axe) %2 -.q.vax, %3 +.q.vax)) +:: +++ slim :: identical to seer? + |= old=vise ^- vase + old +:: +++ slit :: type of slam + |= [gat=type sam=type] + ?> (~(nest ut (~(peek ut gat) %free 6)) & sam) + (~(play ut [%cell gat sam]) [%cnsg [%$ ~] [%$ 2] [%$ 3] ~]) +:: +++ slob :: superficial arm + |= [cog=@tas typ=type] + ^- ? + ?+ typ | + [%hold *] $(typ ~(repo ut typ)) + [%hint *] $(typ ~(repo ut typ)) + [%core *] + |- ^- ? + ?~ q.r.q.typ | + ?| (~(has by q.q.n.q.r.q.typ) cog) + $(q.r.q.typ l.q.r.q.typ) + $(q.r.q.typ r.q.r.q.typ) + == + == +:: +++ sloe :: get arms in core + |= typ=type + ^- (list term) + ?+ typ ~ + [%hold *] $(typ ~(repo ut typ)) + [%hint *] $(typ ~(repo ut typ)) + [%core *] + %- zing + %+ turn ~(tap by q.r.q.typ) + |= [* b=tome] + %+ turn ~(tap by q.b) + |= [a=term *] + a + == +:: +++ slop :: cons two vases + |= [hed=vase tal=vase] + ^- vase + [[%cell p.hed p.tal] [q.hed q.tal]] +:: +++ slot :: got axis in vase + |= [axe=@ vax=vase] ^- vase + [(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])] +:: +++ slym :: slam w+o sample-type + |= [gat=vase sam=*] ^- vase + (slap gat(+<.q sam) [%limb %$]) +:: +++ sped :: reconstruct type + |= vax=vase + ^- vase + :_ q.vax + ?@ q.vax (~(fuse ut p.vax) [%atom %$ ~]) + ?@ -.q.vax + ^= typ + %- ~(play ut p.vax) + [%wtgr [%wtts [%leaf %tas -.q.vax] [%& 2]~] [%$ 1]] + (~(fuse ut p.vax) [%cell %noun %noun]) +:: +swat: deferred +slap +:: +++ swat + |= [tap=(trap vase) gen=hoon] + ^- (trap vase) + =/ gun (~(mint ut p:$:tap) %noun gen) + |. ~+ + [p.gun .*(q:$:tap q.gun)] +:: +:: 5d: parser ++| %parser +:: +:: +vang: set +vast params +:: +:: bug: debug mode +:: doc: doccord parsing +:: wer: where we are +:: +++ vang + |= [f=$@(? [bug=? doc=?]) wer=path] + %*(. vast bug ?@(f f bug.f), doc ?@(f & doc.f), wer wer) +:: +++ vast :: main parsing core + =+ [bug=`?`| wer=*path doc=`?`&] + |% + ++ gash %+ cook :: parse path + |= a=(list tyke) ^- tyke + ?~(a ~ (weld i.a $(a t.a))) + (more fas limp) + ++ gasp ;~ pose :: parse =path= etc. + %+ cook + |=([a=tyke b=tyke c=tyke] :(weld a b c)) + ;~ plug + (cook |=(a=(list) (turn a |=(b=* ~))) (star tis)) + (cook |=(a=hoon [[~ a] ~]) hasp) + (cook |=(a=(list) (turn a |=(b=* ~))) (star tis)) + == + (cook |=(a=(list) (turn a |=(b=* ~))) (plus tis)) + == + ++ glam ~+((glue ace)) + ++ hasp ;~ pose :: path element + (ifix [sel ser] wide) + (stag %cncl (ifix [pal par] (most ace wide))) + (stag %sand (stag %tas (cold %$ buc))) + (stag %sand (stag %t qut)) + %+ cook + |=(a=coin [%sand ?:(?=([~ %tas *] a) %tas %ta) ~(rent co a)]) + nuck:so + == + ++ limp %+ cook + |= [a=(list) b=tyke] + ?~ a b + $(a t.a, b [`[%sand %tas %$] b]) + ;~(plug (star fas) gasp) + ++ mota %+ cook + |=([a=tape b=tape] (rap 3 (weld a b))) + ;~(plug (star low) (star hig)) + ++ docs + |% + :: +apex: prefix comment. may contain batch comments. + :: + :: when a prefix doccord is parsed, it is possible that there is no +gap + :: afterward to be consumed, so we add an additional newline and + :: decrement the line number in the `hair` of the parser + :: + :: the reason for this is that the whitespace parsing under +vast seems + :: to factor more cleanly this way, at least compared to the variations + :: tried without the extra newline. this doesn't mean there isn't a + :: better factorization without it, though. + ++ apex + ?. doc (easy *whit) + %+ knee *whit |. ~+ + ;~ plug + |= tub=nail + =/ vex + %. tub + %- star + %+ cook |*([[a=* b=*] c=*] [a b c]) + ;~(pfix (punt leap) into ;~(pose larg smol)) + ?~ q.vex vex + :- p=p.vex + %- some + ?~ p.u.q.vex + [p=~ q=q.u.q.vex] + :- p=(malt p.u.q.vex) + q=`nail`[[(dec p.p.q.u.q.vex) q.p.q.u.q.vex] ['\0a' q.q.u.q.vex]] + == + :: + :: +apse: postfix comment. + :: + :: a one line comment at the end of a line (typically starting at column + :: 57) that attaches to the expression starting at the beginning of the + :: current line. does not use a $link. + ++ apse + ?. doc (easy *whiz) + %+ knee *whiz |. ~+ + ;~ pose + ;~(less ;~(plug into step en-link col ace) ;~(pfix into step line)) + :: + (easy *whiz) + == + :: + ++ leap :: whitespace w/o docs + %+ cold ~ + ;~ plug + ;~ pose + (just '\0a') + ;~(plug gah ;~(pose gah skip)) + skip + == + (star ;~(pose skip gah)) + == + :: + :: +smol: 2 aces then summary, 4 aces then paragraphs. + ++ smol + ;~ pfix + step + ;~ plug + ;~ plug + (plus en-link) + ;~ pose + (ifix [;~(plug col ace) (just '\0a')] (cook crip (plus prn))) + (ifix [(star ace) (just '\0a')] (easy *cord)) + == + == + (rant ;~(pfix step step text)) + == + == + :: + :: +larg: 4 aces then summary, 2 aces then paragraphs. + ++ larg + ;~ pfix + step step + ;~ plug + ;~ sfix + ;~ plug + ;~ pose + ;~(sfix (plus en-link) col ace) + ;~(less ace (easy *cuff)) + == + ;~(less ace (cook crip (plus prn))) + == + (just '\0a') + == + (rant ;~(pfix step teyt)) + == + == + :: + ++ rant + |* sec=rule + %- star + ;~ pfix + (ifix [into (just '\0a')] (star ace)) + (plus (ifix [into (just '\0a')] sec)) + == + :: + ++ skip :: non-doccord comment + ;~ plug + col col + ;~(less ;~(pose larg smol) ;~(plug (star prn) (just '\0a'))) + == + :: + ++ null (cold ~ (star ace)) + ++ text (pick line code) + ++ teyt (pick line ;~(pfix step code)) + ++ line ;~(less ace (cook crip (star prn))) + ++ code ;~(pfix step ;~(less ace (cook crip (star prn)))) + ++ step ;~(plug ace ace) + :: + ++ into + ;~(plug (star ace) col col) + :: + ++ en-link + |= a=nail %. a + %+ knee *link |. ~+ + %- stew + ^. stet ^. limo + :~ :- '|' ;~(pfix bar (stag %chat sym)) + :- '.' ;~(pfix dot (stag %frag sym)) + :- '+' ;~(pfix lus (stag %funk sym)) + :- '$' ;~(pfix buc (stag %plan sym)) + :- '%' ;~(pfix cen (stag %cone bisk:so)) + == + -- + :: + ++ clad :: hoon doccords + |* fel=rule + %+ cook + |= [a=whit b=hoon c=whiz] + =? b !=(c *whiz) + [%note help/`[c]~ b] + =+ docs=~(tap by bat.a) + |- + ?~ docs b + $(docs t.docs, b [%note help/i.docs b]) + (seam fel) + ++ coat :: spec doccords + |* fel=rule + %+ cook + |= [a=whit b=spec c=whiz] + =? b !=(c *whiz) + [%gist help/`[c]~ b] + =+ docs=~(tap by bat.a) + |- + ?~ docs b + $(docs t.docs, b [%gist help/i.docs b]) + (seam fel) + ++ scye :: with prefix doccords + |* fel=rule + ;~(pose ;~(plug apex:docs ;~(pfix gap fel)) ;~(plug (easy *whit) fel)) + ++ seam :: with doccords + |* fel=rule + (scye ;~(plug fel apse:docs)) + :: + ++ plex :: reparse static path + |= gen=hoon ^- (unit path) + ?: ?=([%dbug *] gen) :: unwrap %dbug + $(gen q.gen) + ?. ?=([%clsg *] gen) ~ :: require :~ hoon + %+ reel p.gen :: build using elements + |= [a=hoon b=_`(unit path)`[~ u=/]] :: starting from just / + ?~ b ~ + ?. ?=([%sand ?(%ta %tas) @] a) ~ :: /foo constants + `[q.a u.b] + :: + ++ phax + |= ruw=(list (list woof)) + =+ [yun=*(list hoon) cah=*(list @)] + =+ wod=|=([a=tape b=(list hoon)] ^+(b ?~(a b [[%mcfs %knit (flop a)] b]))) + |- ^+ yun + ?~ ruw + (flop (wod cah yun)) + ?~ i.ruw $(ruw t.ruw) + ?@ i.i.ruw + $(i.ruw t.i.ruw, cah [i.i.ruw cah]) + $(i.ruw t.i.ruw, cah ~, yun [p.i.i.ruw (wod cah yun)]) + :: + ++ posh + |= [pre=(unit tyke) pof=(unit [p=@ud q=tyke])] + ^- (unit (list hoon)) + =- ?^(- - ~&(%posh-fail -)) + =+ wom=(poof wer) + %+ biff + ?~ pre `u=wom + %+ bind (poon wom u.pre) + |= moz=(list hoon) + ?~(pof moz (weld moz (slag (lent u.pre) wom))) + |= yez=(list hoon) + ?~ pof `yez + =+ zey=(flop yez) + =+ [moz=(scag p.u.pof zey) gul=(slag p.u.pof zey)] + =+ zom=(poon (flop moz) q.u.pof) + ?~(zom ~ `(weld (flop gul) u.zom)) + :: + ++ poof :: path -> (list hoon) + |=(pax=path ^-((list hoon) (turn pax |=(a=@ta [%sand %ta a])))) + :: + :: tyke is =foo== as ~[~ `foo ~ ~] + :: interpolate '=' path components + ++ poon :: try to replace '='s + |= [pag=(list hoon) goo=tyke] :: default to pag + ^- (unit (list hoon)) :: for null goo's + ?~ goo `~ :: keep empty goo + %+ both :: otherwise head comes + ?^(i.goo i.goo ?~(pag ~ `u=i.pag)) :: from goo or pag + $(goo t.goo, pag ?~(pag ~ t.pag)) :: recurse on tails + :: + ++ poor + %+ sear posh + ;~ plug + (stag ~ gash) + ;~(pose (stag ~ ;~(pfix cen porc)) (easy ~)) + == + :: + ++ porc + ;~ plug + (cook |=(a=(list) (lent a)) (star cen)) + ;~(pfix fas gash) + == + :: + ++ rump + %+ sear + |= [a=wing b=(unit hoon)] ^- (unit hoon) + ?~(b [~ %wing a] ?.(?=([@ ~] a) ~ [~ [%rock %tas i.a] u.b])) + ;~(plug rope ;~(pose (stag ~ wede) (easy ~))) + :: + ++ rood + ;~ pfix fas + (stag %clsg poor) + == + :: + ++ reed + ;~ pfix fas + (stag %clsg (more fas stem)) + == + :: + ++ stem + %+ knee *hoon |. ~+ + %+ cook + |= iota=$%([%hoon =hoon] iota) + ?@ iota [%rock %tas iota] + ?: ?=(%hoon -.iota) hoon.iota + [%clhp [%rock %tas -.iota] [%sand iota]] + |^ =- ;~(pose - (easy %$)) + %- stew + ^. stet ^. limo + :~ :- 'a'^'z' ;~ pose + (spit (stag %cncl (ifix [pal par] (most ace wide)))) + (spit (ifix [sel ser] wide)) + (slot sym) + == + :- '$' (cold %$ buc) + :- '0'^'9' (slot bisk:so) + :- '-' (slot tash:so) + :- '.' ;~(pfix dot zust:so) + :- '~' (slot ;~(pfix sig ;~(pose crub:so (easy [%n ~])))) + :- '\'' (stag %t qut) + :- '[' (slip (ifix [sel ser] wide)) + :- '(' (slip (stag %cncl (ifix [pal par] (most ace wide)))) + == + :: + ++ slip |*(r=rule (stag %hoon r)) + ++ slot |*(r=rule (sear (soft iota) r)) + ++ spit + |* r=rule + %+ stag %hoon + %+ cook + |*([a=term b=*] `hoon`[%clhp [%rock %tas a] b]) + ;~((glue lus) sym r) + -- + :: + ++ rupl + %+ cook + |= [a=? b=(list hoon) c=?] + ?: a + ?: c + [%clsg [%clsg b] ~] + [%clsg b] + ?: c + [%clsg [%cltr b] ~] + [%cltr b] + ;~ plug + ;~ pose + (cold | (just '[')) + (cold & (jest '~[')) + == + :: + ;~ pose + (ifix [ace gap] (most gap tall)) + (most ace wide) + == + :: + ;~ pose + (cold & (jest ']~')) + (cold | (just ']')) + == + == + :: + :: + ++ sail :: xml template + |= in-tall-form=? =| lin=? + |% + :: + ++ apex :: product hoon + %+ cook + |= tum=(each manx:hoot marl:hoot) ^- hoon + ?- -.tum + %& [%xray p.tum] + %| [%mcts p.tum] + == + top-level + :: + ++ top-level :: entry-point + ;~(pfix mic ?:(in-tall-form tall-top wide-top)) + :: + ++ inline-embed :: brace interpolation + %+ cook |=(a=tuna:hoot a) + ;~ pose + ;~(pfix mic bracketed-elem(in-tall-form |)) + ;~(plug tuna-mode sump) + (stag %tape sump) + == + :: + ++ script-or-style :: script or style + %+ cook |=(a=marx:hoot a) + ;~ plug + ;~(pose (jest %script) (jest %style)) + wide-attrs + == + :: + ++ tuna-mode :: xml node(s) kind + ;~ pose + (cold %tape hep) + (cold %manx lus) + (cold %marl tar) + (cold %call cen) + == + :: + ++ wide-top :: wide outer top + %+ knee *(each manx:hoot marl:hoot) |. ~+ + ;~ pose + (stag %| wide-quote) + (stag %| wide-paren-elems) + (stag %& ;~(plug tag-head wide-tail)) + == + :: + ++ wide-inner-top :: wide inner top + %+ knee *(each tuna:hoot marl:hoot) |. ~+ + ;~ pose + wide-top + (stag %& ;~(plug tuna-mode wide)) + == + :: + ++ wide-attrs :: wide attributes + %+ cook |=(a=(unit mart:hoot) (fall a ~)) + %- punt + %+ ifix [pal par] + %+ more (jest ', ') + ;~((glue ace) a-mane hopefully-quote) + :: + ++ wide-tail :: wide elements + %+ cook |=(a=marl:hoot a) + ;~(pose ;~(pfix col wrapped-elems) (cold ~ mic) (easy ~)) + :: + ++ wide-elems :: wide elements + %+ cook |=(a=marl:hoot a) + %+ cook join-tops + (star ;~(pfix ace wide-inner-top)) + :: + ++ wide-paren-elems :: wide flow + %+ cook |=(a=marl:hoot a) + %+ cook join-tops + (ifix [pal par] (more ace wide-inner-top)) + :: + ::+| + :: + ++ drop-top + |= a=(each tuna:hoot marl:hoot) ^- marl:hoot + ?- -.a + %& [p.a]~ + %| p.a + == + :: + ++ join-tops + |= a=(list (each tuna:hoot marl:hoot)) ^- marl:hoot + (zing (turn a drop-top)) + :: + ::+| + :: + ++ wide-quote :: wide quote + %+ cook |=(a=marl:hoot a) + ;~ pose + ;~ less (jest '"""') + (ifix [doq doq] (cook collapse-chars quote-innards)) + == + :: + %- inde + %+ ifix [(jest '"""\0a') (jest '\0a"""')] + (cook collapse-chars quote-innards(lin |)) + == + :: + ++ quote-innards :: wide+tall flow + %+ cook |=(a=(list $@(@ tuna:hoot)) a) + %- star + ;~ pose + ;~(pfix bas ;~(pose (mask "-+*%;\{") bas doq bix:ab)) + inline-embed + ;~(less bas kel ?:(in-tall-form fail doq) prn) + ?:(lin fail ;~(less (jest '\0a"""') (just '\0a'))) + == + :: + ++ bracketed-elem :: bracketed element + %+ ifix [kel ker] + ;~(plug tag-head wide-elems) + :: + ++ wrapped-elems :: wrapped tuna + %+ cook |=(a=marl:hoot a) + ;~ pose + wide-paren-elems + (cook |=(@t `marl`[;/((trip +<))]~) qut) + (cook drop-top wide-top) + == + :: + ++ a-mane :: mane as hoon + %+ cook + |= [a=@tas b=(unit @tas)] + ?~(b a [a u.b]) + ;~ plug + mixed-case-symbol + ;~ pose + %+ stag ~ + ;~(pfix cab mixed-case-symbol) + (easy ~) + == + == + :: + ++ en-class + |= a=(list [%class p=term]) + ^- (unit [%class tape]) + ?~ a ~ + %- some + :- %class + |- + %+ welp (trip p.i.a) + ?~ t.a ~ + [' ' $(a t.a)] + :: + ++ tag-head :: tag head + %+ cook + |= [a=mane:hoot b=mart:hoot c=mart:hoot] + ^- marx:hoot + [a (weld b c)] + ;~ plug + a-mane + :: + %+ cook + |= a=(list (unit [term (list beer:hoot)])) + ^- (list [term (list beer:hoot)]) + :: discard nulls + (murn a same) + ;~ plug + (punt ;~(plug (cold %id hax) (cook trip sym))) + (cook en-class (star ;~(plug (cold %class dot) sym))) + (punt ;~(plug ;~(pose (cold %href fas) (cold %src pat)) soil)) + (easy ~) + == + :: + wide-attrs + == + :: + ++ tall-top :: tall top + %+ knee *(each manx:hoot marl:hoot) |. ~+ + ;~ pose + (stag %| ;~(pfix (plus ace) (cook collapse-chars quote-innards))) + (stag %& ;~(plug script-or-style script-style-tail)) + (stag %& tall-elem) + (stag %| wide-quote) + (stag %| ;~(pfix tis tall-tail)) + (stag %& ;~(pfix gar gap (stag [%div ~] cram))) + (stag %| ;~(plug ;~((glue gap) tuna-mode tall) (easy ~))) + (easy %| [;/("\0a")]~) + == + :: + ++ tall-attrs :: tall attributes + %- star + ;~ pfix ;~(plug gap tis) + ;~((glue gap) a-mane hopefully-quote) + == + :: + ++ tall-elem :: tall preface + %+ cook + |= [a=[p=mane:hoot q=mart:hoot] b=mart:hoot c=marl:hoot] + ^- manx:hoot + [[p.a (weld q.a b)] c] + ;~(plug tag-head tall-attrs tall-tail) + :: + ::REVIEW is there a better way to do this? + ++ hopefully-quote :: prefer "quote" form + %+ cook |=(a=(list beer:hoot) a) + %+ cook |=(a=hoon ?:(?=(%knit -.a) p.a [~ a]~)) + wide + :: + ++ script-style-tail :: unescaped tall tail + %+ cook |=(a=marl:hoot a) + %+ ifix [gap ;~(plug gap duz)] + %+ most gap + ;~ pfix mic + %+ cook |=(a=tape ;/(a)) + ;~ pose + ;~(pfix ace (star prn)) + (easy "\0a") + == + == + :: + ++ tall-tail :: tall tail + ?> in-tall-form + %+ cook |=(a=marl:hoot a) + ;~ pose + (cold ~ mic) + ;~(pfix col wrapped-elems(in-tall-form |)) + ;~(pfix col ace (cook collapse-chars(in-tall-form |) quote-innards)) + (ifix [gap ;~(plug gap duz)] tall-kids) + == + :: + ++ tall-kids :: child elements + %+ cook join-tops + :: look for sail first, or markdown if not + (most gap ;~(pose top-level (stag %| cram))) + :: + ++ collapse-chars :: group consec chars + |= reb=(list $@(@ tuna:hoot)) + ^- marl:hoot + =| [sim=(list @) tuz=marl:hoot] + |- ^- marl:hoot + ?~ reb + =. sim + ?. in-tall-form sim + [10 |-(?~(sim sim ?:(=(32 i.sim) $(sim t.sim) sim)))] + ?~(sim tuz [;/((flop sim)) tuz]) + ?@ i.reb + $(reb t.reb, sim [i.reb sim]) + ?~ sim [i.reb $(reb t.reb, sim ~)] + [;/((flop sim)) i.reb $(reb t.reb, sim ~)] + -- + ++ cram :: parse unmark + => |% + ++ item (pair mite marl:hoot) :: xml node generator + ++ colm @ud :: column + ++ tarp marl:hoot :: node or generator + ++ mite :: context + $? %down :: outer embed + %lunt :: unordered list + %lime :: list item + %lord :: ordered list + %poem :: verse + %bloc :: blockquote + %head :: heading + == :: + ++ trig :: line style + $: col=@ud :: start column + sty=trig-style :: style + == :: + ++ trig-style :: type of parsed line + $% $: %end :: terminator + $? %done :: end of input + %stet :: == end of markdown + %dent :: outdent + == == :: + $: %one :: leaf node + $? %rule :: --- horz rule + %fens :: ``` code fence + %expr :: ;sail expression + == == :: + [%new p=trig-new] :: open container + [%old %text] :: anything else + == :: + ++ trig-new :: start a + $? %lite :: + line item + %lint :: - line item + %head :: # heading + %bloc :: > block-quote + %poem :: [ ]{8} poem + == :: + ++ graf :: paragraph element + $% [%bold p=(list graf)] :: *bold* + [%talc p=(list graf)] :: _italics_ + [%quod p=(list graf)] :: "double quote" + [%code p=tape] :: code literal + [%text p=tape] :: text symbol + [%link p=(list graf) q=tape] :: URL + [%mage p=tape q=tape] :: image + [%expr p=tuna:hoot] :: interpolated hoon + == + -- + =< (non-empty:parse |=(nail `(like tarp)`~($ main +<))) + |% + ++ main + :: + :: state of the parsing loop. + :: + :: we maintain a construction stack for elements and a line + :: stack for lines in the current block. a blank line + :: causes the current block to be parsed and thrown in the + :: current element. when the indent column retreats, the + :: element stack rolls up. + :: + :: .verbose: debug printing enabled + :: .err: error position + :: .ind: outer and inner indent level + :: .hac: stack of items under construction + :: .cur: current item under construction + :: .par: current "paragraph" being read in + :: .[loc txt]: parsing state + :: + =/ verbose & + =| err=(unit hair) + =| ind=[out=@ud inr=@ud] + =| hac=(list item) + =/ cur=item [%down ~] + =| par=(unit (pair hair wall)) + |_ [loc=hair txt=tape] + :: + ++ $ :: resolve + ^- (like tarp) + => line + :: + :: if error position is set, produce error + ?. =(~ err) + ~& err+err + [+.err ~] + :: + :: all data was consumed + =- [loc `[- [loc txt]]] + => close-par + |- ^- tarp + :: + :: fold all the way to top + ?~ hac cur-to-tarp + $(..^$ close-item) + :: + ::+| + :: + ++ cur-indent + ?- p.cur + %down 2 + %head 0 + %lunt 0 + %lime 2 + %lord 0 + %poem 8 + %bloc 2 + == + :: + ++ back :: column retreat + |= luc=@ud + ^+ +> + ?: (gte luc inr.ind) +> + :: + :: nex: next backward step that terminates this context + =/ nex=@ud cur-indent :: REVIEW code and poem blocks are + :: handled elsewhere + ?: (gth nex (sub inr.ind luc)) + :: + :: indenting pattern violation + ~? verbose indent-pattern-violation+[p.cur nex inr.ind luc] + ..^$(inr.ind luc, err `[p.loc luc]) + =. ..^$ close-item + $(inr.ind (sub inr.ind nex)) + :: + ++ cur-to-tarp :: item to tarp + ^- tarp + ?: ?=(?(%down %head %expr) p.cur) + (flop q.cur) + =- [[- ~] (flop q.cur)]~ + ?- p.cur + %lunt %ul + %lord %ol + %lime %li + %poem %div ::REVIEW actual container element? + %bloc %blockquote + == + :: + ++ close-item ^+ . :: complete and pop + ?~ hac . + %= . + hac t.hac + cur [p.i.hac (weld cur-to-tarp q.i.hac)] + == + :: + ++ read-line :: capture raw line + =| lin=tape + |- ^+ [[lin *(unit _err)] +<.^$] :: parsed tape and halt/error + :: + :: no unterminated lines + ?~ txt + ~? verbose %unterminated-line + [[~ ``loc] +<.^$] + ?. =(`@`10 i.txt) + ?: (gth inr.ind q.loc) + ?. =(' ' i.txt) + ~? verbose expected-indent+[inr.ind loc txt] + [[~ ``loc] +<.^$] + $(txt t.txt, q.loc +(q.loc)) + :: + :: save byte and repeat + $(txt t.txt, q.loc +(q.loc), lin [i.txt lin]) + =. lin + :: + :: trim trailing spaces + |- ^- tape + ?: ?=([%' ' *] lin) + $(lin t.lin) + (flop lin) + :: + =/ eat-newline=nail [[+(p.loc) 1] t.txt] + =/ saw look(+<.$ eat-newline) + :: + ?: ?=([~ @ %end ?(%stet %dent)] saw) :: stop on == or dedent + [[lin `~] +<.^$] + [[lin ~] eat-newline] + :: + ++ look :: inspect line + ^- (unit trig) + %+ bind (wonk (look:parse loc txt)) + |= a=trig ^+ a + :: + :: treat a non-terminator as a terminator + :: if it's outdented + ?: =(%end -.sty.a) a + ?: (lth col.a out.ind) + a(sty [%end %dent]) + a + :: + ++ close-par :: make block + ^+ . + :: + :: empty block, no action + ?~ par . + :: + :: if block is verse + ?: ?=(%poem p.cur) + :: + :: add break between stanzas + =. q.cur ?~(q.cur q.cur [[[%br ~] ~] q.cur]) + =- close-item(par ~, q.cur (weld - q.cur), inr.ind (sub inr.ind 8)) + %+ turn q.u.par + |= tape ^- manx + :: + :: each line is a paragraph + :- [%p ~] + :_ ~ + ;/("{+<}\0a") + :: + :: yex: block recomposed, with newlines + =/ yex=tape + %- zing + %+ turn (flop q.u.par) + |= a=tape + (runt [(dec inr.ind) ' '] "{a}\0a") + :: + :: vex: parse of paragraph + =/ vex=(like tarp) + :: + :: either a one-line header or a paragraph + %. [p.u.par yex] + ?: ?=(%head p.cur) + (full head:parse) + (full para:parse) + :: + :: if error, propagate correctly + ?~ q.vex + ~? verbose [%close-par p.cur yex] + ..$(err `p.vex) + :: + :: finish tag if it's a header + =< ?:(?=(%head p.cur) close-item ..$) + :: + :: save good result, clear buffer + ..$(par ~, q.cur (weld p.u.q.vex q.cur)) + :: + ++ line ^+ . :: body line loop + :: + :: abort after first error + ?: !=(~ err) . + :: + :: saw: profile of this line + =/ saw look + ~? [debug=|] [%look ind=ind saw=saw txt=txt] + :: + :: if line is blank + ?~ saw + :: + :: break section + =^ a=[tape fin=(unit _err)] +<.$ read-line + ?^ fin.a + ..$(err u.fin.a) + =>(close-par line) + :: + :: line is not blank + => .(saw u.saw) + :: + :: if end of input, complete + ?: ?=(%end -.sty.saw) + ..$(q.loc col.saw) + :: + =. ind ?~(out.ind [col.saw col.saw] ind) :: init indents + :: + ?: ?| ?=(~ par) :: if after a paragraph or + ?& ?=(?(%down %lime %bloc) p.cur) :: unspaced new container + |(!=(%old -.sty.saw) (gth col.saw inr.ind)) + == == + => .(..$ close-par) + :: + :: if column has retreated, adjust stack + =. ..$ (back col.saw) + :: + =^ col-ok sty.saw + ?+ (sub col.saw inr.ind) [| sty.saw] :: columns advanced + %0 [& sty.saw] + %8 [& %new %poem] + == + ?. col-ok + ~? verbose [%columns-advanced col.saw inr.ind] + ..$(err `[p.loc col.saw]) + :: + =. inr.ind col.saw + :: + :: unless adding a matching item, close lists + =. ..$ + ?: ?| &(?=(%lunt p.cur) !?=(%lint +.sty.saw)) + &(?=(%lord p.cur) !?=(%lite +.sty.saw)) + == + close-item + ..$ + :: + =< line(par `[loc ~]) ^+ ..$ :: continue with para + ?- -.sty.saw + %one (read-one +.sty.saw) :: parse leaves + %new (open-item p.sty.saw) :: open containers + %old ..$ :: just text + == + :: + :: + ::- - - foo + :: detect bad block structure + ?. :: first line of container is legal + ?~ q.u.par & + ?- p.cur + :: + :: can't(/directly) contain text + ?(%lord %lunt) ~|(bad-leaf-container+p.cur !!) + :: + :: only one line in a header + %head | + :: + :: indented literals need to end with a blank line + %poem (gte col.saw inr.ind) + :: + :: text tarps must continue aligned + ?(%down %lunt %lime %lord %bloc) =(col.saw inr.ind) + == + ~? verbose bad-block-structure+[p.cur inr.ind col.saw] + ..$(err `[p.loc col.saw]) + :: + :: accept line and maybe continue + =^ a=[lin=tape fin=(unit _err)] +<.$ read-line + =. par par(q.u [lin.a q.u.par]) + ?^ fin.a ..$(err u.fin.a) + line + ++ parse-block :: execute parser + |= fel=$-(nail (like tarp)) ^+ +> + =/ vex=(like tarp) (fel loc txt) + ?~ q.vex + ~? verbose [%parse-block txt] + +>.$(err `p.vex) + =+ [res loc txt]=u.q.vex + %_ +>.$ + loc loc + txt txt + q.cur (weld (flop `tarp`res) q.cur) :: prepend to the stack + == + :: + ++ read-one :: read %one item + |= sty=?(%expr %rule %fens) ^+ +> + ?- sty + %expr (parse-block expr:parse) + %rule (parse-block hrul:parse) + %fens (parse-block (fens:parse inr.ind)) + == + :: + ++ open-item :: enter list/quote + |= saw=trig-new + =< +>.$:apex + |% + ++ apex ^+ . :: open container + ?- saw + %poem (push %poem) :: verse literal + %head (push %head) :: heading + %bloc (entr %bloc) :: blockquote line + %lint (lent %lunt) :: unordered list + %lite (lent %lord) :: ordered list + == + :: + ++ push :: push context + |=(mite +>(hac [cur hac], cur [+< ~])) + :: + ++ entr :: enter container + |= typ=mite + ^+ +> + :: + :: indent by 2 + =. inr.ind (add 2 inr.ind) + :: + :: "parse" marker + =. txt (slag (sub inr.ind q.loc) txt) + =. q.loc inr.ind + :: + (push typ) + :: + ++ lent :: list entry + |= ord=?(%lord %lunt) + ^+ +> + => ?:(=(ord p.cur) +>.$ (push ord)) :: push list if new + (entr %lime) + -- + -- + :: + ++ parse :: individual parsers + |% + ++ look :: classify line + %+ cook |=(a=(unit trig) a) + ;~ pfix (star ace) + %+ here :: report indent + |=([a=pint b=?(~ trig-style)] ?~(b ~ `[q.p.a b])) + ;~ pose + (cold ~ (just `@`10)) :: blank line + :: + (full (easy [%end %done])) :: end of input + (cold [%end %stet] duz) :: == end of markdown + :: + (cold [%one %rule] ;~(plug hep hep hep)) :: --- horizontal ruler + (cold [%one %fens] ;~(plug tic tic tic)) :: ``` code fence + (cold [%one %expr] mic) :: ;sail expression + :: + (cold [%new %head] ;~(plug (star hax) ace)) :: # heading + (cold [%new %lint] ;~(plug hep ace)) :: - line item + (cold [%new %lite] ;~(plug lus ace)) :: + line item + (cold [%new %bloc] ;~(plug gar ace)) :: > block-quote + :: + (easy [%old %text]) :: anything else + == + == + :: + :: + ++ calf :: cash but for tic tic + |* tem=rule + %- star + ;~ pose + ;~(pfix bas tem) + ;~(less tem prn) + == + ++ cash :: escaped fence + |* tem=rule + %- echo + %- star + ;~ pose + whit + ;~(plug bas tem) + ;~(less tem prn) + == + :: + ++ cool :: reparse + |* $: :: fex: primary parser + :: sab: secondary parser + :: + fex=rule + sab=rule + == + |= [loc=hair txt=tape] + ^+ *sab + :: + :: vex: fenced span + =/ vex=(like tape) (fex loc txt) + ?~ q.vex vex + :: + :: hav: reparse full fenced text + =/ hav ((full sab) [loc p.u.q.vex]) + :: + :: reparsed error position is always at start + ?~ q.hav [loc ~] + :: + :: the complete type with the main product + :- p.vex + `[p.u.q.hav q.u.q.vex] + :: + ::REVIEW surely there is a less hacky "first or after space" solution + ++ easy-sol :: parse start of line + |* a=* + |= b=nail + ?: =(1 q.p.b) ((easy a) b) + (fail b) + :: + ++ echo :: hoon literal + |* sab=rule + |= [loc=hair txt=tape] + ^- (like tape) + :: + :: vex: result of parsing wide hoon + =/ vex (sab loc txt) + :: + :: use result of expression parser + ?~ q.vex vex + =- [p.vex `[- q.u.q.vex]] + :: + :: but replace payload with bytes consumed + |- ^- tape + ?: =(q.q.u.q.vex txt) ~ + ?~ txt ~ + [i.txt $(txt +.txt)] + :: + ++ non-empty + |* a=rule + |= tub=nail ^+ (a) + =/ vex (a tub) + ~! vex + ?~ q.vex vex + ?. =(tub q.u.q.vex) vex + (fail tub) + :: + :: + ++ word :: tarp parser + %+ knee *(list graf) |. ~+ + %+ cook + |= a=$%(graf [%list (list graf)]) + ^- (list graf) + ?:(?=(%list -.a) +.a [a ~]) + ;~ pose + :: + :: ordinary word + :: + %+ stag %text + ;~(plug ;~(pose low hig) (star ;~(pose nud low hig hep))) + :: + :: naked \escape + :: + (stag %text ;~(pfix bas (cook trip ;~(less ace prn)))) + :: + :: trailing \ to add
+ :: + (stag %expr (cold [[%br ~] ~] ;~(plug bas (just '\0a')))) + :: + :: *bold literal* + :: + (stag %bold (ifix [tar tar] (cool (cash tar) werk))) + :: + :: _italic literal_ + :: + (stag %talc (ifix [cab cab] (cool (cash cab) werk))) + :: + :: "quoted text" + :: + (stag %quod (ifix [doq doq] (cool (cash doq) werk))) + :: + :: `classic markdown quote` + :: + (stag %code (ifix [tic tic] (calf tic))) + :: + :: ++arm, +$arm, +*arm, ++arm:core, ... + :: + %+ stag %code + ;~ plug + lus ;~(pose lus buc tar) + low (star ;~(pose nud low hep col)) + == + :: + :: [arbitrary *content*](url) + :: + %+ stag %link + ;~ (glue (punt whit)) + (ifix [sel ser] (cool (cash ser) werk)) + (ifix [pal par] (cash par)) + == + :: + :: ![alt text](url) + :: + %+ stag %mage + ;~ pfix zap + ;~ (glue (punt whit)) + (ifix [sel ser] (cash ser)) + (ifix [pal par] (cash par)) + == + == + :: + :: #hoon + :: + %+ stag %list + ;~ plug + (stag %text ;~(pose (cold " " whit) (easy-sol ~))) + (stag %code ;~(pfix hax (echo wide))) + ;~(simu whit (easy ~)) + == + :: + :: direct hoon constant + :: + %+ stag %list + ;~ plug + (stag %text ;~(pose (cold " " whit) (easy-sol ~))) + :: + %+ stag %code + %- echo + ;~ pose + ::REVIEW just copy in 0x... parsers directly? + ;~(simu ;~(plug (just '0') alp) bisk:so) + :: + tash:so + ;~(pfix dot perd:so) + ;~(pfix sig ;~(pose twid:so (easy [%$ %n 0]))) + ;~(pfix cen ;~(pose sym buc pam bar qut nuck:so)) + == + :: + ;~(simu whit (easy ~)) + == + :: + :: whitespace + :: + (stag %text (cold " " whit)) + :: + :: {interpolated} sail + :: + (stag %expr inline-embed:(sail |)) + :: + :: just a byte + :: + (stag %text (cook trip ;~(less ace prn))) + == + :: + ++ werk (cook zing (star word)) :: indefinite tarp + :: + ++ down :: parse inline tarp + %+ knee *tarp |. ~+ + =- (cook - werk) + :: + :: collect raw tarp into xml tags + |= gaf=(list graf) + ^- tarp + =< main + |% + ++ main + ^- tarp + ?~ gaf ~ + ?. ?=(%text -.i.gaf) + (weld (item i.gaf) $(gaf t.gaf)) + :: + :: fip: accumulate text blocks + =/ fip=(list tape) [p.i.gaf]~ + |- ^- tarp + ?~ t.gaf [;/((zing (flop fip))) ~] + ?. ?=(%text -.i.t.gaf) + [;/((zing (flop fip))) ^$(gaf t.gaf)] + $(gaf t.gaf, fip :_(fip p.i.t.gaf)) + :: + ++ item + |= nex=graf + ^- tarp ::CHECK can be tuna:hoot? + ?- -.nex + %text !! :: handled separately + %expr [p.nex]~ + %bold [[%b ~] ^$(gaf p.nex)]~ + %talc [[%i ~] ^$(gaf p.nex)]~ + %code [[%code ~] ;/(p.nex) ~]~ + %quod :: + :: smart quotes + %= ^$ + gaf + :- [%text (tufa ~-~201c. ~)] + %+ weld p.nex + `(list graf)`[%text (tufa ~-~201d. ~)]~ + == + %link [[%a [%href q.nex] ~] ^$(gaf p.nex)]~ + %mage [[%img [%src q.nex] ?~(p.nex ~ [%alt p.nex]~)] ~]~ + == + -- + :: + ++ hrul :: empty besides fence + %+ cold [[%hr ~] ~]~ + ;~(plug (star ace) hep hep hep (star hep) (just '\0a')) + :: + ++ tics + ;~(plug tic tic tic (just '\0a')) + :: + ++ fens + |= col=@u ~+ + =/ ind (stun [(dec col) (dec col)] ace) + =/ ind-tics ;~(plug ind tics) + %+ cook |=(txt=tape `tarp`[[%pre ~] ;/(txt) ~]~) + :: + :: leading outdent is ok since container may + :: have already been parsed and consumed + %+ ifix [;~(plug (star ace) tics) ind-tics] + %^ stir "" |=([a=tape b=tape] "{a}\0a{b}") + ;~ pose + %+ ifix [ind (just '\0a')] + ;~(less tics (star prn)) + :: + (cold "" ;~(plug (star ace) (just '\0a'))) + == + :: + ++ para :: paragraph + %+ cook + |=(a=tarp ?~(a ~ [[%p ~] a]~)) + ;~(pfix (punt whit) down) + :: + ++ expr :: expression + => (sail &) :: tall-form + %+ ifix [(star ace) ;~(simu gap (easy))] :: look-ahead for gap + (cook drop-top top-level) :: list of tags + :: + :: + ++ whit :: whitespace + (cold ' ' (plus ;~(pose (just ' ') (just '\0a')))) + :: + ++ head :: parse heading + %+ cook + |= [haxes=tape kids=tarp] ^- tarp + =/ tag (crip 'h' <(lent haxes)>) :: e.g. ### -> %h3 + =/ id (contents-to-id kids) + [[tag [%id id]~] kids]~ + :: + ;~(pfix (star ace) ;~((glue whit) (stun [1 6] hax) down)) + :: + ++ contents-to-id :: # text into elem id + |= a=(list tuna:hoot) ^- tape + =; raw=tape + %+ turn raw + |= @tD + ^- @tD + ?: ?| &((gte +< 'a') (lte +< 'z')) + &((gte +< '0') (lte +< '9')) + == + +< + ?: &((gte +< 'A') (lte +< 'Z')) + (add 32 +<) + '-' + :: + :: collect all text in header tarp + |- ^- tape + ?~ a ~ + %+ weld + ^- tape + ?- i.a + [[%$ [%$ *] ~] ~] :: text node contents + (murn v.i.a.g.i.a |=(a=beer:hoot ?^(a ~ (some a)))) + [^ *] $(a c.i.a) :: concatenate children + [@ *] ~ :: ignore interpolation + == + $(a t.a) + -- + -- + :: + ++ scad + %+ knee *spec |. ~+ + %- stew + ^. stet ^. limo + :~ + :- '_' + ;~(pfix cab (stag %bccb wide)) + :- ',' + ;~(pfix com (stag %bcmc wide)) + :- '$' + (stag %like (most col rope)) + :- '%' + ;~ pose + ;~ pfix cen + ;~ pose + (stag %leaf (stag %tas (cold %$ buc))) + (stag %leaf (stag %f (cold & pam))) + (stag %leaf (stag %f (cold | bar))) + (stag %leaf (stag %t qut)) + (stag %leaf (sear |=(a=coin ?:(?=(%$ -.a) (some +.a) ~)) nuck:so)) + == + == + == + :- '(' + %+ cook |=(spec +<) + %+ stag %make + %+ ifix [pal par] + ;~ plug + wide + ;~(pose ;~(pfix ace (most ace wyde)) (easy ~)) + == + :- '[' + (stag %bccl (ifix [sel ser] (most ace wyde))) + :- '*' + (cold [%base %noun] tar) + :- '/' + ;~(pfix fas (stag %loop ;~(pose (cold %$ buc) sym))) + :- '@' + ;~(pfix pat (stag %base (stag %atom mota))) + :- '?' + ;~ pose + %+ stag %bcwt + ;~(pfix wut (ifix [pal par] (most ace wyde))) + :: + (cold [%base %flag] wut) + == + :- '~' + (cold [%base %null] sig) + :- '!' + (cold [%base %void] ;~(plug zap zap)) + :- '^' + ;~ pose + (stag %like (most col rope)) + (cold [%base %cell] ket) + == + :- '=' + ;~ pfix tis + %+ sear + |= [=(unit term) =spec] + %+ bind + ~(autoname ax spec) + |= =term + =* name ?~(unit term (cat 3 u.unit (cat 3 '-' term))) + [%bcts name spec] + ;~ pose + ;~(plug (stag ~ ;~(sfix sym tis)) wyde) + (stag ~ wyde) + == + == + :- ['a' 'z'] + ;~ pose + (stag %bcts ;~(plug sym ;~(pfix tis wyde))) + (stag %like (most col rope)) + == + == + :: + ++ scat + %+ knee *hoon |. ~+ + %- stew + ^. stet ^. limo + :~ + :- ',' + ;~ pose + (stag %ktcl ;~(pfix com wyde)) + (stag %wing rope) + == + :- '!' + ;~ pose + (stag %wtzp ;~(pfix zap wide)) + (stag %zpzp (cold ~ ;~(plug zap zap))) + == + :- '_' + ;~(pfix cab (stag %ktcl (stag %bccb wide))) + :- '$' + ;~ pose + ;~ pfix buc + ;~ pose + :: XX: these are all obsolete in hoon 142 + :: + (stag %leaf (stag %tas (cold %$ buc))) + (stag %leaf (stag %t qut)) + (stag %leaf (sear |=(a=coin ?:(?=(%$ -.a) (some +.a) ~)) nuck:so)) + == + == + rump + == + :- '%' + ;~ pfix cen + ;~ pose + (stag %clsg (sear |~([a=@ud b=tyke] (posh ~ ~ a b)) porc)) + (stag %rock (stag %tas (cold %$ buc))) + (stag %rock (stag %f (cold & pam))) + (stag %rock (stag %f (cold | bar))) + (stag %rock (stag %t qut)) + (cook (jock &) nuck:so) + (stag %clsg (sear |=(a=(list) (posh ~ ~ (lent a) ~)) (star cen))) + == + == + :- '&' + ;~ pose + (cook |=(a=wing [%cnts a ~]) rope) + (stag %wtpm ;~(pfix pam (ifix [pal par] (most ace wide)))) + ;~(plug (stag %rock (stag %f (cold & pam))) wede) + (stag %sand (stag %f (cold & pam))) + == + :- '\'' + (stag %sand (stag %t qut)) + :- '(' + (stag %cncl (ifix [pal par] (most ace wide))) + :- '*' + ;~ pose + (stag %kttr ;~(pfix tar wyde)) + (cold [%base %noun] tar) + == + :- '@' + ;~(pfix pat (stag %base (stag %atom mota))) + :- '+' + ;~ pose + (stag %dtls ;~(pfix lus (ifix [pal par] wide))) + :: + %+ cook + |= a=(list (list woof)) + :- %mcfs + [%knit |-(^-((list woof) ?~(a ~ (weld i.a $(a t.a)))))] + (most dog ;~(pfix lus soil)) + :: + (cook |=(a=wing [%cnts a ~]) rope) + == + :- '-' + ;~ pose + (stag %sand tash:so) + :: + %+ cook + |= a=(list (list woof)) + [%clsg (phax a)] + (most dog ;~(pfix hep soil)) + :: + (cook |=(a=wing [%cnts a ~]) rope) + == + :- '.' + ;~ pose + (cook (jock |) ;~(pfix dot perd:so)) + (cook |=(a=wing [%cnts a ~]) rope) + == + :- ['0' '9'] + %+ cook + |= [a=dime b=(unit hoon)] + ?~(b [%sand a] [[%rock a] u.b]) + ;~(plug bisk:so (punt wede)) + :- ':' + ;~ pfix col + ;~ pose + (stag %mccl (ifix [pal par] (most ace wide))) + ;~(pfix fas (stag %mcfs wide)) + == + == + :- '=' + ;~ pfix tis + ;~ pose + (stag %dtts (ifix [pal par] ;~(glam wide wide))) + :: + %+ sear + :: mainly used for +skin formation + :: + |= =spec + ^- (unit hoon) + %+ bind ~(autoname ax spec) + |=(=term `hoon`[%ktts term %kttr spec]) + wyde + == + == + :- '?' + ;~ pose + %+ stag %ktcl + (stag %bcwt ;~(pfix wut (ifix [pal par] (most ace wyde)))) + :: + (cold [%base %flag] wut) + == + :- '[' + rupl + :- '^' + ;~ pose + (stag %wing rope) + (cold [%base %cell] ket) + == + :- '`' + ;~ pfix tic + ;~ pose + %+ cook + |=([a=@ta b=hoon] [%ktls [%sand a 0] [%ktls [%sand %$ 0] b]]) + ;~(pfix pat ;~(plug mota ;~(pfix tic wide))) + ;~ pfix tar + (stag %kthp (stag [%base %noun] ;~(pfix tic wide))) + == + (stag %kthp ;~(plug wyde ;~(pfix tic wide))) + (stag %ktls ;~(pfix lus ;~(plug wide ;~(pfix tic wide)))) + (cook |=(a=hoon [[%rock %n ~] a]) wide) + == + == + :- '"' + %+ cook + |= a=(list (list woof)) + [%knit |-(^-((list woof) ?~(a ~ (weld i.a $(a t.a)))))] + (most dog soil) + :- ['a' 'z'] + rump + :- '|' + ;~ pose + (cook |=(a=wing [%cnts a ~]) rope) + (stag %wtbr ;~(pfix bar (ifix [pal par] (most ace wide)))) + ;~(plug (stag %rock (stag %f (cold | bar))) wede) + (stag %sand (stag %f (cold | bar))) + == + :- '~' + ;~ pose + rupl + :: + ;~ pfix sig + ;~ pose + (stag %clsg (ifix [sel ser] (most ace wide))) + :: + %+ stag %cnsg + %+ ifix + [pal par] + ;~(glam rope wide (most ace wide)) + :: + (cook (jock |) twid:so) + (stag [%bust %null] wede) + (easy [%bust %null]) + == + == + == + :- '/' + rood + :- '<' + (ifix [gal gar] (stag %tell (most ace wide))) + :- '>' + (ifix [gar gal] (stag %yell (most ace wide))) + :- '#' + ;~(pfix hax reed) + == + ++ soil + ;~ pose + ;~ less (jest '"""') + %+ ifix [doq doq] + %- star + ;~ pose + ;~(pfix bas ;~(pose bas doq kel bix:ab)) + ;~(less doq bas kel prn) + (stag ~ sump) + == + == + :: + %- iny %+ ifix + [(jest '"""\0a') (jest '\0a"""')] + %- star + ;~ pose + ;~(pfix bas ;~(pose bas kel bix:ab)) + ;~(less bas kel prn) + ;~(less (jest '\0a"""') (just `@`10)) + (stag ~ sump) + == + == + ++ sump (ifix [kel ker] (stag %cltr (most ace wide))) + ++ norm :: rune regular form + |= tol=? + |% + ++ structure + %- stew + ^. stet ^. limo + :~ :- '$' + ;~ pfix buc + %- stew + ^. stet ^. limo + :~ [':' (rune col %bccl exqs)] + ['%' (rune cen %bccn exqs)] + ['<' (rune gal %bcgl exqb)] + ['>' (rune gar %bcgr exqb)] + ['^' (rune ket %bckt exqb)] + ['~' (rune sig %bcsg exqd)] + ['|' (rune bar %bcbr exqc)] + ['&' (rune pam %bcpm exqc)] + ['@' (rune pat %bcpt exqb)] + ['_' (rune cab %bccb expa)] + ['-' (rune hep %bchp exqb)] + ['=' (rune tis %bcts exqg)] + ['?' (rune wut %bcwt exqs)] + [';' (rune mic %bcmc expa)] + ['+' (rune lus %bcls exqg)] + == + == + :- '%' + ;~ pfix cen + %- stew + ^. stet ^. limo + :~ :- '^' + %+ cook + |= [%cnkt a=hoon b=spec c=spec d=spec] + [%make a b c d ~] + (rune ket %cnkt exqy) + :: + :- '+' + %+ cook + |= [%cnls a=hoon b=spec c=spec] + [%make a b c ~] + (rune lus %cnls exqx) + :: + :- '-' + %+ cook + |= [%cnhp a=hoon b=spec] + [%make a b ~] + (rune hep %cnhp exqd) + :: + :- '.' + %+ cook + |= [%cndt a=spec b=hoon] + [%make b a ~] + (rune dot %cndt exqc) + :: + :- ':' + %+ cook + |= [%cncl a=hoon b=(list spec)] + [%make a b] + (rune col %cncl exqz) + == + == + :- '#' + ;~ pfix hax fas + %+ stag %bccl + %+ cook + |= [[i=spec t=(list spec)] e=spec] + [i (snoc t e)] + ;~ plug + %+ most ;~(less ;~(plug fas tar) fas) + =- ;~(pose - (easy [%leaf %tas %$])) + %- stew + ^. stet ^. limo + :~ :: /$ + :: + :- '$' + (cold [%leaf %tas %$] buc) + :: + :- ['a' 'z'] + ;~ pose + :: /name=@aura + :: + %+ cook + |= [=term =aura] + ^- spec + :+ %bccl + [%leaf %tas aura] + :_ ~ + :+ %bcts term + ?+ aura [%base %atom aura] + %f [%base %flag] + %n [%base %null] + == + ;~(plug sym ;~(pfix tis pat mota)) + :: + :: /constant + :: + (stag %leaf (stag %tas sym)) + == + :: + :: /@aura + :: + :- '@' + %+ cook + |= =aura + ^- spec + :+ %bccl + [%leaf %tas aura] + [%base %atom aura]~ + ;~(pfix pat mota) + :: + :: /? + :: + :- '?' + (cold [%bccl [%leaf %tas %f] [%base %flag] ~] wut) + :: + :: /~ + :: + :- '~' + (cold [%bccl [%leaf %tas %n] [%base %null] ~] sig) + == + :: + :: open-ended or fixed-length + :: + ;~ pose + (cold [%base %noun] ;~(plug fas tar)) + (easy %base %null) + == + == + == + == + ++ expression + %- stew + ^. stet ^. limo + :~ :- '|' + ;~ pfix bar + %- stew + ^. stet ^. limo + :~ ['_' (rune cab %brcb exqr)] + ['%' (runo cen %brcn ~ expe)] + ['@' (runo pat %brpt ~ expe)] + [':' (rune col %brcl expb)] + ['.' (rune dot %brdt expa)] + ['-' (rune hep %brhp expa)] + ['^' (rune ket %brkt expr)] + ['~' (rune sig %brsg exqc)] + ['*' (rune tar %brtr exqc)] + ['=' (rune tis %brts exqc)] + ['?' (rune wut %brwt expa)] + ['$' (rune buc %brbc exqe)] + == + == + :- '$' + ;~ pfix buc + %- stew + ^. stet ^. limo + :~ ['@' (stag %ktcl (rune pat %bcpt exqb))] + ['_' (stag %ktcl (rune cab %bccb expa))] + [':' (stag %ktcl (rune col %bccl exqs))] + ['%' (stag %ktcl (rune cen %bccn exqs))] + ['<' (stag %ktcl (rune gal %bcgl exqb))] + ['>' (stag %ktcl (rune gar %bcgr exqb))] + ['|' (stag %ktcl (rune bar %bcbr exqc))] + ['&' (stag %ktcl (rune pam %bcpm exqc))] + ['^' (stag %ktcl (rune ket %bckt exqb))] + ['~' (stag %ktcl (rune sig %bcsg exqd))] + ['-' (stag %ktcl (rune hep %bchp exqb))] + ['=' (stag %ktcl (rune tis %bcts exqg))] + ['?' (stag %ktcl (rune wut %bcwt exqs))] + ['+' (stag %ktcl (rune lus %bcls exqg))] + ['.' (rune dot %kttr exqa)] + [',' (rune com %ktcl exqa)] + == + == + :- '%' + ;~ pfix cen + %- stew + ^. stet ^. limo + :~ ['_' (rune cab %cncb exph)] + ['.' (rune dot %cndt expb)] + ['^' (rune ket %cnkt expd)] + ['+' (rune lus %cnls expc)] + ['-' (rune hep %cnhp expb)] + [':' (rune col %cncl expi)] + ['~' (rune sig %cnsg expn)] + ['*' (rune tar %cntr expm)] + ['=' (rune tis %cnts exph)] + == + == + :- ':' + ;~ pfix col + %- stew + ^. stet ^. limo + :~ ['_' (rune cab %clcb expb)] + ['^' (rune ket %clkt expd)] + ['+' (rune lus %clls expc)] + ['-' (rune hep %clhp expb)] + ['~' (rune sig %clsg exps)] + ['*' (rune tar %cltr exps)] + == + == + :- '.' + ;~ pfix dot + %- stew + ^. stet ^. limo + :~ ['+' (rune lus %dtls expa)] + ['*' (rune tar %dttr expb)] + ['=' (rune tis %dtts expb)] + ['?' (rune wut %dtwt expa)] + ['^' (rune ket %dtkt exqn)] + == + == + :- '^' + ;~ pfix ket + %- stew + ^. stet ^. limo + :~ ['|' (rune bar %ktbr expa)] + ['.' (rune dot %ktdt expb)] + ['-' (rune hep %kthp exqc)] + ['+' (rune lus %ktls expb)] + ['&' (rune pam %ktpm expa)] + ['~' (rune sig %ktsg expa)] + ['=' (rune tis %ktts expj)] + ['?' (rune wut %ktwt expa)] + ['*' (rune tar %kttr exqa)] + [':' (rune col %ktcl exqa)] + == + == + :- '~' + ;~ pfix sig + %- stew + ^. stet ^. limo + :~ ['|' (rune bar %sgbr expb)] + ['$' (rune buc %sgbc expf)] + ['_' (rune cab %sgcb expb)] + ['%' (rune cen %sgcn hind)] + ['/' (rune fas %sgfs hine)] + ['<' (rune gal %sggl hinb)] + ['>' (rune gar %sggr hinb)] + ['+' (rune lus %sgls hinc)] + ['&' (rune pam %sgpm hinf)] + ['?' (rune wut %sgwt hing)] + ['=' (rune tis %sgts expb)] + ['!' (rune zap %sgzp expb)] + == + == + :- ';' + ;~ pfix mic + %- stew + ^. stet ^. limo + :~ [':' (rune col %mccl expi)] + ['/' (rune fas %mcfs expa)] + ['<' (rune gal %mcgl expz)] + ['~' (rune sig %mcsg expi)] + [';' (rune mic %mcmc exqc)] + == + == + :- '=' + ;~ pfix tis + %- stew + ^. stet ^. limo + :~ ['|' (rune bar %tsbr exqc)] + ['.' (rune dot %tsdt expq)] + ['?' (rune wut %tswt expw)] + ['^' (rune ket %tskt expt)] + [':' (rune col %tscl expp)] + ['/' (rune fas %tsfs expo)] + [';' (rune mic %tsmc expo)] + ['<' (rune gal %tsgl expb)] + ['>' (rune gar %tsgr expb)] + ['-' (rune hep %tshp expb)] + ['*' (rune tar %tstr expg)] + [',' (rune com %tscm expb)] + ['+' (rune lus %tsls expb)] + ['~' (rune sig %tssg expi)] + == + == + :- '?' + ;~ pfix wut + %- stew + ^. stet ^. limo + :~ ['|' (rune bar %wtbr exps)] + [':' (rune col %wtcl expc)] + ['.' (rune dot %wtdt expc)] + ['<' (rune gal %wtgl expb)] + ['>' (rune gar %wtgr expb)] + ['-' ;~(pfix hep (toad txhp))] + ['^' ;~(pfix ket (toad tkkt))] + ['=' ;~(pfix tis (toad txts))] + ['#' ;~(pfix hax (toad txhx))] + ['+' ;~(pfix lus (toad txls))] + ['&' (rune pam %wtpm exps)] + ['@' ;~(pfix pat (toad tkvt))] + ['~' ;~(pfix sig (toad tksg))] + ['!' (rune zap %wtzp expa)] + == + == + :- '!' + ;~ pfix zap + %- stew + ^. stet ^. limo + :~ [':' ;~(pfix col (toad expy))] + ['.' ;~(pfix dot (toad |.(loaf(bug |))))] + [',' (rune com %zpcm expb)] + [';' (rune mic %zpmc expb)] + ['>' (rune gar %zpgr expa)] + ['<' (rune gal %zpgl exqc)] + ['@' (rune pat %zppt expx)] + ['=' (rune tis %zpts expa)] + ['?' (rune wut %zpwt hinh)] + == + == + == + :: + ++ boog !: + %+ knee [p=*whit q=*term r=*help s=*hoon] + |.(~+((scye ;~(pose bola boba)))) + ++ bola :: ++ arms + %+ knee [q=*term r=*help s=*hoon] |. ~+ + %+ cook + |= [q=term r=whiz s=hoon] + ?: =(r *whiz) + [q *help s] + [q [[%funk q]~ [r]~] s] + ;~ pfix (jest '++') + ;~ plug + ;~(pfix gap ;~(pose (cold %$ buc) sym)) + apse:docs + ;~(pfix jump loaf) + == + == + ::TODO consider special casing $% + ++ boba :: +$ arms + %+ knee [q=*term r=*help s=*hoon] |. ~+ + %+ cook + |= [q=term r=whiz s=spec] + ?: =(r *whiz) + [q *help [%ktcl %name q s]] + [q [[%plan q]~ [r]~] [%ktcl %name q s]] + ;~ pfix (jest '+$') + ;~ plug + ;~(pfix gap sym) + apse:docs + ;~(pfix jump loan) + == + == + :: + :: parses a or [a b c] or a b c == + ++ lynx + =/ wid (ifix [sel ser] (most ace sym)) + =/ tal + ;~ sfix + (most gap sym) + ;~(plug gap duz) + == + =/ one + %- cook :_ sym + |= a=term + `(list term)`~[a] + %- cook + :_ ;~(pose (runq wid tal) one) + :: lestify + |= a=(list term) + ?~(a !! a) + :: + ++ whap !: :: chapter + %+ cook + |= a=(list (qual whit term help hoon)) + :: separate $helps into their own list to be passed to +glow + =/ [duds=(list help) nude=(list (pair term hoon))] + %+ roll a + |= $: $= bog + (qual whit term help hoon) + :: + $= gob + [duds=(list help) nude=(list (pair term hoon))] + == + =/ [unt=(list help) tag=(list help)] + %+ skid ~(tap by bat.p.bog) |=(=help =(~ cuff.help)) + :- ?: =(*help r.bog) + (weld tag duds.gob) + [r.bog (weld tag duds.gob)] + |- + ?~ unt [[q.bog s.bog] nude.gob] + =. s.bog [%note help/i.unt s.bog] + $(unt t.unt) + :: + %+ glow duds + |- ^- (map term hoon) + ?~ nude ~ + =+ $(nude t.nude) + %+ ~(put by -) + p.i.nude + ?: (~(has by -) p.i.nude) + [%eror (weld "duplicate arm: +" (trip p.i.nude))] + q.i.nude + :: + (most mush boog) + :: + :: +glow: moves batch comments to the correct arm + ++ glow + |= [duds=(list help) nude=(map term hoon)] + ^- (map term hoon) + |- + ?~ duds nude + :: if there is no link, its not part of a batch comment + ?~ cuff.i.duds + :: this shouldn't happen yet until we look for cuffs of length >1 + :: but we need to prove that cuff is nonempty anyways + $(duds t.duds) + :: + ::TODO: look past the first link. this probably requires + ::a major rethink on how batch comments work + =/ nom=(unit term) + ?+ i.cuff.i.duds ~ + :: we only support ++ and +$ batch comments right now + :: + ?([%funk *] [%plan *]) + `p.i.cuff.i.duds + == + %= $ + duds t.duds + nude ?~ nom nude + ?. (~(has by nude) u.nom) + :: ~> %slog.[0 leaf+"glow: unmatched link"] + nude + (~(jab by nude) u.nom |=(a=hoon [%note help+i.duds a])) + == + :: + ++ whip :: chapter declare + %+ cook + |= [[a=whit b=term c=whiz] d=(map term hoon)] + ^- [whit (pair term (map term hoon))] + ?. =(*whit a) + [a b d] + ?: =(*whiz c) + [*whit b d] + [%*(. *whit bat (malt [[%chat b]~ [c]~]~)) b d] + ;~(plug (seam ;~(pfix (jest '+|') gap cen sym)) whap) + :: + ++ wasp :: $brcb aliases + ;~ pose + %+ ifix + [;~(plug lus tar muck) muck] + (most muck ;~(gunk sym loll)) + :: + (easy ~) + == + :: + ++ wisp !: :: core tail + ?. tol fail + %+ cook + |= a=(list [wit=whit wap=(pair term (map term hoon))]) + ^- (map term tome) + =< p + |- ^- (pair (map term tome) (map term hoon)) + ?~ a [~ ~] + =/ mor $(a t.a) + =. q.wap.i.a + %- ~(urn by q.wap.i.a) + |= b=(pair term hoon) ^+ +.b + :: tests for duplicate arms between two chapters + ?. (~(has by q.mor) p.b) +.b + [%eror (weld "duplicate arm: +" (trip p.b))] + :_ (~(uni by q.mor) q.wap.i.a) + %+ ~(put by p.mor) + p.wap.i.a + :- %- ~(get by bat.wit.i.a) + ?: (~(has by bat.wit.i.a) [%chat p.wap.i.a]~) + [%chat p.wap.i.a]~ + ~ + ?. (~(has by p.mor) p.wap.i.a) + q.wap.i.a + [[%$ [%eror (weld "duplicate chapter: |" (trip p.wap.i.a))]] ~ ~] + :: + ::TODO: allow cores with unnamed chapter as well as named chapters? + ;~ pose + dun + ;~ sfix + ;~ pose + (most mush whip) + ;~(plug (stag *whit (stag %$ whap)) (easy ~)) + == + gap + dun + == + == + :: + ::TODO: check parser performance + ++ toad :: untrap parser expr + |* har=_expa + =+ dur=(ifix [pal par] $:har(tol |)) + ?. tol + dur + ;~(pose ;~(pfix jump $:har(tol &)) ;~(pfix gap $:har(tol &)) dur) + :: + ++ rune :: build rune + |* [dif=rule tuq=* har=_expa] + ;~(pfix dif (stag tuq (toad har))) + :: + ++ runo :: rune plus + |* [dif=rule hil=* tuq=* har=_expa] + ;~(pfix dif (stag hil (stag tuq (toad har)))) + :: + ++ runq :: wide or tall if tol + |* [wid=rule tal=rule] :: else wide + ?. tol + wid + ;~(pose wid tal) + :: + ++ butt |* zor=rule :: closing == if tall + ?:(tol ;~(sfix zor ;~(plug gap duz)) zor) + ++ ulva |* zor=rule :: closing -- and tall + ?.(tol fail ;~(sfix zor ;~(plug gap dun))) + ++ glop ~+((glue mash)) :: separated by space + ++ gunk ~+((glue muck)) :: separated list + ++ goop ~+((glue mush)) :: separator list & docs + ++ hank (most mush loaf) :: gapped hoons + ++ hunk (most mush loan) :: gapped specs + ++ jump ;~(pose leap:docs gap) :: gap before docs + ++ loaf ?:(tol tall wide) :: hoon + ++ loll ?:(tol tall(doc |) wide(doc |)) :: hoon without docs + ++ loan ?:(tol till wyde) :: spec + ++ lore (sear |=(=hoon ~(flay ap hoon)) loaf) :: skin + ++ lomp ;~(plug sym (punt ;~(pfix tis wyde))) :: typeable name + ++ mash ?:(tol gap ;~(plug com ace)) :: list separator + ++ muss ?:(tol jump ;~(plug com ace)) :: list w/ doccords + ++ muck ?:(tol gap ace) :: general separator + ++ mush ?:(tol jump ace) :: separator w/ docs + ++ teak %+ knee *tiki |. ~+ :: wing or hoon + =+ ^= gub + |= [a=term b=$%([%& p=wing] [%| p=hoon])] + ^- tiki + ?-(-.b %& [%& [~ a] p.b], %| [%| [~ a] p.b]) + =+ ^= wyp + ;~ pose + %+ cook gub + ;~ plug + sym + ;~(pfix tis ;~(pose (stag %& rope) (stag %| wide))) + == + :: + (stag %& (stag ~ rope)) + (stag %| (stag ~ wide)) + == + ?. tol wyp + ;~ pose + wyp + :: + ;~ pfix + ;~(plug ket tis gap) + %+ cook gub + ;~ plug + sym + ;~(pfix gap ;~(pose (stag %& rope) (stag %| tall))) + == + == + :: + (stag %| (stag ~ tall)) + == + ++ rack (most muss ;~(goop loaf loaf)) :: list [hoon hoon] + ++ ruck (most muss ;~(goop loan loaf)) :: list [spec hoon] + ++ rick (most mash ;~(goop rope loaf)) :: list [wing hoon] + :: hoon contents + :: + ++ expa |.(loaf) :: one hoon + ++ expb |.(;~(goop loaf loaf)) :: two hoons + ++ expc |.(;~(goop loaf loaf loaf)) :: three hoons + ++ expd |.(;~(goop loaf loaf loaf loaf)) :: four hoons + ++ expe |.(wisp) :: core tail + ++ expf |.(;~(goop ;~(pfix cen sym) loaf)) :: %term and hoon + ++ expg |.(;~(gunk lomp loll loaf)) :: term/spec, two hoons + ++ exph |.((butt ;~(gunk rope rick))) :: wing, [wing hoon]s + ++ expi |.((butt ;~(goop loaf hank))) :: one or more hoons + ++ expj |.(;~(goop lore loaf)) :: skin and hoon + :: ++ expk |.(;~(gunk loaf ;~(plug loaf (easy ~)))):: list of two hoons + :: ++ expl |.(;~(gunk sym loaf loaf)) :: term, two hoons + ++ expm |.((butt ;~(gunk rope loaf rick))) :: several [spec hoon]s + ++ expn |. ;~ gunk rope loaf :: wing, hoon, + ;~(plug loaf (easy ~)) :: list of one hoon + == :: + ++ expo |.(;~(goop wise loaf loaf)) :: =; + ++ expp |.(;~(goop (butt rick) loaf)) :: [wing hoon]s, hoon + ++ expq |.(;~(goop rope loaf loaf)) :: wing and two hoons + ++ expr |.(;~(goop loaf wisp)) :: hoon and core tail + ++ exps |.((butt hank)) :: closed gapped hoons + ++ expt |.(;~(gunk wise rope loaf loaf)) :: =^ + ++ expu |.(;~(gunk rope loaf (butt hank))) :: wing, hoon, hoons + :: ++ expv |.((butt rick)) :: just changes + ++ expw |.(;~(goop rope loaf loaf loaf)) :: wing and three hoons + ++ expx |.(;~(goop ropa loaf loaf)) :: wings and two hoons + ++ expy |.(loaf(bug &)) :: hoon with tracing + ++ expz |.(;~(goop loan loaf loaf loaf)) :: spec and three hoons + :: spec contents + :: + ++ exqa |.(loan) :: one spec + ++ exqb |.(;~(goop loan loan)) :: two specs + ++ exqc |.(;~(goop loan loaf)) :: spec then hoon + ++ exqd |.(;~(goop loaf loan)) :: hoon then spec + ++ exqe |.(;~(goop lynx loan)) :: list of names then spec + ++ exqs |.((butt hunk)) :: closed gapped specs + ++ exqg |.(;~(goop sym loan)) :: term and spec + ::++ exqk |.(;~(goop loaf ;~(plug loan (easy ~)))):: hoon with one spec + ++ exqn |.(;~(gunk loan (stag %cltr (butt hank)))):: autoconsed hoons + ++ exqr |.(;~(gunk loan ;~(plug wasp wisp))) :: spec/aliases?/tail + ::++ exqw |.(;~(goop loaf loan)) :: hoon and spec + ++ exqx |.(;~(goop loaf loan loan)) :: hoon, two specs + ++ exqy |.(;~(goop loaf loan loan loan)) :: hoon, three specs + ++ exqz |.(;~(goop loaf (butt hunk))) :: hoon, n specs + :: + :: tiki expansion for %wt runes + :: + ++ txhp |. %+ cook |= [a=tiki b=(list (pair spec hoon))] + (~(wthp ah a) b) + (butt ;~(gunk teak ruck)) + ++ tkkt |. %+ cook |= [a=tiki b=hoon c=hoon] + (~(wtkt ah a) b c) + ;~(gunk teak loaf loaf) + ++ txls |. %+ cook |= [a=tiki b=hoon c=(list (pair spec hoon))] + (~(wtls ah a) b c) + (butt ;~(gunk teak loaf ruck)) + ++ tkvt |. %+ cook |= [a=tiki b=hoon c=hoon] + (~(wtpt ah a) b c) + ;~(gunk teak loaf loaf) + ++ tksg |. %+ cook |= [a=tiki b=hoon c=hoon] + (~(wtsg ah a) b c) + ;~(gunk teak loaf loaf) + ++ txts |. %+ cook |= [a=spec b=tiki] + (~(wtts ah b) a) + ;~(gunk loan teak) + ++ txhx |. %+ cook |= [a=skin b=tiki] + (~(wthx ah b) a) + ;~(gunk lore teak) + :: + :: hint syntax + :: + ++ hinb |.(;~(goop bont loaf)) :: hint and hoon + ++ hinc |. :: optional =en, hoon + ;~(pose ;~(goop bony loaf) (stag ~ loaf)) :: + ++ hind |.(;~(gunk bonk loaf ;~(goop bonz loaf))) :: jet hoon "bon"s hoon + ++ hine |.(;~(goop bonk loaf)) :: jet-hint and hoon + ++ hinf |. :: 0-3 >s, two hoons + ;~ pose + ;~(goop (cook lent (stun [1 3] gar)) loaf loaf) + (stag 0 ;~(goop loaf loaf)) + == + ++ hing |. :: 0-3 >s, three hoons + ;~ pose + ;~(goop (cook lent (stun [1 3] gar)) loaf loaf loaf) + (stag 0 ;~(goop loaf loaf loaf)) + == + ++ bonk :: jet signature + ;~ pfix cen + ;~ pose + ;~(plug sym ;~(pfix col ;~(plug sym ;~(pfix dot ;~(pfix dot dem))))) + ;~(plug sym ;~(pfix col ;~(plug sym ;~(pfix dot dem)))) + ;~(plug sym ;~(pfix dot dem)) + sym + == + == + ++ hinh |. :: 1/2 numbers, hoon + ;~ goop + ;~ pose + dem + (ifix [sel ser] ;~(plug dem ;~(pfix ace dem))) + == + loaf + == + ++ bont ;~ (bend) :: term, optional hoon + ;~(pfix cen sym) + ;~(pfix dot ;~(pose wide ;~(pfix muck loaf))) + == + ++ bony (cook |=(a=(list) (lent a)) (plus tis)) :: base 1 =en count + ++ bonz :: term-labelled hoons + ;~ pose + (cold ~ sig) + %+ ifix + ?:(tol [;~(plug duz gap) ;~(plug gap duz)] [pal par]) + (more mash ;~(gunk ;~(pfix cen sym) loaf)) + == + -- + :: + ++ lang :: lung sample + $: ros=hoon + $= vil + $% [%tis p=hoon] + [%col p=hoon] + [%ket p=hoon] + [%lit p=(list (pair wing hoon))] + == + == + :: + ++ lung + ~+ + %- bend + |: $:lang + ^- (unit hoon) + ?- -.vil + %col ?:(=([%base %flag] ros) ~ [~ %tsgl ros p.vil]) + %lit (bind ~(reek ap ros) |=(hyp=wing [%cnts hyp p.vil])) + %ket [~ ros p.vil] + %tis =+ rud=~(flay ap ros) + ?~(rud ~ `[%ktts u.rud p.vil]) + == + :: + ++ long + %+ knee *hoon |. ~+ + ;~ lung + scat + ;~ pose + ;~(plug (cold %tis tis) wide) + ;~(plug (cold %col col) wide) + ;~(plug (cold %ket ket) wide) + ;~ plug + (easy %lit) + (ifix [pal par] lobo) + == + == + == + :: + ++ lobo (most ;~(plug com ace) ;~(glam rope wide)) + ++ loon (most ;~(plug com ace) ;~(glam wide wide)) + ++ lute :: tall [] noun + ~+ + %+ cook |=(hoon +<) + %+ stag %cltr + %+ ifix + [;~(plug sel gap) ;~(plug gap ser)] + (most gap tall) + :: + ++ ropa (most col rope) + ++ rope :: wing form + %+ knee *wing + |. ~+ + %+ (slug |=([a=limb b=wing] [a b])) + dot + ;~ pose + (cold [%| 0 ~] com) + %+ cook + |=([a=(list) b=term] ?~(a b [%| (lent a) `b])) + ;~(plug (star ket) ;~(pose sym (cold %$ buc))) + :: + %+ cook + |=(a=axis [%& a]) + ;~ pose + ;~(pfix lus dim:ag) + ;~(pfix pam (cook |=(a=@ (sub (bex +(a)) 2)) dim:ag)) + ;~(pfix bar (cook |=(a=@ (sub (bex +(a)) 1)) dim:ag)) + ven + (cold 1 dot) + == + == + :: + ++ wise + ;~ pose + ;~ pfix tis + %+ sear + |= =spec + ^- (unit skin) + %+ bind ~(autoname ax spec) + |= =term + [%name term %spec spec %base %noun] + wyde + == + :: + %+ cook + |= [=term =(unit spec)] + ^- skin + ?~ unit + term + [%name term %spec u.unit %base %noun] + ;~ plug sym + (punt ;~(pfix ;~(pose fas tis) wyde)) + == + :: + %+ cook + |= =spec + ^- skin + [%spec spec %base %noun] + wyde + == + :: + ++ tall :: full tall form + %+ knee *hoon + |.(~+((wart (clad ;~(pose expression:(norm &) long lute apex:(sail &)))))) + ++ till :: mold tall form + %+ knee *spec + |.(~+((wert (coat ;~(pose structure:(norm &) scad))))) + ++ wede :: wide bulb + :: XX: lus deprecated + :: + ;~(pfix ;~(pose lus fas) wide) + ++ wide :: full wide form + %+ knee *hoon + |.(~+((wart ;~(pose expression:(norm |) long apex:(sail |))))) + ++ wyde :: mold wide form + %+ knee *spec + |.(~+((wert ;~(pose structure:(norm |) scad)))) + ++ wart + |* zor=rule + %+ here + |= [a=pint b=hoon] + ?:(bug [%dbug [wer a] b] b) + zor + ++ wert + |* zor=rule + %+ here + |= [a=pint b=spec] + ?:(bug [%dbug [wer a] b] b) + zor + -- +:: +++ vest + ~/ %vest + |= tub=nail + ^- (like hoon) + %. tub + %- full + (ifix [gay gay] tall:vast) +:: +++ vice + |= txt=@ta + ^- hoon + (rash txt wide:vast) +:: +++ make :: compile cord to nock + |= txt=@ + q:(~(mint ut %noun) %noun (ream txt)) +:: +++ rain :: parse with % path + |= [bon=path txt=@] + ^- hoon + =+ vaz=vast + ~| bon + (scan (trip txt) (full (ifix [gay gay] tall:vaz(wer bon)))) +:: +++ ream :: parse cord to hoon + |= txt=@ + ^- hoon + (rash txt vest) +:: +++ reck :: parse hoon file + |= bon=path + (rain bon .^(@t %cx (weld bon `path`[%hoon ~]))) +:: +++ ride :: end-to-end compiler + |= [typ=type txt=@] + ^- (pair type nock) + ~> %slog.[0 leaf/"ride: parsing"] + =/ gen (ream txt) + ~> %slog.[0 leaf/"ride: compiling"] + ~< %slog.[0 leaf/"ride: compiled"] + (~(mint ut typ) %noun gen) +:: +:: 5e: molds and mold builders ++| %molds-and-mold-builders +:: ++$ mane $@(@tas [@tas @tas]) :: XML name+space ++$ manx $~([[%$ ~] ~] [g=marx c=marl]) :: dynamic XML node ++$ marl (list manx) :: XML node list ++$ mars [t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata ++$ mart (list [n=mane v=tape]) :: XML attributes ++$ marx $~([%$ ~] [n=mane a=mart]) :: dynamic XML tag ++$ mite (list @ta) :: mime type ++$ pass @ :: public key ++$ ring @ :: private key ++$ ship @p :: network identity ++$ shop (each ship (list @ta)) :: urbit/dns identity ++$ spur path :: ship desk case spur ++$ time @da :: galactic time +:: +:: 5f: profiling support (XX move) ++| %profiling-support +:: +++ pi-heck + |= [nam=@tas day=doss] + ^- doss + =+ lam=(~(get by hit.day) nam) + day(hit (~(put by hit.day) nam ?~(lam 1 +(u.lam)))) +:: +++ pi-noon :: sample trace + |= [mot=term paz=(list path) day=doss] + =| lax=(unit path) + |- ^- doss + ?~ paz day(mon (pi-mope mot mon.day)) + %= $ + paz t.paz + lax `i.paz + cut.day + %+ ~(put by cut.day) i.paz + ^- hump + =+ nax=`(unit path)`?~(t.paz ~ `i.t.paz) + =+ hup=`hump`=+(hup=(~(get by cut.day) i.paz) ?^(hup u.hup [*moan ~ ~])) + :+ (pi-mope mot mon.hup) + ?~ lax out.hup + =+ hag=(~(get by out.hup) u.lax) + (~(put by out.hup) u.lax ?~(hag 1 +(u.hag))) + ?~ nax inn.hup + =+ hag=(~(get by inn.hup) u.nax) + (~(put by inn.hup) u.nax ?~(hag 1 +(u.hag))) + == +++ pi-mope :: add sample + |= [mot=term mon=moan] + ?+ mot mon + %fun mon(fun +(fun.mon)) + %noc mon(noc +(noc.mon)) + %glu mon(glu +(glu.mon)) + %mal mon(mal +(mal.mon)) + %far mon(far +(far.mon)) + %coy mon(coy +(coy.mon)) + %euq mon(euq +(euq.mon)) + == +++ pi-moth :: count sample + |= mon=moan ^- @ud + :(add fun.mon noc.mon glu.mon mal.mon far.mon coy.mon euq.mon) +:: +++ pi-mumm :: print sample + |= mon=moan ^- tape + =+ tot=(pi-moth mon) + ;: welp + ^- tape + ?: =(0 noc.mon) ~ + (welp (scow %ud (div (mul 100 noc.mon) tot)) "n ") + :: + ^- tape + ?: =(0 fun.mon) ~ + (welp (scow %ud (div (mul 100 fun.mon) tot)) "c ") + :: + ^- tape + ?: =(0 glu.mon) ~ + (welp (scow %ud (div (mul 100 glu.mon) tot)) "g ") + :: + ^- tape + ?: =(0 mal.mon) ~ + (welp (scow %ud (div (mul 100 mal.mon) tot)) "m ") + :: + ^- tape + ?: =(0 far.mon) ~ + (welp (scow %ud (div (mul 100 far.mon) tot)) "f ") + :: + ^- tape + ?: =(0 coy.mon) ~ + (welp (scow %ud (div (mul 100 coy.mon) tot)) "y ") + :: + ^- tape + ?: =(0 euq.mon) ~ + (welp (scow %ud (div (mul 100 euq.mon) tot)) "e ") + == +:: +++ pi-tell :: produce dump + |= day=doss + ^- (list tape) + ?: =(day *doss) ~ + =+ tot=(pi-moth mon.day) + ;: welp + [(welp "events: " (pi-mumm mon.day)) ~] + :: + %+ turn + %+ sort ~(tap by hit.day) + |= [a=[* @] b=[* @]] + (lth +.a +.b) + |= [nam=term num=@ud] + :(welp (trip nam) ": " (scow %ud num)) + ["" ~] + :: + %- zing + ^- (list (list tape)) + %+ turn + %+ sort ~(tap by cut.day) + |= [one=(pair path hump) two=(pair path hump)] + (gth (pi-moth mon.q.one) (pi-moth mon.q.two)) + |= [pax=path hup=hump] + =+ ott=(pi-moth mon.hup) + ;: welp + [(welp "label: " (spud pax)) ~] + [(welp "price: " (scow %ud (div (mul 100 ott) tot))) ~] + [(welp "shape: " (pi-mumm mon.hup)) ~] + :: + ?: =(~ out.hup) ~ + :- "into:" + %+ turn + %+ sort ~(tap by out.hup) + |=([[* a=@ud] [* b=@ud]] (gth a b)) + |= [pax=path num=@ud] + ^- tape + :(welp " " (spud pax) ": " (scow %ud num)) + :: + ?: =(~ inn.hup) ~ + :- "from:" + %+ turn + %+ sort ~(tap by inn.hup) + |=([[* a=@ud] [* b=@ud]] (gth a b)) + |= [pax=path num=@ud] + ^- tape + :(welp " " (spud pax) ": " (scow %ud num)) + :: + ["" ~] + ~ + == + == +-- diff --git a/common/hoon/lib/hoon.hoon b/common/hoon/lib/hoon.hoon index 1aeca0e..d9254e7 100644 --- a/common/hoon/lib/hoon.hoon +++ b/common/hoon/lib/hoon.hoon @@ -614,6 +614,33 @@ == -- :: +:: Map/Set helpers for Jock bracket syntax +:: +++ map-get + |* [b=* a=(tree (pair))] + |- + ^- * + ?~ a ~ + ?: =(b p.n.a) `q.n.a + =/ lft $(a l.a) + ?^ lft lft + $(a r.a) +++ map-put |*([b=* c=* a=(tree (pair))] (~(put by a) b c)) +++ map-del |*([b=* a=(tree (pair))] (~(del by a) b)) +++ map-has |*([b=* a=(tree (pair))] !=(~ (map-get b a))) +++ set-get + |* [b=* a=(tree)] + |- + ^- * + ?~ a ~ + ?: =(b n.a) `n.a + =/ lft $(a l.a) + ?^ lft lft + $(a r.a) +++ set-put |*([b=* a=(tree)] (~(put in a) b)) +++ set-del |*([b=* a=(tree)] (~(del in a) b)) +++ set-has |*([b=* a=(tree)] !=(~ (set-get b a))) +:: :: Jugs :: ++ ju @@ -639,4 +666,34 @@ =+ d=(get b) (~(put by a) b (~(put in d) c)) -- +:: +++ scot-ud :: @ud to @t + |= a=@ + ^- @ + ?: =(0 a) '0' + =/ digits=(list @) ~ + =/ b a + |- + ?: =(0 b) + =/ out=@ 0 + |- + ?~ digits out + $(out (cat 3 out i.digits), digits t.digits) + $(b (div b 10), digits [(add 48 (mod b 10)) digits]) +:: +++ scot-ux :: @ux to @t + |= a=@ + ^- @ + ?: =(0 a) '0x0' + =/ digits=(list @) ~ + =/ b a + |- + ?: =(0 b) + =/ out=@ (cat 3 '0' 'x') + |- + ?~ digits out + $(out (cat 3 out i.digits), digits t.digits) + =/ d (mod b 16) + =/ c ?:((lth d 10) (add 48 d) (add 87 d)) + $(b (div b 16), digits [c digits]) -- diff --git a/common/hoon/lib/jock.hoon b/common/hoon/lib/jock.hoon index 7bc966e..27928c9 100644 --- a/common/hoon/lib/jock.hoon +++ b/common/hoon/lib/jock.hoon @@ -10,7 +10,7 @@ :: :: We automatically supply a copy of Hoon into the namespace as an FFI because :: so many built-in tools like arithmetic depend on it. -=< |_ libs=(map term cord) +=< |_ [libs=(map term cord) dbg=?] ++ tokenize |= txt=@ ^- tokens @@ -19,7 +19,7 @@ ++ jeam |= txt=@ ^- jock - =+ [jok tokens]=(~(match-jock +>+>+ libs) (rash txt parse-tokens)) + =+ [jok tokens]=(~(match-jock +>+>+ [libs dbg]) (rash txt parse-tokens)) ?. ?=(~ tokens) ~| 'jeam: must parse to a single jock' ~| remaining+tokens @@ -30,14 +30,14 @@ |= txt=@ ^- * =/ jok (jeam (cat 3 'import hoon;\0a' txt)) - =+ [nok jyp]=(~(mint cj:~(. +> libs) [%atom %string %.n]^%$) jok) + =+ [nok jyp]=(~(mint cj:~(. +> [libs dbg]) [%atom %chars %.n]^%$) jok) nok :: ++ jypist |= txt=@ ^- jype =/ jok (jeam (cat 3 'import hoon;\0a' txt)) - =+ [nok jyp]=(~(mint cj:~(. +> libs) [%atom %string %.n]^%$) jok) + =+ [nok jyp]=(~(mint cj:~(. +> [libs dbg]) [%atom %chars %.n]^%$) jok) jyp -- => @@ -58,12 +58,17 @@ $? %let %func %lambda + %struct %class + %impl + %trait + %union + %alias + %object %if %else %crash %assert - %object %compose %loop %defer @@ -76,33 +81,54 @@ %import %as %print + %unary == :: +$ jpunc $+ jpunc $? %'.' %';' %',' %':' %'&' %'$' - %'@' %'?' %'!' %'((' + %'@' %'?' %'!' %'~' %'((' %'(' %')' %'{' %'}' %'[' %']' %'=' %'<' %'>' %'#' %'+' %'-' %'*' %'/' %'%' %'_' + %'×' %'÷' %'±' + %'⊕' %'⊗' %'⊖' + %'∘' %'·' + %'∩' %'∪' %'∈' %'⊂' %'⊃' + %'^' %'|' %'\\' + %'->' == :: +$ jatom $+ jatom - $~ [[%loobean p=%.n] q=%.n] - $: $% [%string p=cord] + $~ [[%logical p=%.n] q=%.n] + $: $% [%chars p=cord] [%number p=@ud] - [%hexadecimal p=@ux] - [%loobean p=?] + [%sint p=@sd] + [%hex p=@x] + [%real p=@rd] + [%real16 p=@rh] + [%real32 p=@rs] + [%real128 p=@rq] + [%logical p=?(%.y %.n)] + [%date p=@da] + [%span p=@dr] == q=?(%.y %.n) :: constant flag == :: -+$ token - $+ token ++$ jnoun + $+ jnoun + $% [%string p=cord] + [%path p=path] + == +:: ++$ token [pos=hair tok=token-body] ++$ token-body + $+ token-body $% [%keyword keyword] [%punctuator jpunc] - [%literal jatom] + [%literal ?([%atom jatom] [%noun jnoun])] [%name cord] [%type cord] == @@ -122,20 +148,180 @@ ++ gav (cold ~ (star ;~(pose val var gah))) ++ gae ;~(pose gav (easy ~)) :: +++ roy + =/ moo + |= a=tape + :- (lent a) + (scan a (bass 10 (plus sid:ab))) + ;~ pose + ;~ plug + (easy %d) + ;~(pose (cold | hep) (cold & lus) (easy &)) + ;~ plug dim:ag + ;~ pose + ;~(pfix dot (cook moo (plus (shim '0' '9')))) + (easy [0 0]) + == + ;~ pose + ;~ pfix + (just 'e') + ;~(plug ;~(pose (cold | hep) (easy &)) dim:ag) + == + (easy [& 0]) + == + == + == + :: + ;~ plug + (easy %i) + ;~ sfix + ;~(pose (cold | hep) (easy &)) + (jest 'inf') + == + == + :: + ;~ plug + (easy %n) + (cold ~ (jest 'nan')) + == + == +:: +++ pos-tok + |* rul=rule + |= tub=nail + =/ h p.tub + =/ res (rul tub) + ?~ q.res res + [p.res `[p=[h p.u.q.res] q=q.u.q.res]] +:: ++ tokenize =| fun=?(%.y %.n) |% - ++ string (stag %string (cook crip (ifix [soq soq] (star ;~(less soq prn))))) - ++ number (stag %number dem:ag) - ++ hexadecimal (stag %hexadecimal ;~(pfix (jest %'0x') hex)) - ++ loobean - %+ stag %loobean - ;~(pose (cold %.y (jest %true)) (cold %.n (jest %false))) :: - ++ tagged-literal (stag %literal (hart literal %.n)) - ++ literal ;~(pose loobean hexadecimal number string) - ++ tagged-symbol (stag %literal (hart symbol %.y)) - ++ symbol ;~(pfix cen literal) + ++ tagged-keyword (stag %keyword keyword) + ++ keyword + %- perk + :~ %let %func %lambda + %struct %class %impl %trait %union %alias + %object %if %else %crash %assert + %compose %loop %defer + %recur %match %switch %eval %with %this + %import %as %print %unary + :: %for + == + :: + ++ tagged-symbol + %+ stag %literal + %+ stag %atom + (hart ;~(pfix cen literal-atom) %.y) + :: + ++ tagged-literal-atom + %+ stag %literal + %+ stag %atom + (hart literal-atom %.n) + ++ literal-atom + ;~ pose + chars + number + sint + hex + real + real16 + real32 + real128 + logical + date + span + == + :: Single-quoted cord: 'foo' -> @t + ++ chars + %+ stag %chars + (cook crip (ifix [soq soq] (star ;~(less soq prn)))) + :: Numeric literal: 1234 -> @ud + ++ number + %+ stag %number + dem + :: Signed numeric literal: -1234, +1234 -> @sd + ++ sint + %+ stag %sint + ;~ pose + (cook |=(n=@ud (new:si & n)) ;~(pfix lus dem:ag)) + (cook |=(n=@ud (new:si | n)) ;~(pfix hep dem:ag)) + == + :: TODO switch to dep when fixed for +1_234_678 support + :: Hexadecimal literal: 0xBA1A3F, 0xba1a3f -> @x + ++ hex + %+ stag %hex + ;~(pfix (jest %'0x') ^hex) + :: Real 64-bit float: 3.14, +3.14, -0.001 -> @rd + ++ real + %+ stag %real + (cook ryld (cook royl-cell:so roy)) + :: Real 16-bit float: 3.14, +3.14, -0.001 -> @rh + ++ real16 + %+ stag %real16 + (cook rylh (cook royl-cell:so roy)) + :: Real 32-bit float: 3.14, +3.14, -0.001 -> @rs + ++ real32 + %+ stag %real32 + (cook ryls (cook royl-cell:so roy)) + :: Real 128-bit float: 3.14, +3.14, -0.001 -> @rq + ++ real128 + %+ stag %real128 + (cook rylq (cook royl-cell:so roy)) + :: Real 64-bit float alias + ++ real64 real + :: Logical loobean: %true, %false -> ? + ++ logical + %+ stag %logical + ;~ pose + (cold %.y (jest %true)) + (cold %.n (jest %false)) + == + :: Date: @2026.1.1..12.0.0..ffff -> @da + ++ date + %+ stag %date + ;~(pfix pat (cook year when:so)) + :: Span: ~d15h23m45s -> @dr + ++ span + %+ stag %span + %+ cook + |= [a=(list [p=?(%d %h %m %s) q=@]) b=(list @)] + =+ rop=`tarp`[0 0 0 0 b] + |- ^- @dr + ?~ a (yule rop) + ?- p.i.a + %d $(a t.a, d.rop (add q.i.a d.rop)) + %h $(a t.a, h.rop (add q.i.a h.rop)) + %m $(a t.a, m.rop (add q.i.a m.rop)) + %s $(a t.a, s.rop (add q.i.a s.rop)) + == + ;~ plug + %+ most + dot + ;~ pose + ;~(pfix (just 'd') (stag %d dim:ag)) + ;~(pfix (just 'h') (stag %h dim:ag)) + ;~(pfix (just 'm') (stag %m dim:ag)) + ;~(pfix (just 's') (stag %s dim:ag)) + == + ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~)) + == + ++ tagged-literal-noun + %+ stag %literal + %+ stag %noun + ;~ pose + string + jpath + == + :: Double-quoted cord: "foo" -> @t + ++ string + %+ stag %string + (cook crip (ifix [doq doq] (star ;~(less doq prn)))) + :: Path: /foo/bar/baz -> path + ++ jpath + %+ stag %path + stap :: add a suffix label ++ hart |* [sef=rule gob=*] @@ -150,44 +336,51 @@ :: the goal is to parse a function call into the pseudo-punctuator '(('. :: This only happens if there is a name or type immediately preceding '(', :: e.g. foo(bar) -> 'foo' '((' 'bar' ')' - ++ tagged-name (stag %name name) :: [%name term] - ++ name snek :: term with _ - ++ snek %+ cook - |=(a=tape (rap 3 ^-((list @) a))) - ;~(plug low (star ;~(pose nud low cab))) + ++ tagged-name (stag %name sym) :: - ++ tagged-type (stag %type type) :: [%type 'Cord'] - ++ type aul :: Cord - ++ aul %+ cook :: Ulll - |=(a=tape (rap 3 ^-((list @) a))) - ;~(plug hig (star low)) + ++ tagged-type + %+ stag %type + nik + :: PascalCase identifier (type names) + ++ nik + %+ cook + |=(a=tape (rap 3 ^-((list @) a))) + ;~(plug hig (star ;~(pose hig low))) :: - ++ tagged-keyword (stag %keyword keyword) - ++ keyword - %- perk - :~ %let %func %lambda %class - %if %else %crash %assert - %object %compose %loop %defer - %recur %match %switch %eval %with %this - %import %as %print - == - :: - ++ tagged-punctuator %+ cook - |= =token - ^- ^token - ?. &(fun =([%punctuator %'('] token)) - token - :: =. fun %.n - [%punctuator `jpunc`%'(('] - (stag %punctuator punctuator) + ++ tagged-punctuator + %+ cook + |= =token-body + ^- ^token-body + ?. &(fun =([%punctuator %'('] token-body)) + token-body + :: =. fun %.n + [%punctuator `jpunc`%'(('] + (stag %punctuator punctuator) ++ punctuator - %- perk - :~ %'.' %';' %',' %':' %'&' %'$' - %'@' %'?' %'!' :: XXX exclude %'((' which is a pseudo-punctuator - %'(' %')' %'{' %'}' %'[' %']' - %'=' %'<' %'>' %'#' - %'+' %'-' %'*' %'/' %'%' %'_' - == + ;~ pose + (cold %'->' (jest '->')) :: must come before solo '-' + :: Unicode operators (multi-byte, must come before perk) + (cold %'×' (jest '×')) + (cold %'÷' (jest '÷')) + (cold %'±' (jest '±')) + (cold %'⊕' (jest '⊕')) + (cold %'⊗' (jest '⊗')) + (cold %'⊖' (jest '⊖')) + (cold %'∘' (jest '∘')) + (cold %'·' (jest '·')) + (cold %'∩' (jest '∩')) + (cold %'∪' (jest '∪')) + (cold %'∈' (jest '∈')) + (cold %'⊂' (jest '⊂')) + (cold %'⊃' (jest '⊃')) + %- perk + :~ %'.' %';' %',' %':' %'&' %'$' + %'@' %'?' %'!' %'~' :: XXX exclude %'((' which is a pseudo-punctuator + %'(' %')' %'{' %'}' %'[' %']' + %'=' %'<' %'>' %'#' + %'+' %'-' %'*' %'/' %'%' %'_' + %'^' %'|' %'\\' + == == :: :: The parser's precedence rules: :: 1. Keywords @@ -199,12 +392,13 @@ :: +$ upcast [term *] ++ tokens ;~ pose - (knee *(list token) |.(~+(;~(plug tagged-keyword ;~(pfix gav tokens(fun %.n)))))) - (knee *(list token) |.(~+(;~(plug tagged-symbol ;~(pfix gav tokens(fun %.n)))))) - (knee *(list token) |.(~+(;~(plug tagged-literal ;~(pfix gav tokens(fun %.n)))))) - (knee *(list token) |.(~+(;~(plug tagged-name ;~(pfix gav tokens(fun %.y)))))) - (knee *(list token) |.(~+(;~(plug tagged-punctuator ;~(pfix gav tokens(fun %.n)))))) - (knee *(list token) |.(~+(;~(plug tagged-type ;~(pfix gav tokens(fun %.y)))))) + (knee *(list token) |.(~+(;~(plug (pos-tok tagged-keyword) ;~(pfix gav tokens(fun %.n)))))) + (knee *(list token) |.(~+(;~(plug (pos-tok tagged-symbol) ;~(pfix gav tokens(fun %.n)))))) + (knee *(list token) |.(~+(;~(plug (pos-tok tagged-literal-atom) ;~(pfix gav tokens(fun %.n)))))) + (knee *(list token) |.(~+(;~(plug (pos-tok tagged-literal-noun) ;~(pfix gav tokens(fun %.n)))))) + (knee *(list token) |.(~+(;~(plug (pos-tok tagged-name) ;~(pfix gav tokens(fun %.y)))))) + (knee *(list token) |.(~+(;~(plug (pos-tok tagged-punctuator) ;~(pfix gav tokens(fun %.n)))))) + (knee *(list token) |.(~+(;~(plug (pos-tok tagged-type) ;~(pfix gav tokens(fun %.y)))))) (easy ~) == :: @@ -232,43 +426,65 @@ :: :: Ultimately all cases in the Jock AST resolve as one of jock, jype, or jlimb. :: -|_ libs=(map term cord) +|_ [libs=(map term cord) dbg=?] +| %ast :: +$ jock $+ jock $^ [p=jock q=jock] - $% [%let type=jype val=jock next=jock] - [%func type=jype body=jock next=jock] - [%class state=jype arms=(map term jock)] - [%method type=jype body=jock] + $% [%let pos=hair type=jype val=jock next=jock] [%edit limb=(list jlimb) val=jock next=jock] - [%increment val=jock] - [%cell-check val=jock] - [%compose p=jock q=jock] + [%func pos=hair type=jype body=jock next=jock] + [%lambda p=lambda] + [%struct name=cord fields=(list [name=term type=jype])] + [%struct-literal name=cord vals=(map term jock)] + :: [%impl] + [%trait name=cord methods=(list term) op=(unit operator) unary=?] + :: [%union] + [%alias name=cord target=cord] + [%class state=jype arms=(map term jock) traits=(list cord)] + [%method type=jype body=jock] + :: [%object name=term p=(map term jock) q=(unit jock)] - [%eval p=jock q=jock] - [%loop next=jock] - [%defer next=jock] if-expression [%assert cond=jock then=jock] + [%compose pos=hair p=jock q=jock] + [%loop next=jock] + [%defer next=jock] [%match value=jock cases=(map jock jock) default=(unit jock)] - [%cases value=jock cases=(map jock jock) default=(unit jock)] - [%call func=jock arg=(unit jock)] - [%compare comp=comparator a=jock b=jock] + [%switch value=jock cases=(map jock jock) default=(unit jock)] + [%eval p=jock q=jock] + [%print pos=hair body=?([%jock jock]) next=jock] + :: [%operator op=operator a=jock b=(unit jock)] - [%lambda p=lambda] + [%increment val=jock] + [%cell-check val=jock] + [%call pos=hair func=jock arg=(unit jock)] + [%index expr=jock idx=jock] + [%index-empty expr=jock] :: expr[] — stack peek + [%index-has expr=jock idx=jock] :: expr[idx?] — map/set has + [%index-del expr=jock idx=jock] :: expr[!idx] — map/set del + [%index-pop expr=jock] :: expr[!] — stack pop + [%index-put expr=jock idx=(unit jock) val=jock next=jock] :: expr[idx]=val / expr[]=val + [%index-slice expr=jock start=jock end=jock] :: expr[i:j] — byte slice + [%index-uslice expr=jock start=jock end=jock] :: expr[i::j] — unicode slice (stub) + [%cast mode=?(%as %as-q %as-x) expr=jock target=jype] + [%coalesce expr=jock fallback=jock] + [%bind name=term] + [%compare comp=comparator a=jock b=jock] [%limb p=(list jlimb)] [%atom p=jatom] + [%noun p=jnoun] [%list type=jype-leaf val=(list jock)] + [%map type=jype-leaf val=(map jock jock)] [%set type=jype-leaf val=(set jock)] - [%import name=jype next=jock] - [%print body=?([%jock jock]) next=jock] - [%crash ~] + [%import pos=hair name=jype next=jock] + [%crash ~] :: keep last for Hoon type bunting == :: +$ if-expression $: %if + pos=hair cond=jock then=jock after=after-if-expression @@ -316,6 +532,11 @@ %'/' %'%' %'**' + %'×' %'÷' %'±' + %'⊕' %'⊗' %'⊖' + %'∘' %'·' + %'∩' %'∪' %'∈' %'⊂' %'⊃' + %'^' %'|' %'\\' == :: ++ operator-set @@ -323,6 +544,7 @@ ^- (set term) %- silt ^- (list operator) + %- welp :_ ~[%'×' %'÷' %'±' %'⊕' %'⊗' %'⊖' %'∘' %'·' %'∩' %'∪' %'∈' %'⊂' %'⊃' %'^' %'|' %'\\'] ~[%'+' %'-' %'*' %'/' %'%' %'**'] :: Jype type base types +$ jype @@ -342,17 +564,31 @@ [%fork p=jype q=jype] :: %list [%list type=jype] + :: %map + [%map key=jype val=jype] + :: %noun + [%noun p=jnoun-type] :: %set [%set type=jype] + :: %stack + [%stack type=jype] :: %hoon is a vase for the supplied subject (presumably hoon or tiny) :: [%hoon p=vase] [%hoon p=truncated-vase] :: %state is a container for class state [%state p=jype] + :: %struct is a product type with named fields + [%struct name=cord fields=struct-fields] + :: %trait is a compile-time trait definition + [%trait name=cord methods=(list term) op=(unit operator) unary=?] :: %none is a null type (as for undetermined variable labels) [%none p=(unit term)] == :: ++$ struct-fields + $+ struct-fields + (list [name=term type=jype]) +:: +$ truncated-vase $+ truncated-vase $: p=type @@ -361,10 +597,23 @@ :: Jype atom base types; corresponds to jatom tags +$ jatom-type $+ jatom-type - $? %string + $? %chars %number - %hexadecimal - %loobean + %sint + %hex + %real + %real16 + %real32 + %real128 + %logical + %date + %span + == +:: Jype noun base types; corresponds to jnoun tags ++$ jnoun-type + $+ jnoun-type + $? %string + %path == :: Jype core executable, either a direct lambda or a regular core +$ core-body (each lambda-argument (map term jype)) @@ -402,42 +651,151 @@ ?: =(~ tokens) ~|("expect jock. token: ~" !!) =^ lock tokens - ?- -<.tokens + ?- -.+.-.tokens %literal (match-literal tokens) %name (match-start-name tokens) %keyword (match-keyword tokens) %punctuator (match-start-punctuator tokens) %type (match-start-name tokens) == + :: -- postfix indexing loop: expr[index] + |- ?: =(~ tokens) [lock tokens] - =^ oc=(unit term) tokens - (any-operator tokens) - ?~ oc [lock tokens] - :: Handle mapping externally. - ?: &(=(%'-' u.oc) =(%'>' ->.tokens)) - :: Re-attach map operator. - [lock [[%punctuator %'-'] tokens]] - :: - compare ('==','<','<=','>','>=','!=' is the next token) - ?: (~(has in comparator-set) u.oc) - =^ rock tokens + ?. (has-punctuator -.tokens %'[') + :: not indexing, fall through to cast/operator checks + :: - cast (as, as?, as!) + ?: (has-keyword -.tokens %as) + =. tokens +.tokens :: skip 'as' keyword + =/ mode=?(%as %as-q %as-x) + ?: &(!=(~ tokens) (has-punctuator -.tokens %'?')) + %as-q + ?: &(!=(~ tokens) (has-punctuator -.tokens %'!')) + %as-x + %as + =? tokens !=(%as mode) +.tokens :: skip '?' or '!' + =^ target tokens + (match-jype tokens) + $(lock [%cast mode lock target]) + :: - null coalesce (??) + ?: &((has-punctuator -.tokens %'?') !=(~ +.tokens) (has-punctuator +<.tokens %'?')) + =. tokens +>.tokens :: skip both '?' tokens + =^ fallback tokens + (match-inner-jock tokens) + $(lock [%coalesce lock fallback]) + =^ oc=(unit term) tokens + (any-operator tokens) + ?~ oc [lock tokens] + :: Handle mapping externally. + ?: &(=(%'-' u.oc) =(%'>' +.+.-.tokens)) + :: Re-attach map operator. + [lock [[[0 0] [%punctuator %'-']] tokens]] + :: - compare ('==','<','<=','>','>=','!=' is the next token) + ?: (~(has in comparator-set) u.oc) + =^ rock tokens + (match-inner-jock tokens) + [[%compare ;;(comparator u.oc) lock rock] tokens] + :: - arithmetic ('+' or '-' or '*' or '/' or '%' or '**' is next) + ?: (~(has in operator-set) u.oc) + =^ rock tokens + (match-inner-jock tokens) + :_ tokens + ;; jock + [%operator u.oc lock `rock] + :: no infix operator + [lock tokens] + :: parse bracket expression inside [...] + =. tokens +.tokens :: skip '[' + :: Case 1: empty brackets — expr[] + ?: (has-punctuator -.tokens %']') + =. tokens +.tokens :: skip ']' + :: expr[] = val; → set put / stack push + ?: &(!=(~ tokens) (has-punctuator -.tokens %'=')) + ?: &(!=(~ +.tokens) (has-punctuator +<.tokens %'=')) + :: '==' comparator, not assignment — treat as peek + $(lock ;;(jock [%index-empty lock])) + =^ val tokens + (match-inner-jock +.tokens) :: skip '=' + ?> (got-punctuator -.tokens %';') + =^ next tokens + (match-jock +.tokens) + [;;(jock [%index-put lock ~ val next]) tokens] + :: expr[] → stack peek + $(lock ;;(jock [%index-empty lock])) + :: Case 2: '!' prefix — expr[!] or expr[!idx] + ?: (has-punctuator -.tokens %'!') + =. tokens +.tokens :: skip '!' + ?: (has-punctuator -.tokens %']') + :: expr[!] → stack pop + $(lock ;;(jock [%index-pop lock]), tokens +.tokens) + :: expr[!idx] → map/set del + =^ idx tokens (match-inner-jock tokens) - [[%compare ;;(comparator u.oc) lock rock] tokens] - :: - arithmetic ('+' or '-' or '*' or '/' or '%' or '**' is next) - ?: (~(has in operator-set) u.oc) - =^ rock tokens + ?> (got-punctuator -.tokens %']') + $(lock ;;(jock [%index-del lock idx]), tokens +.tokens) + :: Case 3: normal expression — expr[idx], expr[idx?], expr[idx]=val + =^ idx tokens + (match-inner-jock tokens) + :: expr[idx?] → map/set has + ?: (has-punctuator -.tokens %'?') + =. tokens +.tokens :: skip '?' + ?> (got-punctuator -.tokens %']') + $(lock ;;(jock [%index-has lock idx]), tokens +.tokens) + :: check for slice syntax: expr[start:end] or expr[start::end] + ?: ?& !=(~ tokens) + (has-punctuator -.tokens %':') + == + :: unicode slice: expr[start::end] (two colons) + ?: ?& !=(~ +.tokens) + (has-punctuator +<.tokens %':') + == + =. tokens +.+.tokens :: skip '::' + =^ end tokens + (match-inner-jock tokens) + ?> (got-punctuator -.tokens %']') + $(lock ;;(jock [%index-uslice lock idx end]), tokens +.tokens) + =. tokens +.tokens :: skip ':' + =^ end tokens (match-inner-jock tokens) - :_ tokens - ;; jock - [%operator u.oc lock `rock] - :: no infix operator - [lock tokens] + ?> (got-punctuator -.tokens %']') + $(lock ;;(jock [%index-slice lock idx end]), tokens +.tokens) + ?> (got-punctuator -.tokens %']') + =. tokens +.tokens :: skip ']' + :: expr[idx] = val; → map put + ?: &(!=(~ tokens) (has-punctuator -.tokens %'=')) + ?: &(!=(~ +.tokens) (has-punctuator +<.tokens %'=')) + :: '==' comparator, not assignment — treat as get + $(lock ;;(jock [%index lock idx])) + =^ val tokens + (match-inner-jock +.tokens) :: skip '=' + ?> (got-punctuator -.tokens %';') + =^ next tokens + (match-jock +.tokens) + [;;(jock [%index-put lock `idx val next]) tokens] + :: expr[idx] → get (existing behavior) + $(lock ;;(jock [%index lock idx])) +:: +++ splice-jock + |= [lib=jock nex=jock] + ^- jock + ?: ?=(%compose -.lib) + lib(q $(lib q.lib)) + ?: ?=(%func -.lib) + lib(next $(lib next.lib)) + ?: ?=(%let -.lib) + lib(next $(lib next.lib)) + ?: ?=(%index-put -.lib) + lib(next $(lib next.lib)) + nex :: ++ match-inner-jock |= =tokens ^- [jock (list token)] ?: =(~ tokens) ~|("expect inner-jock. token: ~" !!) ?: ?| (has-keyword -.tokens %object) + (has-keyword -.tokens %alias) + (has-keyword -.tokens %struct) (has-keyword -.tokens %class) + (has-keyword -.tokens %trait) (has-keyword -.tokens %with) (has-keyword -.tokens %this) (has-keyword -.tokens %crash) @@ -445,43 +803,158 @@ (match-jock tokens) => .(tokens `(list token)`tokens) :: TMI =^ lock tokens - ?+ -<.tokens !! + ?+ -.+.-.tokens !! %literal (match-literal tokens) %name (match-start-name tokens) %punctuator (match-start-punctuator tokens) %type (match-start-name tokens) == - ?~ tokens [lock tokens] - :: - compare ('==','<','<=','>','>=','!=' is the next token) - ?: ?| &((has-punctuator -.tokens %'=') (has-punctuator +<.tokens %'=')) - (has-punctuator -.tokens %'<') - &((has-punctuator -.tokens %'<') (has-punctuator +<.tokens %'=')) - (has-punctuator -.tokens %'>') - &((has-punctuator -.tokens %'>') (has-punctuator +<.tokens %'=')) - &((has-punctuator -.tokens %'!') (has-punctuator +<.tokens %'=')) + :: -- postfix indexing loop: expr[index] + :: Only index after names/calls/parens, not after list/set/map literals + |- + ?: =(~ tokens) [lock tokens] + ?. ?& (has-punctuator -.tokens %'[') + !?=(%list -.lock) + !?=(%map -.lock) + !?=(%set -.lock) == - => .(tokens `(list token)`tokens) :: TMI - =^ comp tokens - (match-comparator tokens) - =^ rock tokens + :: not indexing, fall through to cast/comparator/operator checks + ?: =(~ tokens) [lock tokens] + :: - cast (as, as?, as!) + ?: (has-keyword -.tokens %as) + =. tokens +.tokens :: skip 'as' keyword + =/ mode=?(%as %as-q %as-x) + ?: &(!=(~ tokens) (has-punctuator -.tokens %'?')) + %as-q + ?: &(!=(~ tokens) (has-punctuator -.tokens %'!')) + %as-x + %as + =? tokens !=(%as mode) +.tokens :: skip '?' or '!' + =^ target tokens + (match-jype tokens) + $(lock [%cast mode lock target]) + :: - null coalesce (??) + ?: &((has-punctuator -.tokens %'?') !=(~ +.tokens) (has-punctuator +<.tokens %'?')) + =. tokens +>.tokens :: skip both '?' tokens + =^ fallback tokens + (match-inner-jock tokens) + $(lock [%coalesce lock fallback]) + :: - compare ('==','<','<=','>','>=','!=' is the next token) + ?: ?| &((has-punctuator -.tokens %'=') (has-punctuator +<.tokens %'=')) + (has-punctuator -.tokens %'<') + &((has-punctuator -.tokens %'<') (has-punctuator +<.tokens %'=')) + (has-punctuator -.tokens %'>') + &((has-punctuator -.tokens %'>') (has-punctuator +<.tokens %'=')) + &((has-punctuator -.tokens %'!') (has-punctuator +<.tokens %'=')) + == + => .(tokens `(list token)`tokens) :: TMI + =^ comp tokens + (match-comparator tokens) + =^ rock tokens + (match-inner-jock tokens) + [[%compare comp lock rock] tokens] + :: - arithmetic ('+' or '-' or '*' or '/' or '%' or '**' is next) + ?: ?| (has-punctuator -.tokens %'+') + (has-punctuator -.tokens %'-') + (has-punctuator -.tokens %'*') + (has-punctuator -.tokens %'/') + (has-punctuator -.tokens %'%') + (has-punctuator -.tokens %'×') + (has-punctuator -.tokens %'÷') + (has-punctuator -.tokens %'±') + (has-punctuator -.tokens %'⊕') + (has-punctuator -.tokens %'⊗') + (has-punctuator -.tokens %'⊖') + (has-punctuator -.tokens %'∘') + (has-punctuator -.tokens %'·') + (has-punctuator -.tokens %'∩') + (has-punctuator -.tokens %'∪') + (has-punctuator -.tokens %'∈') + (has-punctuator -.tokens %'⊂') + (has-punctuator -.tokens %'⊃') + (has-punctuator -.tokens %'^') + (has-punctuator -.tokens %'|') + (has-punctuator -.tokens %'\\') + :: &((has-punctuator -.tokens %'*') (has-punctuator +<.tokens %'*')) :: subcase of '*' + == + => .(tokens `(list token)`tokens) :: TMI + =^ op tokens + (match-operator tokens) + =^ rock tokens + (match-inner-jock tokens) + [[%operator op lock `rock] tokens] + :: no infix operator + [lock tokens] + :: parse bracket expression inside [...] + =. tokens +.tokens :: skip '[' + :: Case 1: empty brackets — expr[] + ?: (has-punctuator -.tokens %']') + =. tokens +.tokens :: skip ']' + :: expr[] = val; → set put / stack push + ?: &(!=(~ tokens) (has-punctuator -.tokens %'=')) + ?: &(!=(~ +.tokens) (has-punctuator +<.tokens %'=')) + :: '==' comparator, not assignment — treat as peek + $(lock ;;(jock [%index-empty lock])) + =^ val tokens + (match-inner-jock +.tokens) :: skip '=' + ?> (got-punctuator -.tokens %';') + =^ next tokens + (match-jock +.tokens) + [;;(jock [%index-put lock ~ val next]) tokens] + :: expr[] → stack peek + $(lock ;;(jock [%index-empty lock])) + :: Case 2: '!' prefix — expr[!] or expr[!idx] + ?: (has-punctuator -.tokens %'!') + =. tokens +.tokens :: skip '!' + ?: (has-punctuator -.tokens %']') + :: expr[!] → stack pop + $(lock ;;(jock [%index-pop lock]), tokens +.tokens) + :: expr[!idx] → map/set del + =^ idx tokens (match-inner-jock tokens) - [[%compare comp lock rock] tokens] - :: - arithmetic ('+' or '-' or '*' or '/' or '%' or '**' is next) - ?: ?| (has-punctuator -.tokens %'+') - (has-punctuator -.tokens %'-') - (has-punctuator -.tokens %'*') - (has-punctuator -.tokens %'/') - (has-punctuator -.tokens %'%') - :: &((has-punctuator -.tokens %'*') (has-punctuator +<.tokens %'*')) :: subcase of '*' + ?> (got-punctuator -.tokens %']') + $(lock ;;(jock [%index-del lock idx]), tokens +.tokens) + :: Case 3: normal expression — expr[idx], expr[idx?], expr[idx]=val + =^ idx tokens + (match-inner-jock tokens) + :: expr[idx?] → map/set has + ?: (has-punctuator -.tokens %'?') + =. tokens +.tokens :: skip '?' + ?> (got-punctuator -.tokens %']') + $(lock ;;(jock [%index-has lock idx]), tokens +.tokens) + :: check for slice syntax: expr[start:end] or expr[start::end] + ?: ?& !=(~ tokens) + (has-punctuator -.tokens %':') == - => .(tokens `(list token)`tokens) :: TMI - =^ op tokens - (match-operator tokens) - =^ rock tokens + :: unicode slice: expr[start::end] (two colons) + ?: ?& !=(~ +.tokens) + (has-punctuator +<.tokens %':') + == + =. tokens +.+.tokens :: skip '::' + =^ end tokens + (match-inner-jock tokens) + ?> (got-punctuator -.tokens %']') + $(lock ;;(jock [%index-uslice lock idx end]), tokens +.tokens) + =. tokens +.tokens :: skip ':' + =^ end tokens (match-inner-jock tokens) - [[%operator op lock `rock] tokens] - :: no infix operator - [lock tokens] + ?> (got-punctuator -.tokens %']') + $(lock ;;(jock [%index-slice lock idx end]), tokens +.tokens) + ?> (got-punctuator -.tokens %']') + =. tokens +.tokens :: skip ']' + :: expr[idx] = val; → map put + ?: &(!=(~ tokens) (has-punctuator -.tokens %'=')) + ?: &(!=(~ +.tokens) (has-punctuator +<.tokens %'=')) + :: '==' comparator, not assignment — treat as get + $(lock ;;(jock [%index lock idx])) + =^ val tokens + (match-inner-jock +.tokens) :: skip '=' + ?> (got-punctuator -.tokens %';') + =^ next tokens + (match-jock +.tokens) + [;;(jock [%index-put lock `idx val next]) tokens] + :: expr[idx] → get (existing behavior) + $(lock ;;(jock [%index lock idx])) :: ++ match-pair-inner-jock |= =tokens @@ -509,7 +982,7 @@ =^ pairs tokens $ [[jock-nex pairs] tokens] - ?+ -<.tokens !! + ?+ -.+.-.tokens !! %literal (match-literal tokens) %name (match-start-name tokens) %punctuator (match-start-punctuator tokens) @@ -523,7 +996,7 @@ ~|("expect jock. token: ~" !!) ?: (has-punctuator -.tokens end) !! =^ jock tokens - ?- -<.tokens + ?- -.+.-.tokens %literal :: TODO: check if we're in a compare (match-literal tokens) @@ -543,9 +1016,8 @@ (match-jype tokens) =^ inp=jype tokens (match-block [tokens %'((' %')'] match-jype) - ?> (got-punctuator -.tokens %'-') - ?> (got-punctuator +<.tokens %'>') - =. tokens +>.tokens + ?> (got-punctuator -.tokens %'->') + =. tokens +.tokens =^ out=jype tokens (match-jype tokens) ?> (got-punctuator -.tokens %';') @@ -558,10 +1030,23 @@ ^- [jock (list token)] ?: =(~ tokens) ~|("expect jock. token: ~" !!) =/ first=token -.tokens - ?. ?=(%punctuator -.first) - ~|("expect start-punctuator. token: {<-.first>}" !!) + ?. ?=(%punctuator -.+.first) + ~|("expect start-punctuator. token: {<+.first>}" !!) =. tokens +.tokens - ?+ +.first ~|("expect start-punctuator. token: {<+.first>}" !!) + ?+ +.+.first + :: Default: check for unary prefix operator at expression start + ?. (~(has in operator-set) +.+.first) + ~|("expect start-punctuator. token: {<+.+.first>}" !!) + =/ op=operator ;;(operator +.+.first) + =/ nxt=token -.tokens + =^ operand tokens + ?+ -.+.nxt ~|('unary operator: expected operand' !!) + %literal (match-literal tokens) + %name (match-start-name tokens) + %punctuator (match-start-punctuator tokens) + %type (match-start-name tokens) + == + [[%operator op operand ~] tokens] :: Increment +(0) %'+' =^ jock tokens @@ -574,32 +1059,70 @@ (match-block [tokens %'(' %')'] match-inner-jock) :: TODO: check if we're in a compare [[%cell-check jock] tokens] + :: Null literal ~ + %'~' + [[%atom [%number 0] %.y] tokens] :: $ = recur %'$' ?. (has-punctuator -.tokens %'(') - [[%call [%limb [%axis 0] ~] ~] tokens] + [[%call pos.first [%limb [%axis 0] ~] ~] tokens] ?: (has-punctuator -.tokens %')') - [[%call [%limb [%axis 0] ~] ~] +>.tokens] + [[%call pos.first [%limb [%axis 0] ~] ~] +>.tokens] =^ arg tokens (match-block [tokens %'(' %')'] match-inner-jock) - [[%call [%limb [%axis %0] ~] `arg] tokens] + [[%call pos.first [%limb [%axis %0] ~] `arg] tokens] :: Axis address &1 %'&' :: TODO: check if we're in a compare =^ axis-lit tokens - (match-axis [[%punctuator %'&'] tokens]) + (match-axis [[[0 0] [%punctuator %'&']] tokens]) ?: =(~ tokens) [[%limb axis-lit ~] tokens] ?. (has-punctuator -.tokens %'(') :: XXX not '(' because of parser [[%limb axis-lit ~] tokens] =^ arg tokens (match-block [tokens %'(' %')'] match-inner-jock) :: XXX not '(' - [[%call [%limb axis-lit ~] `arg] tokens] - :: Set {1 2 3} + [[%call pos.first [%limb axis-lit ~] `arg] tokens] + :: Set or Map: {1, 2, 3} or {1 -> "a", 2 -> "b"} %'{' - :: {one + :: Empty case: {} is empty set + ?: (has-punctuator -.tokens %'}') + :_ +.tokens + [%set [%none ~] ~] + :: Empty map: {->} + ?: ?& !=(~ tokens) + (has-punctuator -.tokens %'->') + !=(~ +.tokens) + (has-punctuator +<.tokens %'}') + == + :_ +.+.tokens + [%map [%none ~] ~] + :: Parse first element =^ jock-one tokens (match-inner-jock tokens) + :: Check for -> to determine if this is a map + ?: (has-punctuator -.tokens %'->') + :: MAP: {key -> value, ...} + =. tokens +.tokens :: skip -> + =^ val-one tokens + (match-inner-jock tokens) + =/ acc=(map jock jock) + (~(put by *(map jock jock)) jock-one val-one) + |- ^- [jock (list token)] + ?: (has-punctuator -.tokens %'}') + :_ +.tokens + [%map [%none ~] acc] + :: Skip optional comma + =? tokens (has-punctuator -.tokens %',') +.tokens + ?: (has-punctuator -.tokens %'}') + :_ +.tokens + [%map [%none ~] acc] + =^ key tokens (match-inner-jock tokens) + ?> (got-punctuator -.tokens %'->') + =. tokens +.tokens + =^ val tokens (match-inner-jock tokens) + $(acc (~(put by acc) key val)) + :: SET: {elem, elem, ...} (existing logic) =/ acc=(set jock) (sy jock-one ~) |- ^- [jock (list token)] @@ -610,17 +1133,22 @@ :+ %set [%none ~] acc + :: Skip optional comma for sets too + =? tokens (has-punctuator -.tokens %',') +.tokens + ?: (has-punctuator -.tokens %'}') + :_ +.tokens + [%set [%none ~] acc] :: {...} =^ jock-nex tokens (match-inner-jock tokens) $(acc (~(put in acc) jock-nex)) :: Tuple %'(' - (match-pair-inner-jock [[%punctuator %'('] tokens]) + (match-pair-inner-jock [[[0 0] [%punctuator %'(']] tokens]) :: Call %'((' =^ lambda tokens - (match-lambda [[%punctuator %'(('] +.tokens]) + (match-lambda [[[0 0] [%punctuator %'((']] +.tokens]) ?: =(~ tokens) [[%lambda lambda] tokens] ?. (has-punctuator -.tokens %'((') @@ -628,12 +1156,12 @@ =. tokens +.tokens ?: (has-punctuator -.tokens %')') :: no argument - [[%call [%lambda lambda] ~] +.tokens] + [[%call pos.first [%lambda lambda] ~] +.tokens] =^ arg tokens :: match arbitrary number of arguments - (match-pair-inner-jock [[%punctuator %'('] tokens]) + (match-pair-inner-jock [[[0 0] [%punctuator %'(']] tokens]) ?> (got-punctuator -.tokens %')') - [[%call [%lambda lambda] `arg] +.tokens] + [[%call pos.first [%lambda lambda] `arg] +.tokens] :: Null-terminated list [1 2 3] %'[' :: [one @@ -667,14 +1195,14 @@ |= =tokens ^- [jock (list token)] ?: =(~ tokens) ~|("expect expression starting with name. token: ~" !!) - :: ?. ?=(%name -<.tokens) :: XXX commented out for typing issues - :: ~|("expect name. token: {<-<.tokens>}" !!) + :: ?. ?=(%name -.+.-.tokens) :: XXX commented out for typing issues + :: ~|("expect name. token: {<-.+.-.tokens>}" !!) :: How a name is parsed depends on the next symbol. - =/ has-name ?=(%name -<.tokens) + =/ has-name ?=(%name -.+.-.tokens) =/ name=cord - ~| "expect name. token: {<-<.tokens>}" - ?: has-name ;;(cord ->.tokens) - ?> =(%type -<.tokens) + ~| "expect name. token: {<-.+.-.tokens>}" + ?: has-name ;;(cord +.+.-.tokens) + ?> =(%type -.+.-.tokens) (got-name -.tokens) =. tokens +.tokens =/ limbs=(list jlimb) ~[(make-jlimb name)] @@ -686,11 +1214,33 @@ ?: (has-punctuator -.tokens %';') [[%limb limbs] tokens] |- + ?: =(~ tokens) + [[%limb limbs] tokens] + :: - struct literal (Type { field: value, ... }) + ?: &((is-type name) (has-punctuator -.tokens %'{')) + =. tokens +.tokens + =| vmap=(map term jock) + =^ vmap tokens + |- + ?: (has-punctuator -.tokens %'}') + [vmap +.tokens] + =/ field-name=term + (got-name -.tokens) + =. tokens +.tokens + ?> (got-punctuator -.tokens %':') + =^ fval tokens + (match-inner-jock +.tokens) + =? tokens (has-punctuator -.tokens %',') + +.tokens + $(vmap (~(put by vmap) field-name fval)) + [[%struct-literal name vmap] tokens] :: - %name (there is a wing with multiple entries) ?: (has-punctuator -.tokens %'.') =^ limbs tokens =/ acc=(list jlimb) ~ |- + ?: =(~ tokens) + [(flop acc) tokens] ?. (has-punctuator -.tokens %'.') [(flop acc) tokens] ?^ nom=(get-name +<.tokens) @@ -718,11 +1268,11 @@ :: no argument =^ arg tokens [~ +>.tokens] - [[%call [%limb limbs] ~] tokens] - =? tokens ?=(%'((' ->.tokens) [[%punctuator %'('] +.tokens] + [[%call [0 0] [%limb limbs] ~] tokens] + =? tokens ?=(%'((' +.+.-.tokens) [[[0 0] [%punctuator %'(']] +.tokens] =^ arg tokens (match-pair-inner-jock tokens) - [[%call [%limb limbs] `arg] tokens] + [[%call [0 0] [%limb limbs] `arg] tokens] [[%limb limbs] tokens] :: ++ make-jlimb @@ -737,25 +1287,35 @@ |= =tokens ^- [jype (list token)] ?: =(~ tokens) ~|("expect expression starting with type. token: ~" !!) - ?: !=(%type -<.tokens) + ?: !=(%type -.+.-.tokens) ~|("expect type. token: {<-.tokens>}" !!) =/ type=cord - ?: =([%type 'List'] -.tokens) %list - ?: =([%type 'Set'] -.tokens) %set - :: ?: =([%type 'Map'] -.tokens) %map - ?> ?=([%type cord] -.tokens) - ->.tokens + :: Short-circuits on built-in container types + ?: =([%type 'List'] +.-.tokens) %list + ?: =([%type 'Set'] +.-.tokens) %set + ?: =([%type 'Map'] +.-.tokens) %map + ?: =([%type 'Stack'] +.-.tokens) %stack + ?> ?=([%type cord] +.-.tokens) + +.+.-.tokens =/ nom (get-name -.tokens) ?~ nom ~|("expect name. token: {<-.tokens>}" !!) - :: Short-circuit on built-in primitive types - ?: =('Atom' u.nom) [[%atom %number %.n]^u.nom +.tokens] - ?: =('Uint' u.nom) [[%atom %number %.n]^u.nom +.tokens] - ?: =('Uhex' u.nom) [[%atom %hexadecimal %.n]^u.nom +.tokens] - ?: =('String' u.nom) [[%atom %string %.n]^u.nom +.tokens] - ?: =('Loob' u.nom) [[%atom %loobean %.n]^u.nom +.tokens] + :: Short-circuits on built-in primitive types + ?: =('Atom' u.nom) [[%atom %number %.n]^u.nom +.tokens] + ?: =('Uint' u.nom) [[%atom %number %.n]^u.nom +.tokens] + ?: =('Int' u.nom) [[%atom %sint %.n]^u.nom +.tokens] + ?: =('Hex' u.nom) [[%atom %hex %.n]^u.nom +.tokens] + ?: =('Real' u.nom) [[%atom %real %.n]^u.nom +.tokens] + ?: =('Real16' u.nom) [[%atom %real16 %.n]^u.nom +.tokens] + ?: =('Real32' u.nom) [[%atom %real32 %.n]^u.nom +.tokens] + ?: =('Real128' u.nom) [[%atom %real128 %.n]^u.nom +.tokens] + ?: =('Logical' u.nom) [[%atom %logical %.n]^u.nom +.tokens] + ?: =('Date' u.nom) [[%atom %date %.n]^u.nom +.tokens] + ?: =('Span' u.nom) [[%atom %span %.n]^u.nom +.tokens] + ?: =('String' u.nom) [[%noun %string]^u.nom +.tokens] + ?: =('Path' u.nom) [[%noun %path]^u.nom +.tokens] :: =. tokens +.tokens - ?. =([%punctuator %'(('] -.tokens) + ?. =([%punctuator %'(('] +.-.tokens) :: XXX fix when finishing type TODO [`jype`[`jype-leaf`[%limb ~[[%type type]]] type] tokens] :: match type state @@ -765,13 +1325,20 @@ ?: (has-punctuator -.tokens %')') :: short-circuit if single element in cell [[jyp-one ~] tokens] + =? tokens (has-punctuator -.tokens %',') + +.tokens :: skip ',' =^ jyp-two tokens (match-jype tokens) :: TODO: support implicit right-association (what's a good test case?) [[jyp-one `jyp-two] tokens] [?~(q.r `jype`p.r `jype`[[p.r u.q.r] %$]) tokens] ?> (got-punctuator -.tokens %')') - ?: ?=(%list type) [[;;(jype-leaf [type jyp]) u.nom] +.tokens] - ?: ?=(%set type) [[;;(jype-leaf [type jyp]) u.nom] +.tokens] + ?: ?=(%list type) [[;;(jype-leaf [type jyp]) u.nom] +.tokens] + ?: ?=(%set type) [[;;(jype-leaf [type jyp]) u.nom] +.tokens] + ?: ?=(%stack type) [[;;(jype-leaf [type jyp]) u.nom] +.tokens] + :: Map requires two type parameters: Map(Key, Value) + ?: ?=(%map type) + ?> ?=(^ -<.jyp) :: must be a cell (two types) + [[[%map p.jyp q.jyp] u.nom] +.tokens] [[[%state jyp] u.nom] +.tokens] :: ++ match-keyword @@ -780,9 +1347,9 @@ ?: =(~ tokens) ~|("expect keyword. token: ~" !!) =^ first=token tokens [-.tokens +.tokens] - ?. ?=(%keyword -.first) - ~|("expect keyword. token: {<-.first>}" !!) - ?+ +.first !! + ?. ?=(%keyword -.+.first) + ~|("expect keyword. token: {<+.first>}" !!) + ?+ +.+.first !! %let =^ jype tokens (match-jype tokens) @@ -793,7 +1360,7 @@ =^ next tokens (match-jock +.tokens) :_ tokens - [%let jype val next] + [%let pos.first jype val next] :: :: func inc(n:@) -> @ { +(n) }; :: [%func name=jype body=jock next=jock] @@ -802,9 +1369,8 @@ (match-jype tokens) =^ inp tokens (match-block [tokens %'((' %')'] match-jype) - ?> (got-punctuator -.tokens %'-') - ?> (got-punctuator +<.tokens %'>') - =. tokens +>.tokens + ?> (got-punctuator -.tokens %'->') + =. tokens +.tokens =^ out tokens (match-jype tokens) =^ body tokens @@ -818,74 +1384,189 @@ =. body :- %lambda [[`inp out] body ~] - [[%func type body next] tokens] + [[%func pos.first type body next] tokens] :: :: lambda (b:@) -> @ {+(b)}(23); :: [%lambda p=lambda] %lambda =^ lambda tokens - (match-lambda [[%punctuator %'('] +.tokens]) + (match-lambda [[[0 0] [%punctuator %'(']] +.tokens]) ?: =(~ tokens) [[%lambda lambda] tokens] ?. (has-punctuator -.tokens %'(') [[%lambda lambda] tokens] =. tokens +.tokens ?: (has-punctuator -.tokens %')') - [[%call [%lambda lambda] ~] +.tokens] + [[%call pos.first [%lambda lambda] ~] +.tokens] =^ arg tokens - (match-pair-inner-jock [[%punctuator %'('] tokens]) + (match-pair-inner-jock [[[0 0] [%punctuator %'(']] tokens]) :: %')' consumed by +match-pair-inner-jock - [[%call [%lambda lambda] `arg] tokens] + [[%call pos.first [%lambda lambda] `arg] tokens] + :: + :: [%alias name=term target=term] + %alias + =/ name=cord + (got-name -.tokens) + =. tokens +.tokens + =/ target=cord + (got-name -.tokens) + =. tokens +.tokens + =- ~&(- -) + =/ ali=jock [%alias name target] + ?. &(!=(~ tokens) (has-punctuator -.tokens %';')) + [ali tokens] + =^ next tokens + (match-jock +.tokens) + [[%compose pos.first ali next] tokens] + :: + :: trait Arithmetic { add; neg; } + :: trait Add(+) { add; } + :: [%trait name=cord methods=(list term) op=(unit operator) unary=?] + %trait + =/ name=cord + ~| 'trait: expected trait name' + (got-type -.tokens) + =. tokens +.tokens + :: Optional operator mapping: trait Add(+) { ... } + :: Or unary: trait Neg(unary ⊖) { neg; } + =| op=(unit operator) + =| unary=? + =^ op-uni tokens + :: Check for (( which is what ( becomes after a type name + ?. (has-punctuator -.tokens %'((') [[~ %.n] tokens] + =. tokens +.tokens + :: Check for optional 'unary' keyword + =/ is-unary=? + ?: (has-keyword -.tokens %unary) %.y + %.n + =? tokens is-unary +.tokens + =/ tkn=token -.tokens + ?> ?=([%punctuator *] +.tkn) + ?> (~(has in operator-set) +.+.tkn) + =. tokens +.tokens + ?> (got-punctuator -.tokens %')') + =. tokens +.tokens + [[`;;(operator +.+.tkn) is-unary] tokens] + =. op -.op-uni + =. unary +.op-uni + ?> (got-punctuator -.tokens %'{') + =. tokens +.tokens + =| methods=(list term) + =^ methods tokens + |- + ?: (has-punctuator -.tokens %'}') + [(flop methods) +.tokens] + =/ method-name=term + (got-name -.tokens) + =. tokens +.tokens + ?> (got-punctuator -.tokens %';') + =. tokens +.tokens + $(methods [method-name methods]) + =/ trt=jock [%trait name methods op unary] + ?. &(!=(~ tokens) (has-punctuator -.tokens %';')) + [trt tokens] + =^ next tokens + (match-jock +.tokens) + [[%compose pos.first trt next] tokens] :: + :: struct Point { x: Real, y: Real }; + :: [%struct name=cord fields=(list [name=term type=jype])] + %struct + =/ name=cord + ~| 'struct: expected type name' + (got-type -.tokens) + =. tokens +.tokens + ?> (got-punctuator -.tokens %'{') + =. tokens +.tokens + =| fields=(list [name=term type=jype]) + =^ fields tokens + |- + ?: (has-punctuator -.tokens %'}') + [(flop fields) +.tokens] + =/ field-name=term + (got-name -.tokens) + =. tokens +.tokens + ?> (got-punctuator -.tokens %':') + =. tokens +.tokens + =^ field-type=jype tokens + (match-jype tokens) + =? tokens (has-punctuator -.tokens %',') + +.tokens + $(fields [[field-name field-type] fields]) + =/ str=jock [%struct name fields] + ?. &(!=(~ tokens) (has-punctuator -.tokens %';')) + [str tokens] + =^ next tokens + (match-jock +.tokens) + [[%compose pos.first str next] tokens] + :: + :: class Point(PointState) { getx(self: PointState) -> Real { self.x } } :: [%class state=jype arms=(map term jock)] %class - =^ state tokens - (match-jype tokens) - :: mask out reserved types - ?: =([%type 'List'] name.state) ~|('Shadowing reserved type List is not allowed.' !!) - ?: =([%type 'Set'] name.state) ~|('Shadowing reserved type Set is not allowed.' !!) - :: ?: =([%type 'Map'] name.state) ~|('Shadowing reserved type Map is not allowed.' !!) + :: Parse class name + =/ class-name=cord + ~| 'class: expected class name' + (got-type -.tokens) + =. tokens +.tokens + :: Parse state type in parens: ClassName(StateType) + =^ state-inner=jype tokens + (match-block [tokens %'((' %')'] match-jype) + :: Wrap state type as %state with class name + =/ state=jype [[%state state-inner] class-name] + :: Parse optional impl Trait1, Trait2 + =| traits=(list cord) + =^ traits tokens + ?. (has-keyword -.tokens %impl) + [~ tokens] + =. tokens +.tokens + =| acc=(list cord) + |- + =/ trait-name=cord + ~| 'class impl: expected trait name' + (got-type -.tokens) + =. tokens +.tokens + =. acc [trait-name acc] + ?. (has-punctuator -.tokens %',') + [(flop acc) tokens] + =. tokens +.tokens + $ + :: Parse method arms inside { } ?> (got-punctuator -.tokens %'{') - =| arms=(map term jock) =. tokens +.tokens + =| arms=(map term jock) =^ arms tokens |- ?: (has-punctuator -.tokens %'}') [arms +.tokens] - :: Retrieve the name of the method. - =^ type tokens - (match-jype tokens) - :: Gather the arguments and output type. - =^ inp tokens - ?> (got-punctuator -.tokens %'((') - =^ r=(pair jype (unit jype)) tokens - =^ jyp-one tokens (match-jype +.tokens) - ?: (has-punctuator -.tokens %')') - :: short-circuit if single element in cell - [[jyp-one ~] tokens] - =^ jyp-two tokens (match-jype tokens) - :: TODO: support implicit right-association (what's a good test case?) - [[jyp-one `jyp-two] tokens] - [?~(q.r `jype`p.r `jype`[[p.r u.q.r] %$]) tokens] - ?> (got-punctuator -.tokens %')') - =. tokens +.tokens - ?> (got-punctuator -.tokens %'-') - ?> (got-punctuator +<.tokens %'>') - =. tokens +>.tokens - =^ out tokens - (match-jype tokens) - =. type - :- [%core [%& [`inp out]] ~] - name.type - :: Retrieve the body of the method. - =^ body tokens - (match-block [tokens %'{' %'}'] match-jock) - =. body - :- %lambda - [[`inp out] body ~] - $(arms (~(put by arms) name.type [%method type body])) - :_ tokens - [%class state=state arms=arms] + :: Parse method name + =/ method-name=cord + ~| 'class: expected method name' + (got-name -.tokens) + =. tokens +.tokens + :: Parse method arguments: name(self: Type) or name(self: Type, p: Type) + :: Convert (( to ( so match-jype enters tuple parsing path for multi-arg + =. tokens [[[0 0] [%punctuator %'(']] +.tokens] + =^ inp=jype tokens + (match-jype tokens) + :: Parse return type: -> Type + ?> (got-punctuator -.tokens %'->') + =. tokens +.tokens + =^ out=jype tokens + (match-jype tokens) + =/ method-type=jype + [[%core [%& [`inp out]] ~] method-name] + :: Parse method body: { ... } + =^ body=jock tokens + (match-block [tokens %'{' %'}'] (curr match-jock-body %'}')) + =/ method-body=jock + [%lambda [`inp out] body ~] + $(arms (~(put by arms) method-name [%method method-type method-body])) + =/ cls=jock [%class state=state arms=arms traits=traits] + ?. &(!=(~ tokens) (has-punctuator -.tokens %';')) + [cls tokens] + =^ next tokens + (match-jock +.tokens) + [[%compose pos.first cls next] tokens] :: :: if (a < b) { +(a) } else { +(b) } :: [%if cond=jock then=jock after-if=after-if-expression] @@ -896,7 +1577,7 @@ (match-block [tokens %'{' %'}'] match-jock) =^ after-if tokens (match-after-if-expression tokens) - [[%if cond then after-if] tokens] + [[%if pos.first cond then after-if] tokens] :: %assert =^ cond tokens @@ -947,10 +1628,10 @@ =^ q tokens (match-jock +.tokens) :_ tokens - [%compose p q] + [%compose pos.first p q] :: - %match :: [%match value=jock cases=(map jock jock) default=(unit jock)] + %match =^ value tokens (match-inner-jock tokens) =^ pairs tokens @@ -958,31 +1639,31 @@ :_ tokens [%match value -.pairs +.pairs] :: + :: [%switch value=jock cases=(map jock jock) default=(unit jock)] %switch - :: [%cases value=jock cases=(map jock jock) default=(unit jock)] =^ value tokens (match-inner-jock tokens) =^ pairs tokens (match-block [tokens %'{' %'}'] match-match) :_ tokens - [%cases value -.pairs +.pairs] + [%switch value -.pairs +.pairs] :: ?(%loop %defer) ?> (got-punctuator -.tokens %';') =^ jock tokens (match-jock +.tokens) :_ tokens - ?:(?=(%loop +.first) [+.first jock] [+.first jock]) + ?:(?=(%loop +.+.first) [+.+.first jock] [+.+.first jock]) :: recur = $ %recur ?. (has-punctuator -.tokens %'(') - [[%call [%limb [%axis 0] ~] ~] tokens] + [[%call pos.first [%limb [%axis 0] ~] ~] tokens] ?: (has-punctuator -.+.tokens %')') - [[%call [%limb [%axis 0] ~] ~] +>.tokens] + [[%call pos.first [%limb [%axis 0] ~] ~] +>.tokens] =^ arg tokens (match-inner-jock +.tokens) ?> (got-punctuator -.tokens %')') - [[%call [%limb [%axis %0] ~] `arg] +.tokens] + [[%call pos.first [%limb [%axis %0] ~] `arg] +.tokens] :: %this [[%limb [%axis 1] ~] tokens] @@ -996,23 +1677,33 @@ [%eval p q] :: %import - ?> ?=(%name -<.tokens) - =/ nom=term ->.tokens - =/ src=jock [%limb ~[-.tokens]] + ?> ?=(%name -.+.-.tokens) + =/ nom=term +.+.-.tokens + =/ src=jock [%limb ~[+.-.tokens]] =/ tokens +.tokens =/ past (rush (~(got by libs) nom) (ifix [gay gay] tall:(vang | /))) - ?~ past ~|("unable to parse Hoon library: {<[+<+.src]>}" !!) + ?~ past + :: Not Hoon — try parsing as Jock library + =/ lib-cord (~(got by libs) nom) + =/ lib-tokens (rash lib-cord parse-tokens) + =^ lib-jock lib-tokens + (match-jock lib-tokens) + ?> (got-punctuator -.tokens %';') + =^ next tokens + (match-jock +.tokens) + :_ tokens + (splice-jock lib-jock next) =/ p (~(mint ut %noun) %noun u.past) =? nom (has-keyword -.tokens %as) - ?> =(%name +<-.tokens) - ;;(term +<+.tokens) + ?> =(%name -.+.+<.tokens) + ;;(term +.+.+<.tokens) =? tokens (has-keyword -.tokens %as) +>.tokens ?> ~| 'expected terminator ; after import' (got-punctuator -.tokens %';') =^ q tokens (match-jock +.tokens) :_ tokens - [%import [[%hoon [p.p .*(0 q.p)]] nom] q] + [%import pos.first [[%hoon [p.p .*(0 q.p)]] nom] q] :: :: [%print body=?([%jock jock]) next=jock] %print @@ -1022,7 +1713,7 @@ =^ next tokens (match-jock +.tokens) :_ tokens - [%print [%jock body] next] + [%print pos.first [%jock body] next] :: %crash [[%crash ~] tokens] @@ -1035,13 +1726,29 @@ ^- [jype (list token)] ?: =(~ tokens) ~|("expect jype. token: ~" !!) + :: Option type ?T + ?: &(!=(~ tokens) (has-punctuator -.tokens %'?')) + ?. ?| &(!=(~ +.tokens) ?=(%type -.+.-.+.tokens)) + &(!=(~ +.tokens) (has-punctuator +<.tokens %'?')) + &(!=(~ +.tokens) (has-punctuator +<.tokens %'*')) + &(!=(~ +.tokens) (has-punctuator +<.tokens %'(')) + == + :: Bare ? — fall through to boolean type + =^ jyp-leaf tokens + (match-jype-leaf tokens) + [[jyp-leaf %$] tokens] + =/ rest=(list token) +.tokens :: skip '?' + =^ inner-jype rest + (match-jype rest) + :_ rest + [[%fork [%none ~]^%$ inner-jype] %$] :: Store name and strip it from token list =/ has-name ?=(^ (get-name -.tokens)) =/ nom (fall (get-name -.tokens) %$) =? tokens has-name +.tokens :: Type-qualified name b:a - ?: &(has-name (has-punctuator -.tokens %':')) - ?: =(%type +<-.tokens) + ?: &(has-name !=(~ tokens) (has-punctuator -.tokens %':')) + ?: =(%type -.+.+<.tokens) =^ jyp tokens (match-metatype `(list token)`+.tokens) [jyp(name nom) tokens] @@ -1049,7 +1756,7 @@ (match-jype +.tokens) [jyp(name nom) tokens] :: Tuple cell (a b) - ?: (has-punctuator -.tokens %'(') + ?: &(!=(~ tokens) (has-punctuator -.tokens %'(')) =^ r=(pair jype (unit jype)) tokens %+ match-block [tokens %'(' %')'] |= =^tokens @@ -1057,6 +1764,8 @@ ?: (has-punctuator -.tokens %')') :: short-circuit if single element in cell [[jyp-one ~] tokens] + =? tokens (has-punctuator -.tokens %',') + +.tokens =^ jyp-two tokens (match-jype tokens) :: TODO: support implicit right-association (what's a good test case?) [[jyp-one `jyp-two] tokens] @@ -1064,7 +1773,7 @@ :: If this is a class or type declaration, match it. ?: &(!=(%$ nom) (is-type nom)) =^ jyp tokens - (match-metatype `(list token)`[[%type nom] tokens]) + (match-metatype `(list token)`[[[0 0] [%type nom]] tokens]) [jyp tokens] :: Otherwise, match the leaf into the jype and return it with name. =^ jyp-leaf tokens @@ -1084,7 +1793,7 @@ [[%atom %number %.n] +.tokens] :: Match on loobean type a:? ?: (has-punctuator -.tokens %'?') - [[%atom %loobean %.n] +.tokens] + [[%atom %logical %.n] +.tokens] :: Match on noun type a:* ?: (has-punctuator -.tokens %'*') [[%none ~] +.tokens] @@ -1129,10 +1838,9 @@ ^- [lambda-argument (list token)] =^ inp tokens (match-block [tokens %'(' %')'] match-jype) - ?> (got-punctuator -.tokens %'-') - ?> (got-punctuator +<.tokens %'>') + ?> (got-punctuator -.tokens %'->') =^ out tokens - (match-jype +>.tokens) + (match-jype +.tokens) [[`inp out] tokens] :: ++ match-comparator @@ -1143,18 +1851,18 @@ ++ comp (perk %'<' %'>' %'=' %'!' ~) -- ?: =(~ tokens) ~|("expect comparator. token: ~" !!) - ?. ?=(%punctuator -<.tokens) - ~|("expect punctuator. token: {<-<.tokens>}" !!) + ?. ?=(%punctuator -.+.-.tokens) + ~|("expect punctuator. token: {<-.+.-.tokens>}" !!) =/ cm1=(unit mini) - (rust (trip ->.tokens) (full comp)) + (rust (trip +.+.-.tokens) (full comp)) ?~ cm1 ~|("match-comparator failed: {<-.tokens>}" !!) ?: =(~ +.tokens) [;;(comparator u.cm1) +.tokens] - ?. ?=(%punctuator +<-.tokens) + ?. ?=(%punctuator -.+.+<.tokens) [;;(comparator u.cm1) +.tokens] =/ cm2=(unit mini) - (rust (trip +<+.tokens) (full comp)) + (rust (trip +.+.+<.tokens) (full comp)) ?~ cm2 [;;(comparator u.cm1) +.tokens] =/ final (cat 3 u.cm1 u.cm2) @@ -1168,18 +1876,18 @@ ++ comp (perk %'+' %'-' %'*' %'/' %'%' %'**' ~) -- ?: =(~ tokens) ~|("expect operator. token: ~" !!) - ?. ?=(%punctuator -<.tokens) - ~|("expect punctuator. token: {<-<.tokens>}" !!) + ?. ?=(%punctuator -.+.-.tokens) + ~|("expect punctuator. token: {<-.+.-.tokens>}" !!) =/ cm1=(unit mini) - (rust (trip ->.tokens) (full comp)) + (rust (trip +.+.-.tokens) (full comp)) ?~ cm1 ~|("match-operator failed: {<-.tokens>}" !!) ?: =(~ +.tokens) [;;(operator u.cm1) +.tokens] - ?. ?=(%punctuator +<-.tokens) + ?. ?=(%punctuator -.+.+<.tokens) [;;(operator u.cm1) +.tokens] =/ cm2=(unit mini) - (rust (trip +<+.tokens) (full comp)) + (rust (trip +.+.+<.tokens) (full comp)) ?~ cm2 [;;(operator u.cm1) +.tokens] =/ final (cat 3 u.cm1 u.cm2) @@ -1190,10 +1898,10 @@ ^- (pair after-if-expression (list token)) ?: =(~ tokens) ~|("expect after-if. token: ~" !!) - ?. ?=(%keyword -<.tokens) - ~|("expect keyword. token: {<-<.tokens>}" !!) - ?. =(%else ->.tokens) - ~|("expect %else. token: {<->.tokens>}" !!) + ?. ?=(%keyword -.+.-.tokens) + ~|("expect keyword. token: {<-.+.-.tokens>}" !!) + ?. =(%else +.+.-.tokens) + ~|("expect %else. token: {<+.+.-.tokens>}" !!) => .(tokens `(list token)`+.tokens) :: TMI ?: =(~ tokens) ~|("expect more. tokens: ~" !!) @@ -1202,7 +1910,7 @@ (match-block [tokens %'{' %'}'] match-jock) [[%else else] tokens] ?. (has-keyword -.tokens %if) - ~|("expect %if. token: {<->.tokens>}" !!) + ~|("expect %if. token: {<+.+.-.tokens>}" !!) (match-else-if +.tokens) :: ++ match-else-if @@ -1218,18 +1926,20 @@ :: ++ match-literal |= =tokens - ^- [[%atom jatom] (list token)] + ^- [?([%atom jatom] [%noun jnoun]) (list token)] ?: =(~ tokens) ~|("expect literal. token: ~" !!) - ?. ?=(%literal -<.tokens) - ~|("expect literal. token: {<-<.tokens>}" !!) - [[%atom ->.tokens] +.tokens] + ?. ?=(%literal -.+.-.tokens) + ~|("expect literal. token: {<-.+.-.tokens>}" !!) + ?: ?=(%noun -.+.+.-.tokens) + [[%noun +.+.+.-.tokens] +.tokens] + [[%atom +.+.+.-.tokens] +.tokens] :: ++ match-name |= =tokens ^- [[%limb (list jlimb)] (list token)] - ?. ?=(%name -<.tokens) - ~|("expect name. token: {<-<.tokens>}" !!) - [[%limb [%name -<.tokens]~] +.tokens] + ?. ?=(%name -.+.-.tokens) + ~|("expect name. token: {<-.+.-.tokens>}" !!) + [[%limb [%name +.+.-.tokens]~] +.tokens] :: ++ match-block |* [[=tokens start=jpunc end=jpunc] gate=$-(tokens [* tokens])] @@ -1252,19 +1962,34 @@ :: default case, must be last ?: (has-punctuator -.tokens %'_') :: TODO later put these as operators in regular operator handling code - ?> (got-punctuator +<.tokens %'-') - ?> (got-punctuator +>-.tokens %'>') - =^ jock tokens `[jock (list token)]`(match-jock `(list token)`+>+.tokens) + ?> (got-punctuator +<.tokens %'->') + =^ jock tokens `[jock (list token)]`(match-jock `(list token)`+>.tokens) ?> (got-punctuator -.tokens %';') =. tokens +.tokens ?> (got-punctuator -.tokens %'}') :: no trailing tokens in case block =. fall `jock [[(malt duo) fall] tokens] + :: null case: ~ -> expr; + ?: &(!=(~ tokens) (has-punctuator -.tokens %'~')) + ?> (got-punctuator +<.tokens %'->') + =^ jock tokens `[jock (list token)]`(match-jock `(list token)`+>.tokens) + ?> (got-punctuator -.tokens %';') + =. tokens +.tokens + $(duo [[[%atom [%number 0] %.y] jock] duo]) + :: + :: name binding case: name -> expr; + ?: &(!=(~ tokens) ?=(%name -.+.-.tokens) !=(~ +.tokens) (has-punctuator +<.tokens %'->')) + =/ bind-name=term +.+.-.tokens + => .(tokens `(list token)`tokens) :: TMI + ?> (got-punctuator +<.tokens %'->') + =^ jock tokens `[jock (list token)]`(match-jock `(list token)`+>.tokens) + ?> (got-punctuator -.tokens %';') + =. tokens +.tokens + $(duo [[[%bind bind-name] jock] duo]) :: regular case =^ jock-1 tokens (match-jock tokens) - ?> (got-punctuator -.tokens %'-') - ?> (got-punctuator +<.tokens %'>') - =^ jock-2 tokens (match-jock +>.tokens) + ?> (got-punctuator -.tokens %'->') + =^ jock-2 tokens (match-jock +.tokens) ?> (got-punctuator -.tokens %';') =. tokens +.tokens $(duo [[jock-1 jock-2] duo]) @@ -1276,26 +2001,35 @@ |= =tokens ^- @ ?: =(~ tokens) ~|("expect literal. token: ~" !!) - ?. ?=(%literal -<.tokens) - ~|("expect literal or symbol. token: {<-<.tokens>}" !!) - =/ p=jatom ->.tokens + ?. ?=(%literal -.+.-.tokens) + ~|("expect literal or symbol. token: {<-.+.-.tokens>}" !!) + ?. ?=(%atom -.+.+.-.tokens) + ~|("expect literal or symbol. token: {<-.tokens>}" !!) + =/ p=jatom +.+.+.-.tokens ?. ?=(%number -<.p) ~|("expect number or symbol. token: {<-.p>}" !!) ->.p :: +++ got-type + |= =token + ^- cord + ?. ?=(%type -.+.token) + ~|("expect type name (starting with uppercase). token: {<+.token>}" !!) + ;;(cord +.+.token) +:: ++ got-name |= =token ^- cord - ?. |(?=(%name -.token) ?=(%type -.token)) - ~|("expect name. token: {<-.token>}" !!) - ;;(cord +.token) + ?. |(?=(%name -.+.token) ?=(%type -.+.token)) + ~|("expect name. token: {<+.token>}" !!) + ;;(cord +.+.token) :: ++ get-name |= =token ^- (unit cord) - ?. |(?=(%name -.token) ?=(%type -.token)) ~ - ?: ?=(%name -.token) [~ +.token] - ?> ?=(%type -.token) [~ +.token] + ?. |(?=(%name -.+.token) ?=(%type -.+.token)) ~ + ?: ?=(%name -.+.token) [~ +.+.token] + ?> ?=(%type -.+.token) [~ +.+.token] :: :: like +sane but for snake case :: !((sane %tas) name) @@ -1317,39 +2051,29 @@ ++ got-punctuator |= [=token punc=jpunc] ^- ? - ?. ?=(%punctuator -.token) - ~|("expect punctuator. token: {<-.token>}" !!) - ?. =(+.token punc) - ~|("expect punctuator {<+.token>} to be {}" !!) - %.y -:: -++ got-type - |= [=token type=cord] - ^- ? - ?: =(~ tokens) ~|("expect type. token: ~" !!) - ?. ?=(%type -<.tokens) - ~|("expect type. token: {}" !!) - ?. =(+.token type) - ~|("expect type {<+.token>} to be {}" !!) + ?. ?=(%punctuator -.+.token) + ~|("expect punctuator. token: {<+.token>}" !!) + ?. =(+.+.token punc) + ~|("expect punctuator {<+.+.token>} to be {}" !!) %.y :: ++ has-punctuator |= [=token punc=jpunc] ^- ? - ?. ?=(%punctuator -.token) %.n - =(+.token punc) + ?. ?=(%punctuator -.+.token) %.n + =(+.+.token punc) :: ++ has-keyword |= [=token key=keyword] ^- ? - ?. ?=(%keyword -.token) %.n - =(+.token key) + ?. ?=(%keyword -.+.token) %.n + =(+.+.token key) :: ++ has-type |= [=tokens type=cord] ^- ? - ?. ?=(%type -<.tokens) %.n - =(+.tokens cord) + ?. ?=(%type -.+.-.tokens) %.n + =(+.+.-.tokens cord) :: detect both comparators and operators ++ any-operator |= =tokens @@ -1373,6 +2097,38 @@ [`%'-' +.tokens] ?: (has-punctuator -.tokens %'*') [`%'*' +.tokens] + ?: (has-punctuator -.tokens %'×') + [`%'×' +.tokens] + ?: (has-punctuator -.tokens %'÷') + [`%'÷' +.tokens] + ?: (has-punctuator -.tokens %'±') + [`%'±' +.tokens] + ?: (has-punctuator -.tokens %'⊕') + [`%'⊕' +.tokens] + ?: (has-punctuator -.tokens %'⊗') + [`%'⊗' +.tokens] + ?: (has-punctuator -.tokens %'⊖') + [`%'⊖' +.tokens] + ?: (has-punctuator -.tokens %'∘') + [`%'∘' +.tokens] + ?: (has-punctuator -.tokens %'·') + [`%'·' +.tokens] + ?: (has-punctuator -.tokens %'∩') + [`%'∩' +.tokens] + ?: (has-punctuator -.tokens %'∪') + [`%'∪' +.tokens] + ?: (has-punctuator -.tokens %'∈') + [`%'∈' +.tokens] + ?: (has-punctuator -.tokens %'⊂') + [`%'⊂' +.tokens] + ?: (has-punctuator -.tokens %'⊃') + [`%'⊃' +.tokens] + ?: (has-punctuator -.tokens %'^') + [`%'^' +.tokens] + ?: (has-punctuator -.tokens %'|') + [`%'|' +.tokens] + ?: (has-punctuator -.tokens %'\\') + [`%'\\' +.tokens] ?: (has-punctuator -.tokens %'/') [`%'/' +.tokens] ?: (has-punctuator -.tokens %'%') @@ -1519,6 +2275,8 @@ ?~ axi-lis `jyp(name %$) ?@ -<.jyp + ?: ?=(%struct -.p.jyp) + $(jyp (struct-to-jype fields.p.jyp)) ?: =(~ t.axi-lis) `jyp ?. ?=(%core -.p.jyp) ~| jyp @@ -1539,6 +2297,8 @@ `+.axi `axi ?@ -<.jyp + ?: ?=(%struct -.p.jyp) + $(jyp (struct-to-jype fields.p.jyp)) ?. ?=(%core -.p.jyp) ~ ?: ?=(%& -.p.p.jyp) @@ -1565,6 +2325,15 @@ $(jyp q.jyp, -.axi +((mul -.axi 2))) r l + :: + :: Expand struct fields into a virtual cell jype for axis resolution. + ++ struct-to-jype + |= flds=(list [name=term type=jype]) + ^- jype + ?~ flds [[%none ~] %$] + =/ this=jype type.i.flds(name name.i.flds) + ?~ t.flds this + [[this $(flds t.flds)] %$] -- :: ++ find-buc @@ -1592,8 +2361,9 @@ ?: ?=(%& -.p) ~| %call-lambda =/ out-type - :: TODO: need to put the return type here, with all names stripped - out.p.p + :: Strip name from return type to prevent scope pollution + :: when axis-at-name searches through core expansions. + out.p.p(name %$) ?~ inp.p.p ?~ q [out-type untyped-j]^%$ @@ -1655,16 +2425,173 @@ ++ cj |_ jyp=jype :: + ++ wrap-spot + |= [pos=hair nok=nock] + ^- nock + ?. dbg nok + :+ %11 + [%spot [%1 /jock] [%1 [pos [+(p.pos) 0]]]] + nok + :: ++ mint |= j=jock ^- [nock jype] - ?- -.j + ?- -.j ::~|("cj: unimplemented jock: {<-.j>}" !!) ^ ~| %pair-p =+ [p p-jyp]=$(j p.j) ~| %pair-q =+ [q q-jyp]=$(j q.j) [[p q] (~(cons jt p-jyp) q-jyp)] + :: + %index + :: First, compile the expression to determine its type. + =+ [expr-nock expr-jyp]=$(j expr.j) + :: Reject fork types. + ?: ?& ?=(@ -<.expr-jyp) + ?=(%fork -.p.expr-jyp) + == + ~|("cannot index into a union type; use match first" !!) + :: List: generate hoon.snag call nock directly. + ?: ?& ?=(@ -<.expr-jyp) + ?=(%list -.p.expr-jyp) + == + :: Look up hoon library in jype context + =/ lim (~(get-limb jt jyp) ~[[%name %hoon]]) + ?~ lim ~|('hoon library not found' !!) + ?> ?=(%| -.u.lim) + =/ typ=jype p.p.u.lim + =/ ljw=(list jwing) r.p.u.lim + :: Build Hoon AST for snag and validate + =+ ast=(j2h ~[[%name %snag]] ~) + ?> ?=(%hoon -<.typ) + =/ min (~(mint ut -.p.p.-.typ) %noun ast) + =/ pjyp (type2jype p.min) + =/ qmin + ~| 'failed to validate snag Nock' + ;;(nock q.min) + :: Compile the index separately, reuse already-compiled expr-nock + =+ [idx-nok idx-jyp]=$(j idx.j) + :_ pjyp + ;; nock + :+ %8 + :^ %9 +<+<.qmin %0 -.ljw + [%9 2 %10 [6 [%7 [%0 3] [idx-nok expr-nock]]] %0 2] + :: Map: generate hoon.map-get call nock directly. + ?: ?& ?=(@ -<.expr-jyp) + ?=(%map -.p.expr-jyp) + == + =/ lim (~(get-limb jt jyp) ~[[%name %hoon]]) + ?~ lim ~|('hoon library not found' !!) + ?> ?=(%| -.u.lim) + =/ typ=jype p.p.u.lim + =/ ljw=(list jwing) r.p.u.lim + =+ ast=(j2h ~[[%name %map-get]] ~) + ?> ?=(%hoon -<.typ) + =/ min (~(mint ut -.p.p.-.typ) %noun ast) + =/ qmin + ~| 'failed to validate map-get Nock' + ;;(nock q.min) + =+ [idx-nok idx-jyp]=$(j idx.j) + :_ [[%fork [%none ~]^%$ val.p.expr-jyp] %$] + ;; nock + :+ %8 + :^ %9 +<+<.qmin %0 -.ljw + [%9 2 %10 [6 [%7 [%0 3] [idx-nok expr-nock]]] %0 2] + :: Set: generate hoon.set-get call nock directly. + ?: ?& ?=(@ -<.expr-jyp) + ?=(%set -.p.expr-jyp) + == + =/ lim (~(get-limb jt jyp) ~[[%name %hoon]]) + ?~ lim ~|('hoon library not found' !!) + ?> ?=(%| -.u.lim) + =/ typ=jype p.p.u.lim + =/ ljw=(list jwing) r.p.u.lim + =+ ast=(j2h ~[[%name %set-get]] ~) + ?> ?=(%hoon -<.typ) + =/ min (~(mint ut -.p.p.-.typ) %noun ast) + =/ qmin + ~| 'failed to validate set-get Nock' + ;;(nock q.min) + =+ [idx-nok idx-jyp]=$(j idx.j) + :_ [[%fork [%none ~]^%$ type.p.expr-jyp] %$] + ;; nock + :+ %8 + :^ %9 +<+<.qmin %0 -.ljw + [%9 2 %10 [6 [%7 [%0 3] [idx-nok expr-nock]]] %0 2] + :: String/Chars: byte at index via cut 3 [i 1] s + ?: ?& ?=(@ -<.expr-jyp) + ?| ?&(?=(%noun -.p.expr-jyp) ?=(%string p.p.expr-jyp)) + ?&(?=(%atom -.p.expr-jyp) ?=(%chars p.p.expr-jyp)) + == + == + =+ [idx-nok idx-jyp]=$(j idx.j) + :_ expr-jyp + (make-hoon-binop %cut [%1 3] [[idx-nok [%1 1]] expr-nock]) + :: Tuple (cell jype): compute axis at compile time. + :: Index must be a literal number. + =/ n=@ (get-index-number idx.j) + =/ [ax=@ res-jyp=jype] (tuple-axis n expr-jyp) + :_ res-jyp + [%7 expr-nock [%0 ax]] + :: + %cast + :: Compile the source expression + =+ [val val-jyp]=$(j expr.j) + :: Resolve target type (may be a %limb reference to a struct/alias) + =/ tgt=jype target.j + =. tgt + ?. &(?=(@ -<.tgt) ?=(%limb -.p.tgt)) tgt + =/ lim (~(get-limb jt jyp) p.p.tgt) + ?~ lim ~|("cast target type not found" !!) + ?> ?=(%& -.u.lim) + p.p.u.lim + ?- mode.j + :: + %as + :: Compile-time structural check only. No runtime nock. + :: Unwrap structs to cell shape for structural comparison. + =/ flat-val=jype + ?. &(?=(@ -<.val-jyp) ?=(%struct -.p.val-jyp)) val-jyp + (struct-to-cell-jype fields.p.val-jyp) + =/ flat-tgt=jype + ?. &(?=(@ -<.tgt) ?=(%struct -.p.tgt)) tgt + (struct-to-cell-jype fields.p.tgt) + ?~ (~(unify jt flat-tgt) flat-val) + ~| 'as: types are not structurally compatible' + ~| "have: {}\0aneed: {}" + !! + [val tgt] + :: + %as-x + :: Runtime mold check, crash on failure. + :: Push val onto subject (axis 2), run hunt-type check, + :: if match (0): return val, if fail (1): crash. + =/ chk=nock (hunt-type tgt) + [[%8 val [%6 chk [%0 2] [%0 0]]] tgt] + :: + %as-q + :: Runtime mold check, return ?T (option). + :: If match: [~ val] = [0 val]. If fail: ~ = 0. + =/ chk=nock (hunt-type tgt) + :- [%8 val [%6 chk [[%1 0] [%0 2]] [%1 0]]] + [[%fork [%none ~]^%$ tgt] %$] + == + :: + %coalesce + =+ [val val-jyp]=$(j expr.j) + :: Verify expr has option type (?T = fork of none and T) + :: val-jyp = [[%fork p=none-jyp q=inner-jyp] name] + ?> &(?=(@ -<.val-jyp) ?=(%fork -.p.val-jyp)) + ?> ?=(%none -.-.p.p.val-jyp) + =/ inner-jyp=jype q.p.val-jyp + =+ [fb fb-jyp]=$(j fallback.j) + :: Runtime nock: + :: [%8 val ...] — push compiled val as axis 2 + :: val at axis 2. If val=0 (null): return fallback. Else: return tail of val (axis 5). + :: [%7 [%0 3] fb] = restore original subject, then evaluate fb. + :- [%8 val [%6 [%5 [%1 0] [%0 2]] [%7 [%0 3] fb] [%0 5]]] + inner-jyp :: %let ~| %let-value @@ -1689,10 +2616,10 @@ =/ lyp=jype p.p.u.lim =/ ljw=(list jwing) q.p.u.lim `[[%limb ~[[%type name.val-jyp]]] name.type.j] - ?: (is-type name.val-jyp) + ?: &((is-type name.val-jyp) !?=(%struct -<.val-jyp)) :: case 4, let name = Type(value); :: [p=[%limb p=~[[%type p='Foo']]] name='name'] - :: pass rval as Type after nesting check + :: pass rval as Type after nesting check (not for structs) ~| %nesting-without-specified-lval-type ^- (unit jype) `[[%limb ~[[%type name.val-jyp]]] name.type.j] @@ -1708,7 +2635,7 @@ (~(cons jt u.inferred-type) jyp) ~| %let-next =+ [nex nex-jyp]=$(j next.j) - [[%8 val nex] nex-jyp] + [^-(nock (wrap-spot pos.j [%8 val nex])) nex-jyp] :: %func =+ [val val-jyp]=$(j body.j) @@ -1719,10 +2646,12 @@ ~| '%func: value type does not nest in declared type' ~| ['have:' val-jyp 'need:' type.j] !! - (~(cons jt u.inferred-type) jyp) + :: Use the resolved type (val-jyp) with declared name, + :: so %limb references are resolved before storing in subject. + (~(cons jt val-jyp(name name.type.j)) jyp) ~| %func-next =+ [nex nex-jyp]=$(j next.j) - [[%8 val nex] nex-jyp] + [^-(nock (wrap-spot pos.j [%8 val nex])) nex-jyp] :: %method =+ [val val-jyp]=$(j body.j) @@ -1733,18 +2662,175 @@ ~| ['have:' val-jyp 'need:' type.j] !! [val val-jyp] + :: + %alias + :: Look up the type being aliased in the current subject. + :: Resolve target type at definition time, then create a + :: new entry with the alias name pointing to the same type. + ~| %alias + :: First try built-in types, then fall back to subject lookup. + =/ target-jyp=jype + ?: =('Atom' target.j) [%atom %number %.n]^target.j + ?: =('Uint' target.j) [%atom %number %.n]^target.j + ?: =('Int' target.j) [%atom %sint %.n]^target.j + ?: =('Hex' target.j) [%atom %hex %.n]^target.j + ?: =('Real' target.j) [%atom %real %.n]^target.j + ?: =('Real16' target.j) [%atom %real16 %.n]^target.j + ?: =('Real32' target.j) [%atom %real32 %.n]^target.j + ?: =('Real128' target.j) [%atom %real128 %.n]^target.j + ?: =('Logical' target.j) [%atom %logical %.n]^target.j + ?: =('Date' target.j) [%atom %date %.n]^target.j + ?: =('Span' target.j) [%atom %span %.n]^target.j + ?: =('String' target.j) [%noun %string]^target.j + ?: =('Path' target.j) [%noun %path]^target.j + :: Not a built-in; look up in subject + =/ lim (~(get-limb jt jyp) ~[[%type target.j]]) + ?~ lim ~|('alias target not found: {}' !!) + ?> ?=(%& -.u.lim) + p.p.u.lim + :: Create alias jype: same type structure but with alias name + =/ alias-jyp=jype target-jyp(name name.j) + =/ val=nock (type-to-default target-jyp) + :: Push alias onto subject (like struct) so previous definitions + :: remain accessible in subsequent compose expressions. + [[%8 val [%0 1]] (~(cons jt alias-jyp) jyp)] + :: + %trait + =/ trait-jyp=jype [[%trait name.j methods.j op.j unary.j] name.j] + [[%8 [%1 0] [%0 1]] (~(cons jt trait-jyp) jyp)] + :: + %struct + ~| %struct + :: Resolve %limb references in field types eagerly + :: so nested struct field access works. + =/ resolved-fields=(list [name=term type=jype]) + =| acc=(list [name=term type=jype]) + =/ flds fields.j + |- + ?~ flds (flop acc) + =/ ftyp=jype type.i.flds + =. ftyp + ?. ?&(?=(@ -<.ftyp) ?=(%limb -.p.ftyp)) + ftyp + =/ lim (~(get-limb jt jyp) p.p.ftyp) + ?~ lim ftyp + ?> ?=(%& -.u.lim) + p.p.u.lim(name name.ftyp) + $(flds t.flds, acc [[name.i.flds ftyp] acc]) + =/ struct-jyp=jype [[%struct name.j resolved-fields] name.j] + =/ val=nock (type-to-default struct-jyp) + :: Push struct bunt onto subject (Nock 8) rather than replacing it, + :: so previous type definitions remain accessible for nested structs. + [[%8 val [%0 1]] (~(cons jt struct-jyp) jyp)] + :: + %struct-literal + ~| %struct-literal + =/ lim (~(get-limb jt jyp) ~[[%type name.j]]) + ?~ lim ~|('struct not found' !!) + ?> ?=(%& -.u.lim) + =/ styp=jype p.p.u.lim + :: If the name resolves to a class (cell jype-leaf, not atom tag), + :: extract the struct from the %state wrapper inside the class type. + =. styp + ?: ?=(@ -<.styp) + ?. ?=(%core -.p.styp) styp + :: Class core: extract struct from core context + =/ sta=jype (need q.p.styp) + ?> ?=(@ -<.sta) + ?> ?=(%state -.p.sta) + p.p.sta + :: Cell jype (legacy path) + ?> ?=(%state -<-<.styp) + -<->.styp + ?> ?=(@ -<.styp) + ?> ?=(%struct -.p.styp) + =/ flds=(list [name=term type=jype]) fields.p.styp + =/ struct-jyp=jype [[%struct name.j flds] name.j] + :: compile field values in definition order + =/ noks=(list nock) + =| acc=(list nock) + |- + ?~ flds (flop acc) + =/ hit=(unit jock) (~(get by vals.j) name.i.flds) + =/ nok=nock + ?~ hit (type-to-default type.i.flds) + -:^$(j u.hit) + $(flds t.flds, acc [nok acc]) + ?~ noks [[%1 0] struct-jyp] + :- + |- + ?~ t.noks i.noks + [i.noks $(noks t.noks)] + struct-jyp :: %class ~| %class + ?> ?=(%state -<.state.j) + :: Resolve %limb reference in state type eagerly + :: so struct fields are accessible in method bodies. + =/ resolved-state=jype + =/ inner=jype p.p.state.j + ?. ?&(?=(@ -<.inner) ?=(%limb -.p.inner)) + inner + =/ lim (~(get-limb jt jyp) p.p.inner) + ?~ lim inner + ?> ?=(%& -.u.lim) + p.p.u.lim(name name.inner) + =. state.j [[%state resolved-state] name.state.j] + :: Validate trait conformance: all trait methods must exist in class + =. traits.j + =/ tnames=(list cord) traits.j + |- + ?~ tnames traits.j + =/ tname=cord i.tnames + =/ tlim (~(get-limb jt jyp) ~[[%type tname]]) + ?~ tlim ~|('class impl: trait not found: {}' !!) + ?> ?=(%& -.u.tlim) + =/ ttyp=jype p.p.u.tlim + ?> ?=(@ -<.ttyp) + ?. ?=(%trait -.p.ttyp) + ~|('class impl: {} is not a trait' !!) + =/ required=(list term) methods.p.ttyp + |- + ?~ required + ^$(tnames t.tnames) + ?. (~(has by arms.j) i.required) + ~|('class impl: missing method {} required by trait {}' !!) + $(required t.required) + :: Eagerly resolve %limb references in method argument types + :: so type-to-default can compute defaults without limb lookups. + =. arms.j + =/ resolve-one + |= j=jype + ^- jype + ?. ?=(@ -<.j) + =/ sub-a=jype $(j p.j) + =/ sub-b=jype $(j q.j) + [[sub-a sub-b] name.j] + ?. ?=(%limb -.p.j) j + :: Self resolves to the class state type + ?: =(~[[%type 'Self']] p.p.j) + resolved-state(name name.j) + =/ lim (~(get-limb jt jyp) p.p.j) + ?~ lim j + ?. ?=(%& -.u.lim) j + p.p.u.lim(name name.j) + %- ~(run by arms.j) + |= arm=jock + ?. ?=(%method -.arm) arm + =/ lam=jock body.arm + ?. ?=(%lambda -.lam) arm + ?~ inp.arg.p.lam arm + =. u.inp.arg.p.lam (resolve-one u.inp.arg.p.lam) + =. out.arg.p.lam (resolve-one out.arg.p.lam) + arm(body lam) :: door sample =/ sam-nok (type-to-default state.j) - :: unified context including door sample in context - ?> ?=(%state -<.state.j) :: exe-jyp has list of untyped arms plus door state =/ exe-jyp=jype - :: instead of untyped, assume correct output type in exe-jyp + :: Context includes resolved state type for field access in methods =/ context=jype - (~(cons jt p.p.state.j) jyp) + (~(cons jt resolved-state) jyp) [[%core %|^(~(run by arms.j) |=(* untyped-j)) `context] %$] =/ lis=(list [name=term val=jock]) ~(tap by arms.j) ?> ?=(^ lis) @@ -1758,10 +2844,8 @@ |- ^- [nock jype] ?~ lis :- [%8 sam-nok [%1 cor-nok] [%0 1]] :: XXX for subject - =/ inner-jyp - (~(cons jt state.j) [[%core %|^cor-jyp `state.j] name.state.j]) - =. inner-jyp inner-jyp(name name.state.j) - (~(cons jt inner-jyp) jyp) + =/ core-jyp=jype [[%core %|^cor-jyp `state.j] name.state.j] + (~(cons jt core-jyp) (~(cons jt state.j) jyp)) =+ [mor-nok mor-jyp]=%=(^$ j val.i.lis, jyp exe-jyp) %_ $ lis t.lis @@ -1794,7 +2878,7 @@ %cell-check ~| %cell-check =^ val jyp $(j val.j) - [[%3 val] [%atom %loobean %.n]^%$] + [[%3 val] [%atom %logical %.n]^%$] :: %compose ~| %compose-p @@ -1802,7 +2886,7 @@ $(j p.j) ~| %compose-q =+ [q q-jyp]=$(j q.j) - [[%7 p q] q-jyp] + [^-(nock (wrap-spot pos.j [%7 p q])) q-jyp] :: %object ~| %object @@ -1860,7 +2944,7 @@ =+ [cond cond-jyp]=$(j cond.j) =+ [then then-jyp]=$(j then.j) =+ [aftr aftr-jyp]=(mint-after-if after.j) - [[%6 cond then aftr] [%fork then-jyp aftr-jyp]^%$] + [^-(nock (wrap-spot pos.j [%6 cond then aftr])) [%fork then-jyp aftr-jyp]^%$] :: %assert =+ [cond cond-jyp]=$(j cond.j) @@ -1893,32 +2977,97 @@ cases +.cases == :: - %cases + %switch =+ [val val-jyp]=$(j value.j) =/ cases=(list (pair jock jock)) ~(tap by cases.j) ?: =(~ cases) ~|("expect more. cases: ~" !!) - :_ jyp - ^- nock - :+ %8 - [%1 val] - =/ cell=nock - ?~ default.j [%0 0] - =+ [def def-jyp]=$(j u.default.j) - [%7 [%0 3] [%1 def]] - |- - ?~ cases cell - =+ [jok jok-jyp]=^$(j ->.cases) - %= $ - cell :^ %6 + :: Check if this is an option-type switch (fork with %none) + ?. &(?=(@ -<.val-jyp) ?=(%fork -.p.val-jyp) ?=(%none -.-.p.p.val-jyp)) + :: Original switch logic (non-option types) + :_ jyp + ^- nock + :+ %8 + [%1 val] + =/ cell=nock + ?~ default.j [%0 0] + =+ [def def-jyp]=$(j u.default.j) + [%7 [%0 3] [%1 def]] + |- + ?~ cases cell + =+ [jok jok-jyp]=^$(j ->.cases) + %= $ + cell :^ %6 + ^- nock + (hunt-value -<.cases) ^- nock - (hunt-value -<.cases) - ^- nock - [%7 [%0 3] %1 `nock`jok] - cell - cases +.cases - == + [%7 [%0 3] %1 `nock`jok] + cell + cases +.cases + == + :: Option switch: specialized path for ?T types + =/ inner-jyp=jype q.p.val-jyp + =/ none-case=(unit jock) ~ + =/ some-case=(unit [term jock]) ~ + =/ default-case=(unit jock) default.j + |- + ?~ cases + :: Build nock: push val, test if null + =/ null-branch=nock + ?^ none-case + =+ [nok nok-jyp]=^$(j u.none-case) + [%7 [%0 3] nok] + ?^ default-case + =+ [nok nok-jyp]=^$(j u.default-case) + [%7 [%0 3] nok] + [%0 0] :: crash if no null handler + =/ some-branch=nock + ?^ some-case + :: Compile body with name bound to inner value + =/ bind-name=term -.u.some-case + =/ bind-body=jock +.u.some-case + =/ named-jyp=jype [-.inner-jyp bind-name] + =+ [body body-jyp]=^$(j bind-body, jyp (~(cons jt named-jyp) jyp)) + :: Current subject in %8 is [val orig-subj] + :: inner-val = tail of val = axis 5 + :: orig-subj = axis 3 + :: Build [inner-val orig-subj] then run body: + [%7 [[%0 5] [%0 3]] body] + ?^ default-case + =+ [nok nok-jyp]=^$(j u.default-case) + [%7 [%0 3] nok] + [%0 0] :: crash if no some handler + :_ inner-jyp + [%8 val [%6 [%5 [%1 0] [%0 2]] null-branch some-branch]] + :: Scan cases for patterns + =/ key=jock p.i.cases + =/ val=jock q.i.cases + ?: &(?=(@ -.key) ?=(%bind -.key)) + :: %bind case + $(some-case `[name.key val], cases t.cases) + ?: &(?=(@ -.key) ?=(%atom -.key)) + :: Null literal case (value 0) + $(none-case `val, cases t.cases) + :: Other patterns: fall through + $(cases t.cases) :: %call + =/ [call-nok=nock call-jyp=jype] + ^- [nock jype] + :: Special case: lent(String) or lent(Chars) → byte-length via met 3 + ?: ?& ?=(%limb -.func.j) + =(p.func.j ~[[%name %lent]]) + ?=(^ arg.j) + == + =+ [arg-nock arg-jyp]=$(j u.arg.j) + ?: ?& ?=(@ -<.arg-jyp) + ?| ?&(?=(%noun -.p.arg-jyp) ?=(%string p.p.arg-jyp)) + ?&(?=(%atom -.p.arg-jyp) ?=(%chars p.p.arg-jyp)) + == + == + :_ [%atom %number %.n]^%$ + (make-hoon-binop %met [%1 3] arg-nock) + :_ [%atom %number %.n]^%$ + (make-hoon-call %lent arg-nock) ?+ -.func.j ~|('must call a limb' !!) %limb =/ old-jyp jyp @@ -1945,10 +3094,24 @@ =/ [typ=jype ljl=(list jlimb) ljw=(list jwing)] ?. =([%axis 0] -.limbs) =/ lim (~(get-limb jt jyp) limbs) - ?~ lim ~|('limb not found' !!) - ?: ?=(%& -.u.lim) - [p.p.u.lim ~ q.p.u.lim] - p.u.lim + ?^ lim + ?: ?=(%& -.u.lim) + [p.p.u.lim ~ q.p.u.lim] + p.u.lim + :: Fallback: resolve just the first limb (instance name), + :: check if it's a struct from a class, and construct a + :: %limb reference to the class type for method dispatch. + ?> ?=(^ t.limbs) + =/ inst-lim (~(get-limb jt jyp) ~[i.limbs]) + ?~ inst-lim ~|('limb not found' !!) + ?> ?=(%& -.u.inst-lim) + =/ inst-typ=jype p.p.u.inst-lim + =/ inst-wing=(list jwing) q.p.u.inst-lim + ?. ?&(?=(@ -<.inst-typ) ?=(%struct -.p.inst-typ)) + ~|('limb not found' !!) + :: Construct a %limb pointing to the class type, + :: as expected by case-3 method dispatch. + [[[%limb ~[[%type name.p.inst-typ]]] name.inst-typ] ~ inst-wing] :: special case: we're looking for $ =/ ret (~(find-buc jt jyp)) ?~ ret ~|("couldn't find $ in {}" !!) @@ -1990,61 +3153,11 @@ =+ [arg arg-jyp]=$(j u.arg.j, jyp old-jyp) [%9 2 %10 [6 [%7 [%0 3] arg]] %0 2] :: - :: class constructor (case 2), multiple arguments + :: class constructor or method call :: [%call func=[%limb p=(list jlimb)] arg=(unit jock)] - :: Type(state) ?^ -<.typ - ~| %call-case-2-args - ?: ?=(%type -<.limbs) - ?~ arg.j ~|("expect method argument" !!) - =+ [val val-jyp]=$(j u.arg.j) - :: This is a class, so we know that the state is at the head. - ?> ?=(%state -<-<.typ) - =/ inferred-type (~(unify jt -<->.typ) val-jyp) - ?~ inferred-type - ~| '%call: argument value type does not nest in method type' - ~| "have: {}\0aneed: {}" - !! - =. inferred-type `u.inferred-type(name ->.limbs) - :_ u.inferred-type - :+ %8 - :: parent of axis - [%0 (div ;;(@ +:(resolve-wing ljw)) 2)] - :+ %10 - [6 %7 [%0 3] val] - [%0 2] - :: - ?> ?=(%name -<.limbs) - ?~ arg.j ~|("expect method argument" !!) - =+ [val val-jyp]=$(j u.arg.j) - =/ inferred-type (~(unify jt typ) val-jyp) - ?~ inferred-type - ~| '%call: argument value type does not nest in method type' - ~| "have: {}\0aneed: {}" - !! - =. inferred-type `u.inferred-type(name ->.limbs) - :- val - u.inferred-type - :: - :: class method call by constructor (case 2), single argument - :: [%call func=[%limb p=(list jlimb)] arg=(unit jock)] - :: Type(state) + ~|("unexpected cell-headed jype in call dispatch" !!) ?. ?=(%core -.p.typ) - ?: ?=(%type -<.limbs) - ~| %call-case-2 - :: XXX possibly unused now - ?> ?=(%type -<.limbs) - ?~ arg.j ~|("expect constructor state argument" !!) - =+ [val val-jyp]=$(j u.arg.j) - :: XXX this checks to make sure state and input actually nest - =/ inferred-type (~(unify jt typ) val-jyp) - ?~ inferred-type - ~| '%call: argument value type does not nest in method type' - ~| "have: {}\0aneed: {}" - !! - =. inferred-type `u.inferred-type - :- val - [[%limb limbs] ->.limbs] ?> ?=(%name -<.limbs) ?> ?=(%limb -.p.typ) :: Get class definition for instance. This is a cons of @@ -2054,19 +3167,22 @@ ?> ?=(%& -.u.lim) =/ dyp=jype p.p.u.lim =/ ljd=(list jwing) q.p.u.lim - =/ cyp ;;(jype ->.dyp) - ?> ?=(%core -<.cyp) - ?: ?=(%& -.p.p.cyp) ~|("class cannot be lambda" !!) + ?> ?=(@ -<.dyp) + ?> ?=(%core -.p.dyp) + ?: ?=(%& -.p.p.dyp) ~|("class cannot be lambda" !!) :: Search for the door defn in the subject jype. =/ gat-nom `cord`+<+.limbs - =/ gat-lim (~(get-limb jt dyp) +.limbs) + :: Strip name from class def so axis-at-name can recurse + :: into the [state core] pair to find method arms. + =/ gat-lim (~(get-limb jt dyp(name %$)) +.limbs) ?~ gat-lim ~| %call-case-7 :: Getter for state variables. :: instance.state() - =/ sta -<.dyp - ?> ?=(%state -<.sta) - =/ stn p.p.sta + =/ sta=jype (need q.p.dyp) + ?> ?=(@ -<.sta) + ?> ?=(%state -.p.sta) + =/ stn p.sta =/ ljs (~(get-limb jt +.stn) +.limbs) ?~ ljs ~|('leg not found' !!) :_ *jype @@ -2076,7 +3192,6 @@ [%0 6] :: door state is always at sample +6 [%0 ;;(@ +>-.u.ljs)] :: - ~| %call-case-3 :: class method call in instance (case 3) :: instance.method(args) :: In this case, we have located the class instance @@ -2085,22 +3200,89 @@ ?> ?=(%& -.u.gat-lim) =/ gat-jyp=jype p.p.u.gat-lim =/ ljg=(list jwing) q.p.u.gat-lim - =/ gat (~(get by p.p.p.cyp) gat-nom) + =/ gat (~(get by p.p.p.dyp) gat-nom) ?~ gat ~|("gate not found: {} in {}" !!) ?> ?=(%core -<.u.gat) ?. ?=(%& -.p.p.u.gat) ~|("method cannot be lambda" !!) - =/ dor-nom -<+.dyp :: class name, used to determine return type + =/ dor-nom +.dyp :: class name, used to determine return type + =/ method-inp=(unit jype) inp.p.p.p.u.gat :: Output is a regular type. ^- [nock jype] :_ out.p.p.p.u.gat + :: Step 1: Pull method arm from the class door to get a gate. + :: Step 2: Replace the gate's sample with [self args] and fire. + :: ljd = wing to class door (battery+sample in subject) + :: ljw = wing to instance struct data + :: ljg = wing to method arm in the door + :: Method call pattern: + :: 1. Push class door on subject (%8) + :: 2. Pull arm from door with sample set (%9 arm %10 [6 sample] door) + :: → produces a gate + :: 3. Slam the gate (%9 2 gate) + :: + :: ljd = wing to class door in subject + :: ljw = wing to instance struct data in subject + :: ljg = wing to method arm in class + :: After %8, subject = [door old-sub] + :: %0 2 = door, %0 3 = old-sub + :: Method call Nock pattern: + :: 1. %8: push class door, subject = [door old-sub] + :: 2. %9 arm [%10 [6 state] door]: set door sample, fire arm → gate + :: 3. %10 [6 args] gate: set gate sample to actual arguments + :: 4. %9 2: fire gate body + =/ bat-nock=nock (resolve-wing ljd) + ?> ?=([%0 *] bat-nock) + =/ door-nock=nock bat-nock(p (div p.bat-nock 2)) + =/ state-nock [%7 [%0 3] (resolve-wing ljw)] ?~ arg.j - (resolve-wing ljd) - :+ %8 - :+ %7 - (resolve-wing ljw) - [%9 ;;(@ -<.ljg) %0 1] + :: No explicit arg: method takes only self. + :: Gate sample = instance struct data. + :+ %8 + door-nock + :+ %9 2 + :+ %10 + [6 state-nock] + :+ %9 ;;(@ -<.ljg) + :+ %10 + [6 state-nock] + [%0 2] =+ [arg arg-jyp]=$(j u.arg.j, jyp old-jyp) - [%9 2 %10 [6 [%7 [%0 3] arg]] %0 2] + =/ arg-nock [%7 [%0 3] arg] + :+ %8 + door-nock + :+ %9 2 + :+ %10 + :: Check if method expects multi-arg (cell input type) + ?. ?&(?=(^ method-inp) ?=(^ -<.u.method-inp)) + :: single-arg: gate sample = caller arg + [6 arg-nock] + :: multi-arg: gate sample = [instance-data caller-arg] + [6 [state-nock arg-nock]] + :+ %9 ;;(@ -<.ljg) + :+ %10 + [6 state-nock] + [%0 2] + :: Class core. Constructor or method call? + ?: ?=(%type -<.limbs) + :: Constructor: Type(args) + ?~ arg.j ~|("expect method argument" !!) + =+ [val val-jyp]=$(j u.arg.j) + =/ sta=jype (need q.p.typ) + ?> ?=(@ -<.sta) + ?> ?=(%state -.p.sta) + =/ struct-jyp p.p.sta + =/ inferred-type (~(unify jt struct-jyp) val-jyp) + ?~ inferred-type + ~| '%call: argument value type does not nest in method type' + ~| "have: {}\0aneed: {}" + !! + =. inferred-type `u.inferred-type(name ->.limbs) + :_ u.inferred-type + :+ %8 + [%0 (div ;;(@ +:(resolve-wing ljw)) 2)] + :+ %10 + [6 %7 [%0 3] val] + [%0 2] :: :: traditional function call (case 1) :: func(args) @@ -2124,7 +3306,7 @@ :: :: lambda function call (case 4) :: lambda(args)->out{} - ?> &(=(1 (lent p.func.j)) !?=(%type -<.limbs)) + ?> =(1 (lent p.func.j)) ~| %call-case-4 :_ =/ gat ;;([%core p=core-body q=(unit jype)] -:(~(got by p.p.p.typ) +:(snag 0 p.func.j))) ?> ?=(%& -.p.gat) @@ -2149,9 +3331,10 @@ =+ [arg arg-jyp]=$(j u.arg.j) [%9 2 %10 [6 [%7 [%0 3] arg]] %0 1] == + [(wrap-spot pos.j call-nok) call-jyp] :: %compare - :_ [%atom %loobean %.n]^%$ + :_ [%atom %logical %.n]^%$ ?- comp.j %'==' =+ [a a-jyp]=$(j a.j) @@ -2165,55 +3348,149 @@ :: :: Other comparators must map into Hoon itself. %'>' - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %gth]]] arg=`[a.j b.j]] - -:$(j j) + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j b.j) + (make-hoon-binop %gth a b) :: %'<' - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %lth]]] arg=`[a.j b.j]] - -:$(j j) + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j b.j) + (make-hoon-binop %lth a b) :: %'<=' - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %lte]]] arg=`[a.j b.j]] - -:$(j j) + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j b.j) + (make-hoon-binop %lte a b) :: %'>=' - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %gte]]] arg=`[a.j b.j]] - -:$(j j) + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j b.j) + (make-hoon-binop %gte a b) == :: %operator ~| %operator + :: Check for operator overloading on class instances + =/ op-method=(unit term) + :: Binary or unary ops on variable references + ?. ?=(%limb -.a.j) ~ + :: Look up variable type + =/ lim (~(get-limb jt jyp) p.a.j) + ?~ lim ~ + ?. ?=(%& -.u.lim) ~ + =/ typ=jype p.p.u.lim + :: Check if type is a struct (class instance state) + ?. ?&(?=(@ -<.typ) ?=(%struct -.p.typ)) ~ + :: Walk jype for a trait with this operator and arity + =/ is-unary=? =(~ b.j) + =< (find-op jyp op.j is-unary) + |% + ++ find-op + |= [j=jype op=operator is-unary=?] + ^- (unit term) + ?: ?=(@ -<.j) + :: Leaf node: check if it's a trait with matching op and arity + ?. ?=(%trait -.p.j) ~ + ?. =(`op op.p.j) ~ + ?. =(is-unary unary.p.j) ~ + ?~ methods.p.j ~ + `i.methods.p.j + :: Cell node: search left then right + =/ l $(j -<.j) + ?^ l l + $(j ->.j) + -- + ?^ op-method + ?> ?=(%limb -.a.j) + ?~ b.j + :: Unary overload: ⊖x -> x.neg() + =/ j=jock [%call [0 0] [%limb (snoc p.a.j [%name u.op-method])] arg=~] + $(j j) + :: Binary overload: x + y -> x.add(y) + =/ j=jock [%call [0 0] [%limb (snoc p.a.j [%name u.op-method])] arg=b.j] + $(j j) + :: If unary and no overload found, crash + ?~ b.j + ~|('unary operator requires trait overload' !!) + :: String/Chars + concat: dispatch before arithmetic fallthrough + ?: =(op.j %'+') + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j u.b.j) + ?: ?& ?=(@ -<.a-jyp) + ?| ?&(?=(%noun -.p.a-jyp) ?=(%string p.p.a-jyp)) + ?&(?=(%atom -.p.a-jyp) ?=(%chars p.p.a-jyp)) + == + == + :_ a-jyp + (make-hoon-binop %cat [%1 3] [a b]) + :: Not string/chars — numeric add + :_ [%atom %number %.n]^%$ + (make-hoon-binop %add a b) + :: Standard operator: returns atom type :_ [%atom %number %.n]^%$ ?- op.j %'+' ?~ b.j !! - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %add]]] arg=`[a.j u.b.j]] - -:$(j j) - :: + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j u.b.j) + (make-hoon-binop %add a b) + :: %'-' ?~ b.j !! - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %sub]]] arg=`[a.j u.b.j]] - -:$(j j) - :: + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j u.b.j) + (make-hoon-binop %sub a b) + :: %'*' ?~ b.j !! - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %mul]]] arg=`[a.j u.b.j]] - -:$(j j) - :: + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j u.b.j) + (make-hoon-binop %mul a b) + :: + %'×' + ?~ b.j !! + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j u.b.j) + (make-hoon-binop %mul a b) + :: %'/' ?~ b.j !! - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %div]]] arg=`[a.j u.b.j]] - -:$(j j) - :: + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j u.b.j) + (make-hoon-binop %div a b) + :: %'%' ?~ b.j !! - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %mod]]] arg=`[a.j u.b.j]] - -:$(j j) - :: + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j u.b.j) + (make-hoon-binop %mod a b) + :: %'**' ?~ b.j !! - =/ j=jock [%call [%limb p=~[[%name %hoon] [%name %pow]]] arg=`[a.j u.b.j]] - -:$(j j) + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j u.b.j) + (make-hoon-binop %pow a b) + :: + %'÷' + ?~ b.j !! + =+ [a a-jyp]=$(j a.j) + =+ [b b-jyp]=$(j u.b.j) + (make-hoon-binop %div a b) + :: Overload-only operators: crash if no trait mapping found + %'±' ~|('± requires operator overload via trait' !!) + %'⊕' ~|('⊕ requires operator overload via trait' !!) + %'⊗' ~|('⊗ requires operator overload via trait' !!) + %'⊖' ~|('⊖ requires operator overload via trait' !!) + %'∘' ~|('∘ requires operator overload via trait' !!) + %'·' ~|('· requires operator overload via trait' !!) + %'∩' ~|('∩ requires operator overload via trait' !!) + %'∪' ~|('∪ requires operator overload via trait' !!) + %'∈' ~|('∈ requires operator overload via trait' !!) + %'⊂' ~|('⊂ requires operator overload via trait' !!) + %'⊃' ~|('⊃ requires operator overload via trait' !!) + %'^' ~|('^ requires operator overload via trait' !!) + %'|' ~|('| requires operator overload via trait' !!) + %'\\' ~|('\\ requires operator overload via trait' !!) :: == :: @@ -2231,37 +3508,29 @@ =/ con=(unit (pair nock jype)) ?~ context.p.j ~ `$(j u.context.p.j) + :: Resolve %limb references in lambda argument types eagerly + :: so struct fields are accessible inside function bodies. + =/ resolve-one + |= j=jype + ^- jype + ?. ?=(@ -<.j) + =/ sub-a=jype $(j p.j) + =/ sub-b=jype $(j q.j) + [[sub-a sub-b] name.j] + ?. ?=(%limb -.p.j) j + =/ lim (~(get-limb jt jyp) p.p.j) + ?~ lim j + ?. ?=(%& -.u.lim) j + p.p.u.lim(name name.j) + =. u.inp.arg.p.j (resolve-one u.inp.arg.p.j) + =. out.arg.p.j (resolve-one out.arg.p.j) =/ input-default (type-to-default u.inp.arg.p.j) ~| %enter-lambda-body - :: TODO: wtf? =/ lam-jyp (lam-j arg.p.j ?~(con `jyp `q.u.con)) :: 1. Get body jype =+ [body body-jyp]=$(j body.p.j, jyp lam-jyp) - ?: (is-type name.out.arg.p.j) - :: instance return from method - ?~ con - :_ (lam-j arg.p.j `jyp) - :+ %8 - input-default - :- - :- %1 - :+ %8 - [%0 7] - :+ %10 - [6 %7 [%0 3] body] - [%0 2] - [%0 1] - :_ (lam-j arg.p.j `q.u.con) - :+ %8 - input-default - :- - :- %1 - :+ %8 - [%0 7] - :+ %10 - [6 %7 [%0 3] body] - [%0 2] - p.u.con + :: TODO: method return path (instance return via Nock 10) removed; + :: re-add when class methods are implemented. :: normal return ?~ con :_ (lam-j arg.p.j `jyp) @@ -2315,8 +3584,10 @@ %set ~| %set =/ vals=(list jock) ~(tap in val.j) - ?: =(~ vals) ~| 'set: no value' !! - =+ [val val-jyp]=$(j -.vals) + ?: =(~ vals) + :_ [[%set type.j^%$] %$] + [%1 ~] + =+ [val-nock val-jyp]=$(j -.vals) :: XXX right now this means the val-jyp is %none and will be overridden =/ inferred-type (~(unify jt type.j^%$) val-jyp) @@ -2324,29 +3595,76 @@ ~| '%set: value type does not nest in declared type' ~| ['have:' val-jyp 'need:' type.j] !! - :: At this point, we have a (set jock), not a (set *) of the values - =/ res=(set *) (~(put in *(set *)) val) + :: Extract actual value from [%1 val] constant Nock formula + =. val-nock (fold-const val-nock) + ?> ?=([%1 *] val-nock) + =/ res=(set *) (~(put in *(set *)) p.val-nock) =. vals +.vals :_ [[%set u.inferred-type] %$] |- ^- nock ?~ vals [%1 `*`res] - =+ [val val-jyp]=^$(j -.vals) + =+ [val-nock val-jyp]=^$(j -.vals) =/ inferred-type (~(unify jt type.j^%$) val-jyp) ?~ inferred-type ~| '%set: value type does not nest in declared type' ~| ['have:' val-jyp 'need:' type.j] !! + =. val-nock (fold-const val-nock) + ?> ?=([%1 *] val-nock) %= $ - res (~(put in res) val) + res (~(put in res) p.val-nock) vals +.vals == + :: + %map + ~| %map + =/ pairs=(list (pair jock jock)) ~(tap by val.j) + :: Empty map + ?: =(~ pairs) + :_ [[%map [%none ~]^%$ [%none ~]^%$] %$] + [%1 ~] + :: Compile first pair to infer types + =+ [key-nock key-jyp]=$(j -.-.pairs) + =+ [val-nock val-jyp]=$(j +.-.pairs) + :: Build map at compile-time using Hoon's ~(put by) + :: Extract actual values from [%1 val] constant Nock formulas + =. key-nock (fold-const key-nock) + =. val-nock (fold-const val-nock) + ?> ?=([%1 *] key-nock) + ?> ?=([%1 *] val-nock) + =/ res=(map * *) (~(put by *(map * *)) p.key-nock p.val-nock) + =. pairs +.pairs + :_ [[%map key-jyp val-jyp] %$] + |- ^- nock + ?~ pairs + [%1 `*`res] + =+ [key-nock key-jyp]=^$(j -.-.pairs) + =+ [val-nock val-jyp]=^$(j +.-.pairs) + =. key-nock (fold-const key-nock) + =. val-nock (fold-const val-nock) + ?> ?=([%1 *] key-nock) + ?> ?=([%1 *] val-nock) + %= $ + res (~(put by res) p.key-nock p.val-nock) + pairs +.pairs + == :: %atom + :: [%atom [type value] flag] ~| [%atom +<+.j] - :- [%1 +<+.j] - [^-(jype-leaf [%atom +<-.j +>.j]) %$] + :: Warn if %number literal exceeds Goldilocks prime field max (p-1 = 2^64 - 2^32) + =/ res :- [%1 +<+.j] [^-(jype-leaf [%atom +<-.j +>.j]) %$] + ?: ?&(?=(%number +<-.j) (gte +<+.j (add (sub (bex 64) (bex 32)) 1))) + ~&([%warn-unbased-atom +<+.j] res) + res + :: + %noun + :: [%noun [type value]] + ~| [%noun +>.j] + :- [%1 +>.j] + [^-(jype-leaf [%noun +<.j]) %$] :: %import ~| %import @@ -2355,6 +3673,7 @@ ~| %import-next =+ [nex nex-jyp]=$(j next.j) :_ nex-jyp + %- wrap-spot :- pos.j :+ %8 [%1 q.p.p.name.j] nex @@ -2364,15 +3683,257 @@ =+ [val val-jyp]=$(j +.body.j) =+ [nex nex-jyp]=$(j next.j) :_ nex-jyp + %- wrap-spot :- pos.j :+ %11 - [%slog [%1 0] %1 (pprint val val-jyp)] + [%slog [%1 0] (format-nock val val-jyp)] nex :: %crash ~| %crash [[%0 0] jyp] + :: + %bind + ~| '%bind: only valid as a match case pattern' + !! + :: + %index-empty + ~| '%index-empty: not yet implemented' + !! + :: + %index-has + =+ [expr-nock expr-jyp]=$(j expr.j) + ?: ?& ?=(@ -<.expr-jyp) + ?=(%fork -.p.expr-jyp) + == + ~|("cannot has-check a union type; use match first" !!) + :: Map has: call map-get inline and check result != ~ + ?: ?& ?=(@ -<.expr-jyp) + ?=(%map -.p.expr-jyp) + == + =/ lim (~(get-limb jt jyp) ~[[%name %hoon]]) + ?~ lim ~|('hoon library not found' !!) + ?> ?=(%| -.u.lim) + =/ typ=jype p.p.u.lim + =/ ljw=(list jwing) r.p.u.lim + =+ ast=(j2h ~[[%name %map-get]] ~) + ?> ?=(%hoon -<.typ) + =/ min (~(mint ut -.p.p.-.typ) %noun ast) + =/ qmin + ~| 'failed to validate map-get Nock (has)' + ;;(nock q.min) + =+ [idx-nok idx-jyp]=$(j idx.j) + =/ call-nok=nock + ;; nock + :+ %8 + :^ %9 +<+<.qmin %0 -.ljw + [%9 2 %10 [6 [%7 [%0 3] [idx-nok expr-nock]]] %0 2] + :_ [%atom %logical %.n]^%$ + ;; nock + :: if map-get == ~ then %.n (1) else %.y (0) + [%6 [%5 [%1 0] call-nok] [%1 1] [%1 0]] + :: Set has: call set-get inline and check result != ~ + ?: ?& ?=(@ -<.expr-jyp) + ?=(%set -.p.expr-jyp) + == + =/ lim (~(get-limb jt jyp) ~[[%name %hoon]]) + ?~ lim ~|('hoon library not found' !!) + ?> ?=(%| -.u.lim) + =/ typ=jype p.p.u.lim + =/ ljw=(list jwing) r.p.u.lim + =+ ast=(j2h ~[[%name %set-get]] ~) + ?> ?=(%hoon -<.typ) + =/ min (~(mint ut -.p.p.-.typ) %noun ast) + =/ qmin + ~| 'failed to validate set-get Nock (has)' + ;;(nock q.min) + =+ [idx-nok idx-jyp]=$(j idx.j) + =/ call-nok=nock + ;; nock + :+ %8 + :^ %9 +<+<.qmin %0 -.ljw + [%9 2 %10 [6 [%7 [%0 3] [idx-nok expr-nock]]] %0 2] + :_ [%atom %logical %.n]^%$ + ;; nock + :: if set-get == ~ then %.n (1) else %.y (0) + [%6 [%5 [%1 0] call-nok] [%1 1] [%1 0]] + ~|("index-has requires a Map or Set type" !!) + :: + %index-del + =+ [expr-nock expr-jyp]=$(j expr.j) + ?: ?& ?=(@ -<.expr-jyp) + ?=(%fork -.p.expr-jyp) + == + ~|("cannot del from a union type; use match first" !!) + :: Map del: inline gor-free recursive Nock trap + ?: ?& ?=(@ -<.expr-jyp) + ?=(%map -.p.expr-jyp) + == + =+ [idx-nok idx-jyp]=$(j idx.j) + :_ expr-jyp + (make-del-nok idx-nok expr-nock %.y) + :: Set del: inline gor-free recursive Nock trap + ?: ?& ?=(@ -<.expr-jyp) + ?=(%set -.p.expr-jyp) + == + =+ [idx-nok idx-jyp]=$(j idx.j) + :_ expr-jyp + (make-del-nok idx-nok expr-nock %.n) + ~|("index-del requires a Map or Set type" !!) + :: + %index-slice + =+ [expr-nock expr-jyp]=$(j expr.j) + ?: ?& ?=(@ -<.expr-jyp) + ?| ?&(?=(%noun -.p.expr-jyp) ?=(%string p.p.expr-jyp)) + ?&(?=(%atom -.p.expr-jyp) ?=(%chars p.p.expr-jyp)) + == + == + =+ [start-nok start-jyp]=$(j start.j) + =+ [end-nok end-jyp]=$(j end.j) + =/ len-nok=nock (make-hoon-binop %sub end-nok start-nok) + :_ expr-jyp + (make-hoon-binop %cut [%1 3] [[start-nok len-nok] expr-nock]) + ~|("index-slice requires a String or Chars type" !!) + :: + %index-uslice + ~| 'unicode slicing not yet implemented' + !! + :: + %index-pop + ~| '%index-pop: not yet implemented' + !! + :: + %index-put + :: expr must be a direct variable reference (limb) for slot update + ~| '%index-put: expr must be a variable reference' + ?> ?=(%limb -.expr.j) + =/ inst-res (~(get-limb jt jyp) p.expr.j) + ?~ inst-res ~|('%index-put: variable not found' !!) + ?> ?=(%& -.u.inst-res) + ?> ?=(^ q.p.u.inst-res) + ?> ?=(@ i.q.p.u.inst-res) + =/ inst-jyp=jype p.p.u.inst-res + =/ inst-axi=@ i.q.p.u.inst-res + ?: ?& ?=(@ -<.inst-jyp) + ?=(%fork -.p.inst-jyp) + == + ~|('cannot put into a union type; use match first' !!) + :: Map put: a[key] = val; — inline gor-free prepend + :: Creates [[key val] old_map ~]; map-get checks root first so new value wins + ?: ?& ?=(@ -<.inst-jyp) + ?=(%map -.p.inst-jyp) + == + ?> ?=(^ idx.j) + =+ [idx-nok idx-jyp]=$(j u.idx.j) + =+ [val-nok val-jyp]=$(j val.j) + =/ put-nok=nock + ;; nock + [[idx-nok val-nok] [[%0 inst-axi] [%1 0]]] + =+ [nex nex-jyp]=$(j next.j) + [[%7 [%10 [inst-axi put-nok] %0 1] nex] nex-jyp] + :: Set put: a[] = val; — inline gor-free prepend + :: Creates [val old_set ~]; set-get checks root first so new value wins + ?: ?& ?=(@ -<.inst-jyp) + ?=(%set -.p.inst-jyp) + == + ?> =(~ idx.j) + =+ [val-nok val-jyp]=$(j val.j) + =/ put-nok=nock + ;; nock + [val-nok [[%0 inst-axi] [%1 0]]] + =+ [nex nex-jyp]=$(j next.j) + [[%7 [%10 [inst-axi put-nok] %0 1] nex] nex-jyp] + ~|('index-put requires a Map or Set type' !!) == :: + ++ make-del-nok + :: Generate inline gor-free del Nock for map (is-map=%.y) or set (is-map=%.n) + :: key-f: Nock formula for the key, evaluated against the current subject + :: tree-f: Nock formula for the tree, evaluated against the current subject + :: + :: Uses a self-referencing recursive Nock trap. + :: Trap subject layout: [self key tree acc] + :: ax2=self ax6=key ax14=tree ax15=acc + :: ax28=n.tree ax56=p.n.tree(map only) ax58=l.tree ax59=r.tree + :: + :: Algorithm: DFS accumulator — for each node, optionally prepend to acc, + :: then recurse left (updating acc), then recurse right (updating acc again). + |= [key-f=nock tree-f=nock is-map=?] + ^- nock + :: Equality check: map compares key with p.n.tree (ax56), set with n.tree (ax28) + =/ eq-f=nock + ;; nock + [%5 [%0 6] ?:(is-map [%0 56] [%0 28])] + :: new-acc: if key matches, keep acc; else prepend [n.tree acc ~] + =/ new-acc-f=nock + ;; nock + :^ %6 eq-f + [%0 15] + [[%0 28] [[%0 15] [%1 0]]] + :: Inner recursive call: del(key, l.tree, new_acc) + :: Subject: [self key l.tree new_acc] + =/ left-call=nock + ;; nock + :+ %9 2 + [[%0 2] [[%0 6] [[%0 58] new-acc-f]]] + :: Outer recursive call: del(key, r.tree, left_result) + :: Subject: [self key r.tree left_result] + =/ right-call=nock + ;; nock + :+ %9 2 + [[%0 2] [[%0 6] [[%0 59] left-call]]] + :: Trap body: if tree==~, return acc; else right-call + =/ trap-body=nock + ;; nock + :^ %6 [%5 [%1 0] [%0 14]] + [%0 15] + right-call + :: Outer: push trap, call with [self key tree ~] via original subject + ;; nock + :+ %8 [%1 trap-body] + :+ %9 2 + [[%0 2] [[%7 [%0 3] key-f] [[%7 [%0 3] tree-f] [%1 0]]]] + :: + ++ fold-const + :: Recursively fold a cell-of-constants [[%1 a] [%1 b]] into [%1 [a b]]. + :: In nock type, $^ = [p=nock q=nock] when head is itself a cell (not a tag atom). + :: Enables compile-time set/map literals with pair/tuple element types. + |= n=nock + ^- nock + ?: ?=([%1 *] n) n + :: Only recurse into $^ cells (head is a cell, not a tag atom like %8) + ?. ?=(^ -.n) n + =/ l=nock $(n -.n) + =/ r=nock $(n +.n) + ?. ?=([%1 *] l) n + ?. ?=([%1 *] r) n + [%1 p.l p.r] + :: + ++ get-index-number + |= j=jock + ^- @ + ~| "tuple index must be a literal number" + ?> ?=([%atom *] j) + =/ a=jatom p.j + ?> ?=([%number *] -.a) + p.-.a + :: + ++ tuple-axis + |= [n=@ typ=jype] + ^- [@ jype] + ?@ -<.typ !! + :: index 0: return head + ?: =(0 n) + [2 p.typ] + :: check if tail is a cell jype (more tuple elements) + ?@ -<.q.typ + :: tail is a leaf: index 1 = tail (last element) + ?> =(1 n) + [3 q.typ] + :: tail is a cell: recurse, compose axis via peg + =/ [inner-ax=@ inner-jyp=jype] + $(n (dec n), typ `jype`q.typ) + [(peg 3 inner-ax) inner-jyp] + :: ++ mint-after-if |= j=after-if-expression ^- [nock jype] @@ -2412,7 +3973,8 @@ ++ type-to-default |= j=jype ^- nock - ?^ -<.j [$(j p.j) $(j q.j)] + ?. ?=(@ -<.j) + [$(j p.j) $(j q.j)] ?- -.p.j :: %atom [%1 0] @@ -2431,14 +3993,29 @@ $(j p.p.u.lim) :: %fork $(j p.p.j) + :: + %noun [%1 0] :: %list [%1 0] + :: + %map [%1 ~] :: Empty map is null :: %set [%1 0] + :: + %stack [%1 0] :: %hoon [%1 0] :: %state $(j p.p.j) + :: + %struct + =/ flds=(list [name=term type=jype]) fields.p.j + ?~ flds [%1 0] + =/ this=nock $(j type.i.flds) + ?~ t.flds this + [this $(j [[%struct name.p.j t.flds] name.j])] + :: + %trait [%1 0] :: %none [%1 0] == @@ -2473,10 +4050,17 @@ ;; hoon :+ ?:(q.p.arg %rock %sand) ?- -<.p.arg - %string %ta + %chars %ta %number %ud - %hexadecimal %ux - %loobean %f + %sint %sd + %hex %ux + %real %rd + %real16 %rh + %real32 %rs + %real128 %rq + %logical %f + %date %da + %span %dr == p.p.arg :: @@ -2485,11 +4069,35 @@ :: [%limb p=(list jlimb)] ~| %limb ~ + :: + %noun + :: What we call nouns are specific types. + :: [%noun p=jnoun] + ?- -.p.arg + :: a string is a cord (@t atom) + %string + ~| %string + ;; (list hoon) + :_ ~ + [%rock %t p.p.arg] + :: a path is a (list @t) + %path + ~| %path + ~& "here in path" + :_ ~ + :- %clsg + %+ turn + p.p.arg + |= =cord + ^- hoon + [%sand %t cord] + == :: %list :: Lists are composed of a series of values, which we unpack. :: [%list type=jype-leaf val=(list jock)] ~| %list + ;; (list hoon) :_ ~ :- %clsg %- snip :: spurious ~ from Jock representation @@ -2504,6 +4112,12 @@ :: [%set type=jype-leaf val=(set jock)] ~| %set !! + :: + %map + :: Maps are a tree of key-value pairs, which must be in the same order as Hoon. + :: [%map type=jype-leaf val=(map jock jock)] + ~| %map + !! == [%cncl p q] :: @@ -2533,12 +4147,20 @@ ^- jype-leaf :+ %atom ?+ p.t ~|("cannot convert atom type {} to jatom" !!) + %t %chars + %ta %chars + %tas %chars %ud %number - %ux %hexadecimal - %t %string - %ta %string - %tas %string - %f %loobean + %sd %sint + %ux %hex + %x %hex + %rd %real + %rh %real16 + %rs %real32 + %rq %real128 + %f %logical + %da %date + %dr %span == =(~ q.t) :: @@ -2554,6 +4176,14 @@ *jype-leaf == :: + :: +struct-to-cell-jype: convert struct fields to nested cell jype + ++ struct-to-cell-jype + |= flds=struct-fields + ^- jype + ?~ flds [%none ~]^%$ + ?~ t.flds type.i.flds + [[type.i.flds $(flds t.flds)] %$] + :: :: +hunt-type: make a $nock to test whether jock nests in jype :: We check only four cases: %none and constant %atom to :: bottom out, and %fork and nothing (cell) to continue. @@ -2576,18 +4206,56 @@ [%1 1] :: atom case ?+ -.-.jype - :: default case: %atom, %core, %limb + :: default case: %core, %limb ~|((crip "hunt: can't match {<`@tas`-<.jype>}") !!) :: %atom - ?> +.+.-.jype - [%5 [%1 q.p.jype] %0 axis] + ?: q.p.jype + :: constant atom: exact equality check + [%5 [%1 q.p.jype] %0 axis] + :: non-constant atom: check it's an atom (not a cell) + :: Nock 3: 0=cell, 1=atom. We want 0=match, 1=fail. + :: So: if cell(0) -> fail(1), else -> pass(0) + [%6 [%3 %0 axis] [%1 1] [%1 0]] + :: + %none + :: null = 0. Check value equals 0. + [%5 [%1 0] %0 axis] :: %fork - ~|('hunt: can\'t match fork' !!) + :: Match if either branch matches. + :: hunt returns 0=match, 1=fail. Use Nock 6 as OR: + :: if left matches (0), return 0; else try right. + [%6 $(jype p.p.jype) [%1 0] $(jype q.p.jype)] :: - %none - ~|('hunt: can\'t match untyped' !!) + %list + :: A list is either ~ (atom 0) or [item rest]. + :: Just check it's either an atom or a cell (anything is valid). + [%1 0] + :: + %map + :: A map is either ~ (null) or a tree node. + :: Just check it's either an atom or a cell (anything is valid). + [%1 0] + :: + %set + :: A set is either ~ or a tree node. + [%1 0] + :: + %stack + :: A stack is either ~ or [item rest]. + [%1 0] + :: + %struct + =/ flds fields.p.jype + ?~ flds [%1 0] + %= $ + jype (struct-to-cell-jype flds) + == + :: + %noun + :: noun always matches + [%1 0] == :: :: +hunt-value: make a $nock to test whether jock matches value @@ -2616,33 +4284,84 @@ %atom [%5 [%1 `@`+.p.jock] %0 axis] == - -- :: - :: Prettyprinter - ++ pprint - |= [=nock =jype] - ^- tank - :: ?^ -<.j [$(j p.j) $(j q.j)] - ?+ -<.jype - :- %leaf - "print: {<[-.jype]>} {<`*`nock>}" - :: + ++ format-nock + |= [val=nock typ=jype] + ^- nock + :: Returns Nock formula that evaluates to @t (a cord) + :: The slog handler accepts raw atoms as cords directly + (cord-nock val typ) + :: + ++ cord-nock + |= [val=nock typ=jype] + ^- nock + :: Returns Nock that evaluates to @t (a cord) + ?+ -<.typ [%1 ''] %atom - %- crip - ?- ->-.jype - %loobean - "{<;;(? +.nock)>}" - :: - %number - "{<;;(@ud +.nock)>}" + ?+ ->-.typ [%1 ''] + %chars + val :: - %hexadecimal - "{<;;(@ux +.nock)>}" + %number + (make-hoon-call %scot-ud val) :: - %string - "{<;;(@t +.nock)>}" + %hex + (make-hoon-call %scot-ux val) :: + %logical + :: if =(0 val) then '%.y' else '%.n' + :+ %6 [%5 [%1 0] val] + :- [%1 '%.y'] + [%1 '%.n'] == - :: + %noun + :: String is already a cord (@t); display directly + val + %fork + :: Option type (?T): check none/some at runtime + ?: &(?=(@ -<.p.p.typ) =(%none -.p.p.p.typ)) + :: if =(0 val) then "~" else format payload + :+ %6 [%5 [%1 0] val] + :- [%1 '~'] + $(val [%7 val [%0 3]], typ q.p.typ) + $(typ p.p.typ) == + :: + ++ make-hoon-call + |= [arm=term val=nock] + ^- nock + :: Generate Nock to call hoon.(val) at runtime + :: Same pattern as list indexing (hoon.snag) + =/ lim (~(get-limb jt jyp) ~[[%name %hoon]]) + ?~ lim ~|('hoon library not found for print' !!) + ?> ?=(%| -.u.lim) + =/ typ=jype p.p.u.lim + =/ ljw=(list jwing) r.p.u.lim + =+ ast=(j2h ~[[%name arm]] ~) + ?> ?=(%hoon -<.typ) + =/ min (~(mint ut -.p.p.-.typ) %noun ast) + =/ qmin ;;(nock q.min) + ;; nock + :+ %8 + :^ %9 +<+<.qmin %0 -.ljw + [%9 2 %10 [6 [%7 [%0 3] val]] %0 2] + :: + ++ make-hoon-binop + |= [arm=term a=nock b=nock] + ^- nock + :: Generate Nock to call hoon.(a, b) at runtime + =/ lim (~(get-limb jt jyp) ~[[%name %hoon]]) + ?~ lim ~|('hoon library not found for binop' !!) + ?> ?=(%| -.u.lim) + =/ typ=jype p.p.u.lim + =/ ljw=(list jwing) r.p.u.lim + =+ ast=(j2h ~[[%name arm]] ~) + ?> ?=(%hoon -<.typ) + =/ min (~(mint ut -.p.p.-.typ) %noun ast) + =/ qmin ;;(nock q.min) + ;; nock + :+ %8 + :^ %9 +<+<.qmin %0 -.ljw + [%9 2 %10 [6 [%7 [%0 3] [a b]]] %0 2] + -- -- diff --git a/common/tests/expected/alias-basic.expected b/common/tests/expected/alias-basic.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/alias-basic.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/alias-chain.expected b/common/tests/expected/alias-chain.expected new file mode 100644 index 0000000..26cc6eb --- /dev/null +++ b/common/tests/expected/alias-chain.expected @@ -0,0 +1 @@ +[42 7]] \ No newline at end of file diff --git a/common/tests/expected/alias-diamond.expected b/common/tests/expected/alias-diamond.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/alias-diamond.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/alias-struct.expected b/common/tests/expected/alias-struct.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/alias-struct.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/assert.expected b/common/tests/expected/assert.expected new file mode 100644 index 0000000..f254137 --- /dev/null +++ b/common/tests/expected/assert.expected @@ -0,0 +1 @@ +4] \ No newline at end of file diff --git a/common/tests/expected/axis-call.expected b/common/tests/expected/axis-call.expected new file mode 100644 index 0000000..2f19b1e --- /dev/null +++ b/common/tests/expected/axis-call.expected @@ -0,0 +1 @@ +18] \ No newline at end of file diff --git a/common/tests/expected/baby.expected b/common/tests/expected/baby.expected new file mode 100644 index 0000000..e69de29 diff --git a/common/tests/expected/call-let-edit.expected b/common/tests/expected/call-let-edit.expected new file mode 100644 index 0000000..fba4099 --- /dev/null +++ b/common/tests/expected/call-let-edit.expected @@ -0,0 +1 @@ +24] \ No newline at end of file diff --git a/common/tests/expected/call.expected b/common/tests/expected/call.expected new file mode 100644 index 0000000..fba4099 --- /dev/null +++ b/common/tests/expected/call.expected @@ -0,0 +1 @@ +24] \ No newline at end of file diff --git a/common/tests/expected/cast-as-wut-fail.expected b/common/tests/expected/cast-as-wut-fail.expected new file mode 100644 index 0000000..bef6db9 --- /dev/null +++ b/common/tests/expected/cast-as-wut-fail.expected @@ -0,0 +1 @@ +0] \ No newline at end of file diff --git a/common/tests/expected/cast-as-wut.expected b/common/tests/expected/cast-as-wut.expected new file mode 100644 index 0000000..1374834 --- /dev/null +++ b/common/tests/expected/cast-as-wut.expected @@ -0,0 +1 @@ +[0 42]] \ No newline at end of file diff --git a/common/tests/expected/cast-as-zap.expected b/common/tests/expected/cast-as-zap.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/cast-as-zap.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/cast-as.expected b/common/tests/expected/cast-as.expected new file mode 100644 index 0000000..26cc6eb --- /dev/null +++ b/common/tests/expected/cast-as.expected @@ -0,0 +1 @@ +[42 7]] \ No newline at end of file diff --git a/common/tests/expected/chars-concat.expected b/common/tests/expected/chars-concat.expected new file mode 100644 index 0000000..666ba78 --- /dev/null +++ b/common/tests/expected/chars-concat.expected @@ -0,0 +1 @@ +125.762.588.864.358] \ No newline at end of file diff --git a/common/tests/expected/chars-index.expected b/common/tests/expected/chars-index.expected new file mode 100644 index 0000000..2873f87 --- /dev/null +++ b/common/tests/expected/chars-index.expected @@ -0,0 +1 @@ +104] \ No newline at end of file diff --git a/common/tests/expected/class-3d.expected b/common/tests/expected/class-3d.expected new file mode 100644 index 0000000..9f756f9 --- /dev/null +++ b/common/tests/expected/class-3d.expected @@ -0,0 +1 @@ +30] \ No newline at end of file diff --git a/common/tests/expected/class-basic.expected b/common/tests/expected/class-basic.expected new file mode 100644 index 0000000..26cc6eb --- /dev/null +++ b/common/tests/expected/class-basic.expected @@ -0,0 +1 @@ +[42 7]] \ No newline at end of file diff --git a/common/tests/expected/class-define.expected b/common/tests/expected/class-define.expected new file mode 100644 index 0000000..bef6db9 --- /dev/null +++ b/common/tests/expected/class-define.expected @@ -0,0 +1 @@ +0] \ No newline at end of file diff --git a/common/tests/expected/class-ops.expected b/common/tests/expected/class-ops.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/class-ops.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/class-state.expected b/common/tests/expected/class-state.expected new file mode 100644 index 0000000..4874b90 --- /dev/null +++ b/common/tests/expected/class-state.expected @@ -0,0 +1 @@ +[[90 100] 70 80]] \ No newline at end of file diff --git a/common/tests/expected/coalesce-fallback.expected b/common/tests/expected/coalesce-fallback.expected new file mode 100644 index 0000000..79c9ce5 --- /dev/null +++ b/common/tests/expected/coalesce-fallback.expected @@ -0,0 +1 @@ +99] \ No newline at end of file diff --git a/common/tests/expected/coalesce.expected b/common/tests/expected/coalesce.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/coalesce.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/comparator.expected b/common/tests/expected/comparator.expected new file mode 100644 index 0000000..d2af0c6 --- /dev/null +++ b/common/tests/expected/comparator.expected @@ -0,0 +1 @@ +1] \ No newline at end of file diff --git a/common/tests/expected/compose-cores.expected b/common/tests/expected/compose-cores.expected new file mode 100644 index 0000000..f367319 --- /dev/null +++ b/common/tests/expected/compose-cores.expected @@ -0,0 +1 @@ +29] \ No newline at end of file diff --git a/common/tests/expected/compose.expected b/common/tests/expected/compose.expected new file mode 100644 index 0000000..4c74967 --- /dev/null +++ b/common/tests/expected/compose.expected @@ -0,0 +1 @@ +6] \ No newline at end of file diff --git a/common/tests/expected/dec.expected b/common/tests/expected/dec.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/dec.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/eval.expected b/common/tests/expected/eval.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/eval.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/example-atom.expected b/common/tests/expected/example-atom.expected new file mode 100644 index 0000000..076d5d5 --- /dev/null +++ b/common/tests/expected/example-atom.expected @@ -0,0 +1 @@ +[42 42 42]] \ No newline at end of file diff --git a/common/tests/expected/fib.expected b/common/tests/expected/fib.expected new file mode 100644 index 0000000..6285d51 --- /dev/null +++ b/common/tests/expected/fib.expected @@ -0,0 +1 @@ +[1 1 2 3 5 8 13 21 34 55 89]] \ No newline at end of file diff --git a/common/tests/expected/hoon-alias.expected b/common/tests/expected/hoon-alias.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/hoon-alias.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/hoon-arithmetic.expected b/common/tests/expected/hoon-arithmetic.expected new file mode 100644 index 0000000..cb5711e --- /dev/null +++ b/common/tests/expected/hoon-arithmetic.expected @@ -0,0 +1 @@ +[42 42 42 42 42]] \ No newline at end of file diff --git a/common/tests/expected/hoon-ffi.expected b/common/tests/expected/hoon-ffi.expected new file mode 100644 index 0000000..faf6472 --- /dev/null +++ b/common/tests/expected/hoon-ffi.expected @@ -0,0 +1 @@ +[42 42 42 42]] \ No newline at end of file diff --git a/common/tests/expected/if-else.expected b/common/tests/expected/if-else.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/if-else.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/if-elseif-else.expected b/common/tests/expected/if-elseif-else.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/if-elseif-else.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/implicit-compose.expected b/common/tests/expected/implicit-compose.expected new file mode 100644 index 0000000..d2af0c6 --- /dev/null +++ b/common/tests/expected/implicit-compose.expected @@ -0,0 +1 @@ +1] \ No newline at end of file diff --git a/common/tests/expected/in-subj-call.expected b/common/tests/expected/in-subj-call.expected new file mode 100644 index 0000000..ff7067d --- /dev/null +++ b/common/tests/expected/in-subj-call.expected @@ -0,0 +1 @@ +[23 17 [[[8 [1 1 1] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 11.182 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 1.398 0 31] 9 2 10 [6 [0 125] 0 14] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 29] [11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 110 97 103 45 102 97 105 108 0] 9 2 0 1] 0 1] 0 0] 6 [5 [1 0] 0 28] [0 58] 9 2 10 [14 [8 [9 11.182 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [8 [9 357.877 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 0] 1 1] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 12] [10 [1 0 13] 0 12] 10 [3 9 2 10 [12 0 25] 0 1] 0 12] 0 1] 8 [1 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 7 [0 3] 8 [9 22.366 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 22.358 0 127] 9 23 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[6 [5 [1 0] 0 12] [1 0] 0 0] 8 [0 30] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] [8 [9 357.876 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 9 2 10 [13 8 [9 11.246 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 1.398 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 357.751 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 5 [8 [9 357.876 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 357.876 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 8 [8 [9 178.878 0 7] 9 4 10 [6 0 29] 0 2] 9 2 10 [6 0 28] 0 2] 0 1] [[8 [1 0] [1 8 [6 [3 0 6] [[8 [7 [0 7] 9 44.796 0 1] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 9 22.395 0 1] 9 2 10 [6 0 29] 0 2] 8 [7 [0 7] 9 44.796 0 1] 9 2 10 [6 0 14] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 29] [1 0] 6 [5 [0 28] 0 116] [[1 0] 0 117] 8 [9 2 10 [29 0 118] 0 1] 6 [6 [3 0 2] [1 1] 1 0] [9 2 10 [29 0 247] 0 3] 0 2] 9 2 0 1] 0 1] [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [0 29] 6 [5 [1 0] 0 29] [1 0] 9 2 10 [14 [8 [9 11.182 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 7 [9 22.366 0 1] 9 2 0 1] 0 2] 9 2 0 1] 7 [0 1] [1 [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 62] [[[0 28] 0 29] 1 0 0] 6 [5 [0 28] 0 248] [6 [5 [0 29] 0 249] [0 62] 10 [2 [0 28] 0 29] 0 62] 6 [8 [9 186 0 63] 9 2 10 [6 [0 60] 0 504] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 4.072] 0 4.076] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 186 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] [8 [1 0] [1 7 [10 [6 0 6] 0 1] 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [[1 0] 0 249] 6 [8 [9 186 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [9 2 10 [62 0 250] 0 1] 9 2 10 [62 0 251] 0 1] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 6 [8 [9 186 0 31] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [0 120] 0 25] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 13] [1 0] 6 [8 [9 186 0 31] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [0 27] 0 120] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [6 [5 [0 120] 0 488] [1 1] 1 0] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [6 [5 [0 120] 0 492] [1 1] 1 0] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] [[8 [1 1 1] [1 [8 [9 89.468 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 8 [9 24.058 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 8 [9 5.588 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 8 [9 22.366 0 1] 9 2 10 [6 [7 [0 3] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 7 [0 3] 7 [9 5.622 0 1] 9 2 0 1] 0 2] 0 2] 9 2 0 1] [1 [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [9 22.358 0 63] 9 4 10 [6 0 126] 0 2] 9 2 10 [6 [0 60] 7 [0 3] 8 [8 [9 178.878 0 63] 9 4 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 0 2] 0 1] [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [8 [9 178.878 0 63] 9 10 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 6 [5 [1 0] 0 2] [8 [8 [9 22.358 0 127] 9 10 10 [6 0 254] 0 2] 9 2 10 [6 0 124] 0 2] 8 [8 [9 22.358 0 127] 9 4 10 [6 0 254] 0 2] 9 2 10 [6 [0 124] 0 6] 0 2] 0 1] 8 [1 0] [1 8 [8 [8 [9 22.358 0 31] 9 22 10 [6 0 62] 0 2] 9 2 10 [6 0 14] 0 2] 6 [5 [1 0] 0 2] [1 0] 0 5] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 4 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 89.594 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 89.594 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 8 [9 22.494 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [7 [7 [9 5.622 0 1] 9 2 0 1] 9 2 0 1] [1 [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [[0 14] 1 0 0] 6 [5 [0 14] 0 124] [0 62] 6 [8 [9 186 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 124] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 2.036] 0 2.038] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 186 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [9 186 0 31] 9 2 10 [6 [0 124] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [9 186 0 31] 9 2 10 [6 [0 59] 0 124] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 500] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 502] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 7 [10 [6 8 [9 89.595 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 [0 60] 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0 0 0] [1 8 [8 [9 22.358 0 7] 9 4 10 [6 0 59] 0 2] 9 2 10 [6 [0 28] 0 58] 0 2] 0 1] [8 [1 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 101 99 114 101 109 101 110 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 6] [0 0] 8 [1 0] 8 [1 6 [5 [0 30] 4 0 6] [0 6] 9 2 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 50] 0 54] [1 8 [[8 [0 60] 9 2 10 [6 0 28] 0 2] 8 [0 61] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 1 1] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 105 118 105 100 101 45 98 121 45 122 101 114 111 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 357.877 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 3.061 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 24.058 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 89.594 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 89.594 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [6 [5 [0 12] 0 13] [1 1] 1 0] [6 [8 [1 6 [5 [1 0] 0 28] [1 0] 6 [6 [6 [5 [1 0] 0 29] [1 1] 1 0] [6 [9 2 10 [14 [8 [9 11.182 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 11.182 0 15] 9 2 10 [6 0 61] 0 2] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 48] 8 [1 0] 8 [0 14] 8 [1 6 [5 [1 0] 0 6] [8 [1 0] 8 [1 6 [5 [1 0] 0 62] [0 6] 9 2 10 [62 0 125] 10 [6 8 [9 22 0 255] 9 2 10 [6 [7 [0 3] 1 3] [0 14] 0 252] 0 2] 0 1] 9 2 0 1] 9 2 10 [14 [8 [9 1.398 0 63] 9 2 10 [6 [7 [0 3] 1 48] 7 [0 3] 8 [9 24.058 0 63] 9 2 10 [6 [0 14] 7 [0 3] 1 10] 0 2] 0 2] 0 14] 10 [6 8 [9 89.468 0 63] 9 2 10 [6 [0 14] 7 [0 3] 1 10] 0 2] 0 1] 9 2 0 1] 0 1] 8 [1 0 0] [1 8 [[6 [6 [3 0 12] [1 1] 1 0] [0 12] 0 0] 6 [6 [3 0 13] [1 1] 1 0] [0 13] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 3.176.496] 8 [1 0] 8 [0 14] 8 [1 6 [5 [1 0] 0 6] [8 [8 [9 22 0 63] 9 2 10 [6 [7 [0 3] 1 3] [7 [0 3] 1 48] 7 [0 3] 1 120] 0 2] 8 [1 6 [5 [1 0] 0 62] [0 6] 9 2 10 [62 0 125] 10 [6 8 [9 22 0 255] 9 2 10 [6 [7 [0 3] 1 3] [0 14] 0 252] 0 2] 0 1] 9 2 0 1] 8 [8 [9 24.058 0 63] 9 2 10 [6 [0 14] 7 [0 3] 1 16] 0 2] 8 [6 [8 [9 357.877 0 127] 9 2 10 [6 [0 6] 7 [0 3] 1 10] 0 2] [8 [9 1.398 0 127] 9 2 10 [6 [7 [0 3] 1 48] 0 6] 0 2] 8 [9 1.398 0 127] 9 2 10 [6 [7 [0 3] 1 87] 0 6] 0 2] 9 2 10 [14 [0 2] 0 62] 10 [6 8 [9 89.468 0 255] 9 2 10 [6 [0 62] 7 [0 3] 1 16] 0 2] 0 7] 9 2 0 1] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 9 2 10 [6 [8 [9 11.182 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 178.878 0 127] 9 11 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [7 [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 61] [0 6] 9 2 10 [61 8 [9 11.246 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] 11 [1.953.718.630 1 7.628.141 [0 7] 0] 0 1] 8 [1 0] [1 8 [7 [0 7] 1 1] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 1.398 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 357.751 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 357.876 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [6 [5 [1 0] 8 [9 357.876 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 1] 8 [9 4 0 7] 9 2 10 [6 [7 [0 3] 1 2] 7 [0 3] 9 2 10 [6 8 [9 11.182 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] 8 [1 0] [1 0 6] 0 1] [7 [8 [1 0 [1 1] 0] [1 8 [9 357.876 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 53] 7 [0 3] 8 [9 11.246 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 59] 0 2] 0 2] 0 1] 11 [1.953.718.630 1 7.632.227 [0 7] 0] 0 1] [8 [1 0] [1 8 [1 [6 [6 [3 0 14] [1 1] 1 0] [8 [9 5 0 1] 9 2 10 [6 [7 [0 3] 1 3.405.691.582] [7 [0 3] 1 32.767] 0 30] 0 2] 8 [8 [9 22 0 15] 9 2 10 [6 [7 [0 3] 1 5] [7 [0 3] 9 4 10 [14 0 28] 0 1] 7 [0 3] 9 4 10 [14 0 29] 0 1] 0 2] 8 [9 5 0 3] 9 2 10 [6 [7 [0 3] 1 3.735.928.559] [7 [0 3] 1 65.534] 0 6] 0 2] 8 [1 0 0 0] [1 8 [8 [9 22.394 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 8 [1 0] 8 [1 6 [5 [1 8] 0 6] [0 250] 8 [8 [9 764 0 511] 9 2 10 [6 [0 252] [0 30] 0 507] 0 2] 8 [8 [9 86 0 1.023] 9 2 10 [6 [7 [0 3] 8 [9 11.246 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 7 [0 3] 8 [9 357.876 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 0 2] 6 [5 [1 0] 0 2] [9 2 10 [124 4 0 508] 10 [6 4 0 30] 0 7] 0 2] 9 2 0 1] 0 1] 9 4 0 1] 0 1] 8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [1 0] 6 [5 [1 0] 0 61] [1 0] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 1.398 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 357.751 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 357.876 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [1 0] 6 [5 [1 0] 8 [9 357.876 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 8 [9 383 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 178.879 0 7] 9 2 10 [6 7 [0 3] 8 [9 1.375 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] [8 [1 0] [1 8 [9 22.394 0 7] 9 2 10 [6 [7 [0 3] 1 0] 0 14] 0 2] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 58] 0 2] 8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 59] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 89.468 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 89.594 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 89.594 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 29] [1 0] 6 [5 [0 28] 0 58] [[1 0] 0 58] 8 [9 2 10 [29 0 118] 0 1] 6 [6 [3 0 2] [1 1] 1 0] [9 2 10 [29 0 247] 0 3] 0 2] 9 2 0 1] 0 1] [[8 [1 0 0] [1 [8 [1 6 [5 [1 0] 0 29] [1 0] 8 [9 1.398 0 15] 9 2 10 [6 [0 244] 7 [0 3] 9 2 10 [29 0 59] 0 1] 0 2] 9 2 0 1] 8 [9 24.059 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 8 [1 0] 8 [1 6 [5 [0 6] 1 2] [8 [9 340 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 8 [[8 [9 357.876 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 124] 0 2] 8 [9 357.876 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 125] 0 2] 6 [5 [0 4] 0 5] [9 2 10 [30 [8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 252] 0 2] 8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 253] 0 2] 10 [6 4 0 14] 0 3] 8 [9 357.877 0 63] 9 2 10 [6 [0 12] 0 13] 0 2] 9 2 0 1] 0 1] 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0 0] 8 [[8 [9 89.468 0 7] 9 2 10 [6 [7 [0 3] 8 [9 11.182 0 7] 9 2 10 [6 7 [0 3] 8 [9 2.810 0 7] 9 2 10 [6 0 14] 0 2] 0 2] 7 [0 3] 1 2] 0 2] 1 0] 8 [8 [1 8 [8 [9 1.398 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 89.594 0 31] 9 2 10 [6 0 28] 0 2] 0 2] 8 [8 [9 4 0 63] 9 2 10 [6 [0 6] 0 6] 0 2] 6 [5 [0 60] 1 0] [6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [[0 6] 0 2] [0 61] 8 [9 4 0 127] 9 2 10 [6 [0 125] 0 125] 0 2] 6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [9 2 10 [6 [8 [9 11.182 0 127] 9 2 10 [6 0 124] 0 2] 0 6] 0 7] 9 2 10 [12 8 [9 11.182 0 127] 9 2 10 [6 0 124] 0 2] 0 7] 9 2 0 1] [0 4] 8 [9 3.061 0 31] 9 2 10 [6 [0 62] 0 13] 0 2] 0 1] 8 [1 0 0] [1 6 [8 [9 340 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [7 [8 [1 0 0 0] [1 8 [9 1.398 0 7] 9 2 10 [6 [7 [0 3] 8 [9 357.751 0 7] 9 2 10 [6 [7 [0 3] [0 12] 8 [9 22.394 0 7] 9 2 10 [6 [0 28] 0 58] 0 2] 0 59] 0 2] 0 58] 0 2] 0 1] 11 [1.953.718.630 1 7.627.107 [0 7] 0] 0 1] [[8 [1 0 0] [1 8 [8 [9 178.878 0 7] 9 10 10 [6 0 29] 0 2] 9 2 10 [6 0 28] 0 2] 0 1] [8 [1 0 0] [1 8 [[8 [9 89.598 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 89.598 0 7] 9 2 10 [6 0 29] 0 2] 6 [5 [0 4] 0 5] [8 [9 750 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 357.877 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [1 0] [0 29] 9 2 10 [28 8 [9 11.182 0 15] 9 2 10 [6 0 60] 0 2] 0 1] 9 2 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [6 [3 0 12] [1 1] 1 0] [6 [6 [3 0 13] [1 1] 1 0] [8 [9 357.877 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 1 0] 6 [6 [3 0 13] [1 1] 1 0] [1 1] 6 [5 [0 24] 0 26] [9 2 10 [6 [0 25] 0 27] 0 1] 9 2 10 [6 [0 24] 0 26] 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [9 686 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 2.798 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 0 1] [8 [1 0 0] [1 8 [8 [9 22.358 0 7] 9 10 10 [6 0 29] 0 2] 9 2 10 [6 0 28] 0 2] 0 1] [[8 [[7 [9 179.963 0 1] 9 2 0 1] 7 [9 179.963 0 1] 9 2 0 1] [1 8 [1 8 [[0 114] 0 118] [1 8 [[8 [0 124] 9 2 10 [6 0 28] 0 2] 8 [0 125] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [7 [[[7 [0 28] 9 2 0 1] 7 [0 28] 9 2 0 1] 1 0] 8 [0 2] [1 0 15] 0 1] [1 [1 [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] [7 [0 252] 9 2 0 1] 7 [0 253] 9 2 0 1] [1 6 [5 [1 0] 0 12] [[[0 26] 0 27] 1 0 0] 6 [5 [0 48] 0 26] [10 [5 0 27] 0 12] 6 [8 [0 62] 9 2 10 [6 [0 58] 0 112] 0 2] [8 [9 2 10 [12 0 50] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [6 0 2] 0 28] 10 [7 10 [6 0 11] 0 28] 0 2] 0 0] 8 [9 2 10 [12 0 51] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [7 0 2] 0 28] 10 [6 10 [7 0 10] 0 28] 0 2] 0 0] 0 1] [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 0 12] [1 0] 6 [5 [0 13] 0 48] [[1 0] 0 49] 6 [8 [0 62] 9 2 10 [6 [0 29] 0 112] 0 2] [9 2 10 [12 0 50] 0 1] 9 2 10 [12 0 51] 0 1] 0 1] [8 [1 0] [1 8 [[7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 8 [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [0 254] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [0 254] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 9 2 0 1] 0 1] 8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 8 [9 10 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] 0 1] 0 1] 0 1] [8 [1 1 1] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 3.061 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 4 0 7] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 89.468 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] 8 [9 1.398 0 7] 9 2 10 [6 [7 [0 3] 8 [9 357.876 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 117] 0 2] 7 [0 3] 8 [9 357.751 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 7 [0 3] 9 2 10 [13 0 27] 0 1] 0 2] 0 2] 0 1] 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 26] 7 [8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 0 6] [1 8 [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [1 0 0] [1 6 [8 [9 357.877 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [1 0 0] [1 8 [[8 [9 89.598 0 7] 9 2 10 [6 7 [0 3] 8 [9 89.598 0 7] 9 2 10 [6 0 28] 0 2] 0 2] 8 [9 89.598 0 7] 9 2 10 [6 7 [0 3] 8 [9 89.598 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 6 [5 [0 4] 0 5] [8 [9 750 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 357.877 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [[8 [8 [9 3.063 0 1] 10 [6 7 [0 3] 1 5] 0 2] 8 [1 0 0 0] [1 7 [10 [12 8 [9 357.876 0 59] 9 2 10 [6 [7 [0 3] 1 5] 0 28] 0 2] 0 1] 8 [8 [9 3.061 0 59] 9 2 10 [6 [0 58] 7 [0 3] 8 [9 22.394 0 59] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 0 2] 8 [8 [9 682 0 123] 9 2 10 [6 [7 [0 3] 8 [9 1.375 0 123] 9 2 10 [6 [7 [0 3] 1 3] 0 123] 0 2] 7 [0 3] 8 [9 374 0 123] 9 2 10 [6 [0 6] 7 [0 3] 1 0] 0 2] 0 2] 8 [8 [9 89.468 0 251] 9 2 10 [6 [0 250] 7 [0 3] 1 4] 0 2] 8 [0 124] 8 [1 3.432.918.353 461.845.907] 8 [8 [9 1.375 0 2.043] 9 2 10 [6 [7 [0 3] 1 5] 0 2.043] 0 2] 8 [0 30] 7 [10 [30 8 [0 30] 8 [1 6 [5 [1 0] 0 14] [0 6] 8 [8 [9 84 0 32.763] 9 2 10 [6 [7 [0 3] 8 [9 3.061 0 32.763] 9 2 10 [6 [0 510] 0 30] 0 2] 0 62] 0 2] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 508] 0 2] 0 2] 0 1] 7 [10 [2 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 6] 0 2] 0 1] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 509] 0 2] 0 2] 0 1] 7 [10 [14 8 [9 86 0 65.531] 9 2 10 [6 [0 30] 0 6] 0 2] 0 1] 7 [10 [14 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 13] 0 30] 0 2] 0 1] 7 [10 [14 8 [9 4 0 16.382] 9 2 10 [6 [7 [0 3] 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 30] 7 [0 3] 1 5] 0 2] 0 2] 7 [0 3] 1 3.864.292.196] 0 2] 0 1] 9 2 10 [14 8 [9 11.182 0 65.531] 9 2 10 [6 0 62] 0 2] 0 3] 9 2 0 1] 0 1] 8 [8 [9 11.178 0 8.187] 9 2 10 [6 [7 [0 3] 8 [9 4 0 8.187] 9 2 10 [6 [7 [0 3] 1 4] 0 126] 0 2] 0 254] 0 2] 8 [1 0] 8 [8 [9 350 0 32.763] 9 2 10 [6 [0 32.762] 7 [0 3] 1 3] 0 2] 7 [10 [254 6 [5 [1 3] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 357.751 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 16] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 2] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 357.751 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 2] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 357.751 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 1] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 11 [1.936.945.012 1 0] 0 254] 0 1] 7 [10 [254 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 65.530] 0 2] 0 1] 8 [1 [8 [9 5 0 1] 9 2 10 [6 0 1.022] 0 2] 8 [1 0] [1 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 2.246.822.507] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 13] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 3.266.489.909] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 0 6] 0 1] 9 4 0 1] 0 1] [[8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 117 98 116 114 97 99 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 12] 9 2 10 [6 [8 [9 11.182 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 11.182 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 13] 1 0] [1 1] 8 [1 6 [5 [0 29] 1 1] [0 28] 8 [9 2 10 [29 8 [9 89.468 0 15] 9 2 10 [6 [0 61] 7 [0 3] 1 2] 0 2] 0 1] 8 [8 [9 4 0 31] 9 2 10 [6 [0 6] 0 6] 0 2] 8 [8 [9 350 0 63] 9 2 10 [6 [0 253] 7 [0 3] 1 1] 0 2] 6 [5 [1 0] 0 2] [0 6] 7 [0 3] 8 [9 4 0 63] 9 2 10 [6 [0 6] 0 252] 0 2] 9 2 0 1] 0 1] 8 [1 0] [1 [8 [1 0 0] [1 8 [9 11 0 7] 9 2 10 [6 7 [0 3] 8 [9 1.398 0 31] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 1] [8 [1 0 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 59] 0 2] 8 [8 [9 89.594 0 63] 9 2 10 [6 7 [0 3] 8 [9 3.061 0 63] 9 2 10 [6 [0 126] 0 60] 0 2] 0 2] 8 [8 [9 24.058 0 127] 9 2 10 [6 [0 250] 0 6] 0 2] 8 [9 11 0 63] 9 2 10 [6 7 [0 3] 8 [9 11.198 0 255] 9 2 10 [6 [7 [0 3] 8 [9 357.751 0 255] 9 2 10 [6 [7 [0 3] [0 124] 0 2] 0 30] 0 2] 7 [0 3] 8 [9 11.246 0 255] 9 2 10 [6 [7 [0 3] [0 124] 8 [9 3.061 0 255] 9 2 10 [6 [0 14] 0 6] 0 2] 0 30] 0 2] 0 2] 0 2] 0 1] 8 [1 0] [1 8 [9 357.876 0 31] 9 2 10 [6 [0 62] 0 14] 0 2] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [1 0] 8 [1 6 [5 [1 0] 0 125] [1 0] 8 [9 1.398 0 63] 9 2 10 [6 [7 [0 3] 9 2 10 [125 0 251] 10 [6 4 0 6] 0 1] 7 [0 3] 8 [9 357.751 0 63] 9 2 10 [6 [7 [0 3] [0 28] 8 [9 4 0 63] 9 2 10 [6 [0 61] 0 14] 0 2] 7 [0 3] 8 [9 357.876 0 63] 9 2 10 [6 [7 [0 3] [0 28] 0 29] 0 506] 0 2] 0 2] 0 2] 9 2 0 1] 0 1] 506.013.904.830.974.705.962.590.204.844.663.393] 0]] \ No newline at end of file diff --git a/common/tests/expected/indexing-list.expected b/common/tests/expected/indexing-list.expected new file mode 100644 index 0000000..efeaf16 --- /dev/null +++ b/common/tests/expected/indexing-list.expected @@ -0,0 +1 @@ +100] \ No newline at end of file diff --git a/common/tests/expected/indexing-nested.expected b/common/tests/expected/indexing-nested.expected new file mode 100644 index 0000000..9f756f9 --- /dev/null +++ b/common/tests/expected/indexing-nested.expected @@ -0,0 +1 @@ +30] \ No newline at end of file diff --git a/common/tests/expected/indexing-tuple.expected b/common/tests/expected/indexing-tuple.expected new file mode 100644 index 0000000..53bef72 --- /dev/null +++ b/common/tests/expected/indexing-tuple.expected @@ -0,0 +1 @@ +[100 200 300]] \ No newline at end of file diff --git a/common/tests/expected/infix-arithmetic.expected b/common/tests/expected/infix-arithmetic.expected new file mode 100644 index 0000000..6a3ffca --- /dev/null +++ b/common/tests/expected/infix-arithmetic.expected @@ -0,0 +1 @@ +[42 252 0 6 42 42 42 42 0]] \ No newline at end of file diff --git a/common/tests/expected/infix-comparator.expected b/common/tests/expected/infix-comparator.expected new file mode 100644 index 0000000..c1571d0 --- /dev/null +++ b/common/tests/expected/infix-comparator.expected @@ -0,0 +1 @@ +[1 0 1 0 0 1]] \ No newline at end of file diff --git a/common/tests/expected/inline-lambda-call.expected b/common/tests/expected/inline-lambda-call.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/inline-lambda-call.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/inline-lambda-no-arg.expected b/common/tests/expected/inline-lambda-no-arg.expected new file mode 100644 index 0000000..d2af0c6 --- /dev/null +++ b/common/tests/expected/inline-lambda-no-arg.expected @@ -0,0 +1 @@ +1] \ No newline at end of file diff --git a/common/tests/expected/inline-point.expected b/common/tests/expected/inline-point.expected new file mode 100644 index 0000000..f254137 --- /dev/null +++ b/common/tests/expected/inline-point.expected @@ -0,0 +1 @@ +4] \ No newline at end of file diff --git a/common/tests/expected/kernel-prelude.expected b/common/tests/expected/kernel-prelude.expected new file mode 100644 index 0000000..bef6db9 --- /dev/null +++ b/common/tests/expected/kernel-prelude.expected @@ -0,0 +1 @@ +0] \ No newline at end of file diff --git a/common/tests/expected/let-edit.expected b/common/tests/expected/let-edit.expected new file mode 100644 index 0000000..d2af0c6 --- /dev/null +++ b/common/tests/expected/let-edit.expected @@ -0,0 +1 @@ +1] \ No newline at end of file diff --git a/common/tests/expected/let-inner-exp.expected b/common/tests/expected/let-inner-exp.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/let-inner-exp.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/lists-indexing.expected b/common/tests/expected/lists-indexing.expected new file mode 100644 index 0000000..a163309 --- /dev/null +++ b/common/tests/expected/lists-indexing.expected @@ -0,0 +1 @@ +[100 50 60]] \ No newline at end of file diff --git a/common/tests/expected/lists-nested.expected b/common/tests/expected/lists-nested.expected new file mode 100644 index 0000000..074f95a --- /dev/null +++ b/common/tests/expected/lists-nested.expected @@ -0,0 +1 @@ +[[1 0] [1 2 0] [1 2 3 0] [[1 2] [3 4] 0] [1 2 0] [3 4 5 0] 0]] \ No newline at end of file diff --git a/common/tests/expected/lists.expected b/common/tests/expected/lists.expected new file mode 100644 index 0000000..a2a8999 --- /dev/null +++ b/common/tests/expected/lists.expected @@ -0,0 +1 @@ +[[1 2 3 4 5 0] [6 7 8 0] [9 10 0] [11 0] 0]] \ No newline at end of file diff --git a/common/tests/expected/maps-char-del.expected b/common/tests/expected/maps-char-del.expected new file mode 100644 index 0000000..95654f7 --- /dev/null +++ b/common/tests/expected/maps-char-del.expected @@ -0,0 +1 @@ +[[[98 200] 0 [99 300] [[97 100] 0 0] 0] [[99 300] [[98 200] 0 0] 0] [[99 300] 0 0] [97 100] [[99 300] [[98 200] 0 0] 0] 0]] \ No newline at end of file diff --git a/common/tests/expected/maps-char-get.expected b/common/tests/expected/maps-char-get.expected new file mode 100644 index 0000000..bace6d1 --- /dev/null +++ b/common/tests/expected/maps-char-get.expected @@ -0,0 +1 @@ +[[0 100] [0 200] [0 300] 0]] \ No newline at end of file diff --git a/common/tests/expected/maps-char-has.expected b/common/tests/expected/maps-char-has.expected new file mode 100644 index 0000000..2aac410 --- /dev/null +++ b/common/tests/expected/maps-char-has.expected @@ -0,0 +1 @@ +[0 0 1]] \ No newline at end of file diff --git a/common/tests/expected/maps-char-literal.expected b/common/tests/expected/maps-char-literal.expected new file mode 100644 index 0000000..c007674 --- /dev/null +++ b/common/tests/expected/maps-char-literal.expected @@ -0,0 +1 @@ +[[[98 2] 0 [99 3] [[97 1] 0 0] 0] 0]] \ No newline at end of file diff --git a/common/tests/expected/maps-char-put.expected b/common/tests/expected/maps-char-put.expected new file mode 100644 index 0000000..1cfc087 --- /dev/null +++ b/common/tests/expected/maps-char-put.expected @@ -0,0 +1 @@ +[[[99 300] [[98 200] 0 [97 100] 0 0] 0] [[97 999] [[98 200] 0 [97 100] 0 0] 0] [120 42] 0 0]] \ No newline at end of file diff --git a/common/tests/expected/maps-del.expected b/common/tests/expected/maps-del.expected new file mode 100644 index 0000000..6f6dcaf --- /dev/null +++ b/common/tests/expected/maps-del.expected @@ -0,0 +1 @@ +[[[2 200] [[1 100] 0 0] [3 300] 0 0] [[3 300] [[2 200] 0 0] 0] [3 300] 0 0]] \ No newline at end of file diff --git a/common/tests/expected/maps-get-only.expected b/common/tests/expected/maps-get-only.expected new file mode 100644 index 0000000..bace6d1 --- /dev/null +++ b/common/tests/expected/maps-get-only.expected @@ -0,0 +1 @@ +[[0 100] [0 200] [0 300] 0]] \ No newline at end of file diff --git a/common/tests/expected/maps-get.expected b/common/tests/expected/maps-get.expected new file mode 100644 index 0000000..57bb4c5 --- /dev/null +++ b/common/tests/expected/maps-get.expected @@ -0,0 +1 @@ +[0 100]] \ No newline at end of file diff --git a/common/tests/expected/maps-has.expected b/common/tests/expected/maps-has.expected new file mode 100644 index 0000000..2aac410 --- /dev/null +++ b/common/tests/expected/maps-has.expected @@ -0,0 +1 @@ +[0 0 1]] \ No newline at end of file diff --git a/common/tests/expected/maps-literal.expected b/common/tests/expected/maps-literal.expected new file mode 100644 index 0000000..12017ea --- /dev/null +++ b/common/tests/expected/maps-literal.expected @@ -0,0 +1 @@ +[[[2 200] [[1 100] 0 0] 0] 0]] \ No newline at end of file diff --git a/common/tests/expected/maps-put.expected b/common/tests/expected/maps-put.expected new file mode 100644 index 0000000..d5987ac --- /dev/null +++ b/common/tests/expected/maps-put.expected @@ -0,0 +1 @@ +[[[3 300] [[2 200] [[1 100] 0 0] 0] 0] [[1 999] [[2 200] [[1 100] 0 0] 0] 0] [1 100] 0 0]] \ No newline at end of file diff --git a/common/tests/expected/maps-simple.expected b/common/tests/expected/maps-simple.expected new file mode 100644 index 0000000..23e452c --- /dev/null +++ b/common/tests/expected/maps-simple.expected @@ -0,0 +1 @@ +[[2 200] [[1 100] 0 0] 0]] \ No newline at end of file diff --git a/common/tests/expected/maps.expected b/common/tests/expected/maps.expected new file mode 100644 index 0000000..1dab9b1 --- /dev/null +++ b/common/tests/expected/maps.expected @@ -0,0 +1 @@ +[[[2 200] [[1 100] 0 0] 0] [[2 20] [[1 10] 0 0] [3 30] 0 0] [2 7.305.076] [[1 6.647.407] 0 0] 0]] \ No newline at end of file diff --git a/common/tests/expected/match-case.expected b/common/tests/expected/match-case.expected new file mode 100644 index 0000000..5ea173e --- /dev/null +++ b/common/tests/expected/match-case.expected @@ -0,0 +1 @@ +[1 84]] \ No newline at end of file diff --git a/common/tests/expected/match-option-none.expected b/common/tests/expected/match-option-none.expected new file mode 100644 index 0000000..79c9ce5 --- /dev/null +++ b/common/tests/expected/match-option-none.expected @@ -0,0 +1 @@ +99] \ No newline at end of file diff --git a/common/tests/expected/match-option.expected b/common/tests/expected/match-option.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/match-option.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/match-type.expected b/common/tests/expected/match-type.expected new file mode 100644 index 0000000..5ea173e --- /dev/null +++ b/common/tests/expected/match-type.expected @@ -0,0 +1 @@ +[1 84]] \ No newline at end of file diff --git a/common/tests/expected/multi-limb.expected b/common/tests/expected/multi-limb.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/multi-limb.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/op-overload.expected b/common/tests/expected/op-overload.expected new file mode 100644 index 0000000..2cbb476 --- /dev/null +++ b/common/tests/expected/op-overload.expected @@ -0,0 +1 @@ +[143 112]] \ No newline at end of file diff --git a/common/tests/expected/path-basic.expected b/common/tests/expected/path-basic.expected new file mode 100644 index 0000000..2a6fe13 --- /dev/null +++ b/common/tests/expected/path-basic.expected @@ -0,0 +1 @@ +[7.303.014 7.496.034 8.020.322 0]] \ No newline at end of file diff --git a/common/tests/expected/sets-del.expected b/common/tests/expected/sets-del.expected new file mode 100644 index 0000000..38826c9 --- /dev/null +++ b/common/tests/expected/sets-del.expected @@ -0,0 +1 @@ +[[2 [1 0 0] 3 0 0] [3 [2 0 0] 0] [3 0 0] 3 [1 [2 0 0] 0] 0]] \ No newline at end of file diff --git a/common/tests/expected/sets-get.expected b/common/tests/expected/sets-get.expected new file mode 100644 index 0000000..173c14d --- /dev/null +++ b/common/tests/expected/sets-get.expected @@ -0,0 +1 @@ +[[0 1] [0 2] 0]] \ No newline at end of file diff --git a/common/tests/expected/sets-has.expected b/common/tests/expected/sets-has.expected new file mode 100644 index 0000000..2aac410 --- /dev/null +++ b/common/tests/expected/sets-has.expected @@ -0,0 +1 @@ +[0 0 1]] \ No newline at end of file diff --git a/common/tests/expected/sets-put.expected b/common/tests/expected/sets-put.expected new file mode 100644 index 0000000..50e4a23 --- /dev/null +++ b/common/tests/expected/sets-put.expected @@ -0,0 +1 @@ +[[4 [2 [1 0 0] 3 0 0] 0] [1 [2 [1 0 0] 3 0 0] 0] 1 0 0]] \ No newline at end of file diff --git a/common/tests/expected/sets.expected b/common/tests/expected/sets.expected new file mode 100644 index 0000000..e0fdf92 --- /dev/null +++ b/common/tests/expected/sets.expected @@ -0,0 +1 @@ +[[1 0 0] [2 [1 0 0] 0] [2 [1 0 0] 3 0 0] [[3 4] 0 [1 2] 0 0] [3 5 0 4 0 0] 0 [1 2 0 0] 0 0]] \ No newline at end of file diff --git a/common/tests/expected/string-concat.expected b/common/tests/expected/string-concat.expected new file mode 100644 index 0000000..3b2286e --- /dev/null +++ b/common/tests/expected/string-concat.expected @@ -0,0 +1 @@ +121.404.708.502.361.365.413.651.816] \ No newline at end of file diff --git a/common/tests/expected/string-index.expected b/common/tests/expected/string-index.expected new file mode 100644 index 0000000..2873f87 --- /dev/null +++ b/common/tests/expected/string-index.expected @@ -0,0 +1 @@ +104] \ No newline at end of file diff --git a/common/tests/expected/string-lent.expected b/common/tests/expected/string-lent.expected new file mode 100644 index 0000000..cc649fe --- /dev/null +++ b/common/tests/expected/string-lent.expected @@ -0,0 +1 @@ +5] \ No newline at end of file diff --git a/common/tests/expected/string-literal.expected b/common/tests/expected/string-literal.expected new file mode 100644 index 0000000..5540392 --- /dev/null +++ b/common/tests/expected/string-literal.expected @@ -0,0 +1 @@ +478.560.413.032] \ No newline at end of file diff --git a/common/tests/expected/string-slice.expected b/common/tests/expected/string-slice.expected new file mode 100644 index 0000000..16a690c --- /dev/null +++ b/common/tests/expected/string-slice.expected @@ -0,0 +1 @@ +7.105.637] \ No newline at end of file diff --git a/common/tests/expected/struct-basic.expected b/common/tests/expected/struct-basic.expected new file mode 100644 index 0000000..5cda443 --- /dev/null +++ b/common/tests/expected/struct-basic.expected @@ -0,0 +1 @@ +[0 0]] \ No newline at end of file diff --git a/common/tests/expected/struct-field-access.expected b/common/tests/expected/struct-field-access.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/struct-field-access.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/struct-field-update-y.expected b/common/tests/expected/struct-field-update-y.expected new file mode 100644 index 0000000..397bc11 --- /dev/null +++ b/common/tests/expected/struct-field-update-y.expected @@ -0,0 +1 @@ +[42 99]] \ No newline at end of file diff --git a/common/tests/expected/struct-field-update.expected b/common/tests/expected/struct-field-update.expected new file mode 100644 index 0000000..79c9ce5 --- /dev/null +++ b/common/tests/expected/struct-field-update.expected @@ -0,0 +1 @@ +99] \ No newline at end of file diff --git a/common/tests/expected/struct-func-param.expected b/common/tests/expected/struct-func-param.expected new file mode 100644 index 0000000..9aa78ce --- /dev/null +++ b/common/tests/expected/struct-func-param.expected @@ -0,0 +1 @@ +42] \ No newline at end of file diff --git a/common/tests/expected/struct-func-simple.expected b/common/tests/expected/struct-func-simple.expected new file mode 100644 index 0000000..26cc6eb --- /dev/null +++ b/common/tests/expected/struct-func-simple.expected @@ -0,0 +1 @@ +[42 7]] \ No newline at end of file diff --git a/common/tests/expected/struct-nested-basic.expected b/common/tests/expected/struct-nested-basic.expected new file mode 100644 index 0000000..d2af0c6 --- /dev/null +++ b/common/tests/expected/struct-nested-basic.expected @@ -0,0 +1 @@ +1] \ No newline at end of file diff --git a/common/tests/expected/struct-nested-shallow.expected b/common/tests/expected/struct-nested-shallow.expected new file mode 100644 index 0000000..072cffb --- /dev/null +++ b/common/tests/expected/struct-nested-shallow.expected @@ -0,0 +1 @@ +[1 2]] \ No newline at end of file diff --git a/common/tests/expected/trait-basic.expected b/common/tests/expected/trait-basic.expected new file mode 100644 index 0000000..26cc6eb --- /dev/null +++ b/common/tests/expected/trait-basic.expected @@ -0,0 +1 @@ +[42 7]] \ No newline at end of file diff --git a/common/tests/expected/trait-multiple.expected b/common/tests/expected/trait-multiple.expected new file mode 100644 index 0000000..6d4a7d9 --- /dev/null +++ b/common/tests/expected/trait-multiple.expected @@ -0,0 +1 @@ +[59 98]] \ No newline at end of file diff --git a/common/tests/expected/trait-self.expected b/common/tests/expected/trait-self.expected new file mode 100644 index 0000000..6d4a7d9 --- /dev/null +++ b/common/tests/expected/trait-self.expected @@ -0,0 +1 @@ +[59 98]] \ No newline at end of file diff --git a/common/tests/expected/type-point-2.expected b/common/tests/expected/type-point-2.expected new file mode 100644 index 0000000..190f9fb --- /dev/null +++ b/common/tests/expected/type-point-2.expected @@ -0,0 +1 @@ +[[104 62] 50 8]] \ No newline at end of file diff --git a/common/tests/expected/type-point-3.expected b/common/tests/expected/type-point-3.expected new file mode 100644 index 0000000..7434464 --- /dev/null +++ b/common/tests/expected/type-point-3.expected @@ -0,0 +1 @@ +[[32 10] 42]] \ No newline at end of file diff --git a/common/tests/expected/type-point.expected b/common/tests/expected/type-point.expected new file mode 100644 index 0000000..9eada10 --- /dev/null +++ b/common/tests/expected/type-point.expected @@ -0,0 +1 @@ +[40 41 42 43]] \ No newline at end of file diff --git a/common/tests/expected/unary-parens.expected b/common/tests/expected/unary-parens.expected new file mode 100644 index 0000000..730d2a7 --- /dev/null +++ b/common/tests/expected/unary-parens.expected @@ -0,0 +1 @@ +70] \ No newline at end of file diff --git a/common/tests/expected/unary-sint.expected b/common/tests/expected/unary-sint.expected new file mode 100644 index 0000000..355e7c6 --- /dev/null +++ b/common/tests/expected/unary-sint.expected @@ -0,0 +1 @@ +259] \ No newline at end of file diff --git a/common/tests/expected/unary-tuple-2.expected b/common/tests/expected/unary-tuple-2.expected new file mode 100644 index 0000000..c17ebe4 --- /dev/null +++ b/common/tests/expected/unary-tuple-2.expected @@ -0,0 +1 @@ +[100 37]] \ No newline at end of file diff --git a/common/tests/expected/unary-tuple-3.expected b/common/tests/expected/unary-tuple-3.expected new file mode 100644 index 0000000..a3a6e7c --- /dev/null +++ b/common/tests/expected/unary-tuple-3.expected @@ -0,0 +1 @@ +[100 42 9]] \ No newline at end of file diff --git a/common/tests/expected/unary-unicode.expected b/common/tests/expected/unary-unicode.expected new file mode 100644 index 0000000..730d2a7 --- /dev/null +++ b/common/tests/expected/unary-unicode.expected @@ -0,0 +1 @@ +70] \ No newline at end of file diff --git a/common/tests/run-all-tests.sh b/common/tests/run-all-tests.sh new file mode 100644 index 0000000..f7933f3 --- /dev/null +++ b/common/tests/run-all-tests.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +# run-all-tests.sh - Run all Jock tests and report results. +# +# Usage: run-all-tests.sh [test-name ...] +# With no arguments, runs all tests in TEST_DIR. +# +# Environment: +# PARALLEL number of concurrent tests (default: 1 = sequential) +# TEST_DIR directory of .jock files +# +# Exit 0 if all tests pass, 1 if any fail. + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +TEST_DIR="${TEST_DIR:-$REPO_ROOT/crates/jockt/hoon/lib/tests}" +PARALLEL="${PARALLEL:-1}" + +# Temp dir to record failures (safe across parallel subshells). +FAIL_DIR=$(mktemp -d) +trap 'rm -rf "$FAIL_DIR"' EXIT + +run_one() { + local test_name="$1" + if bash "$SCRIPT_DIR/run-test.sh" "$test_name"; then + : + else + touch "$FAIL_DIR/$test_name.fail" + fi +} +export -f run_one +export SCRIPT_DIR + +# Build test list. +if [ $# -gt 0 ]; then + tests=("$@") +else + tests=() + for jock_file in "$TEST_DIR"/*.jock; do + tests+=("$(basename "$jock_file" .jock)") + done +fi + +if [ "$PARALLEL" -le 1 ]; then + # Sequential. + for test_name in "${tests[@]}"; do + run_one "$test_name" + done +else + # Parallel: cap at $PARALLEL concurrent jobs. + running=0 + for test_name in "${tests[@]}"; do + run_one "$test_name" & + running=$((running + 1)) + if [ $running -ge "$PARALLEL" ]; then + wait -n 2>/dev/null || wait # wait for any one job to finish + running=$((running - 1)) + fi + done + wait # wait for remaining +fi + +# Report. +fail_count=$(find "$FAIL_DIR" -name "*.fail" 2>/dev/null | wc -l | tr -d ' ') +pass_count=$(( ${#tests[@]} - fail_count )) + +echo "" +echo "Results: $pass_count passed, $fail_count failed" + +if [ "$fail_count" -gt 0 ]; then + echo "Failed tests:" + find "$FAIL_DIR" -name "*.fail" | sort | while read -r f; do + echo " - $(basename "$f" .fail)" + done + exit 1 +fi diff --git a/common/tests/run-test.sh b/common/tests/run-test.sh new file mode 100644 index 0000000..d319a2b --- /dev/null +++ b/common/tests/run-test.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +# run-test.sh - Run a single Jock test via jockc and check its output. +# +# Usage: run-test.sh +# +# Environment overrides: +# JOCKC path to jockc binary (default: /target/release/jockc) +# IMPORT_DIR path to hoon lib directory (default: /common/hoon/lib) +# TEST_DIR directory of .jock files (default: /crates/jockt/hoon/lib/tests) +# EXPECTED_DIR directory of .expected (default: /expected) +# TEST_TIMEOUT seconds before giving up (default: 60) +# +# Exit 0 = PASS, 1 = FAIL + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +JOCKC="${JOCKC:-$REPO_ROOT/target/release/jockc}" +IMPORT_DIR="${IMPORT_DIR:-$REPO_ROOT/common/hoon/lib}" +TEST_DIR="${TEST_DIR:-$REPO_ROOT/crates/jockt/hoon/lib/tests}" +EXPECTED_DIR="${EXPECTED_DIR:-$SCRIPT_DIR/expected}" +TIMEOUT="${TEST_TIMEOUT:-60}" + +test_name="${1:-}" +if [ -z "$test_name" ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +test_path="$TEST_DIR/$test_name" +expected_path="$EXPECTED_DIR/$test_name.expected" + +# Run jockc in background, streaming output to a temp file. +# jockc never exits cleanly (NockApp hang), so we poll for %nock and kill early. +tmpfile=$(mktemp) +trap 'rm -f "$tmpfile"' EXIT + +"$JOCKC" "$test_path" --import-dir "$IMPORT_DIR" >"$tmpfile" 2>&1 & +JOCK_PID=$! + +# Poll every 0.5s until [%nock appears (actual result) or timeout. +# We look for \[%nock (with bracket) to avoid matching the bare ~| %nock hint +# which fires early on CI (Linux) before computation completes. +max_checks=$((TIMEOUT * 2)) +checks=0 +while [ $checks -lt $max_checks ]; do + if tr -d '\0' < "$tmpfile" | grep -q '\[%nock' 2>/dev/null; then + sleep 0.5 # let the full %nock line flush before killing + break + fi + sleep 0.5 + checks=$((checks + 1)) +done + +# Kill jockc (it's either hung after output, or we timed out). +kill "$JOCK_PID" 2>/dev/null || true +wait "$JOCK_PID" 2>/dev/null || true + +# Read and clean output (strip null bytes first — jockc emits binary log data on Linux). +output=$(tr -d '\0' < "$tmpfile" | sed 's/\x1b\[[0-9;]*m//g') + +# Check if %nock stage was reached at all (hint or result). +# The bare ~| %nock hint fires at the start of nock:runner regardless of success. +nock_hint=$(printf '%s' "$output" | grep '%nock' | head -1 || true) +if [ -z "$nock_hint" ]; then + echo "FAIL [$test_name]: did not reach %nock" + printf '%s\n' "$output" | tail -5 | sed 's/^/ /' + exit 1 +fi + +# Extract the actual [%nock result] line (may be absent if program crashed inside runner). +nock_line=$(printf '%s' "$output" | grep '\[%nock' | head -1 || true) + +# Normalize: strip tag, collapse whitespace, trim. +nock_value=$(printf '%s' "$nock_line" \ + | sed 's/.*%nock//' \ + | tr -s ' \t' ' ' \ + | sed 's/^ //;s/ $//') + +# Tier 1: %nock reached — if no expected file, that's enough. +if [ ! -f "$expected_path" ]; then + echo "PASS [$test_name] (no expected file; %nock reached)" + exit 0 +fi + +# Tier 2: compare against expected output. +expected=$(cat "$expected_path") + +if [ "$nock_value" = "$expected" ]; then + echo "PASS [$test_name]" + exit 0 +else + echo "FAIL [$test_name]: output mismatch" + echo " expected: $expected" + echo " got: $nock_value" + exit 1 +fi diff --git a/common/tests/update-expected.sh b/common/tests/update-expected.sh new file mode 100644 index 0000000..9e7c4a0 --- /dev/null +++ b/common/tests/update-expected.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +# update-expected.sh - Regenerate all .expected files from current jockc output. +# +# Run this after compiler changes to update the expected baseline. +# Tests that don't reach %nock are skipped (no file written). +# +# Usage: update-expected.sh [test-name ...] +# With no arguments, updates all tests in TEST_DIR. + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +JOCKC="${JOCKC:-$REPO_ROOT/target/release/jockc}" +IMPORT_DIR="${IMPORT_DIR:-$REPO_ROOT/common/hoon/lib}" +TEST_DIR="${TEST_DIR:-$REPO_ROOT/crates/jockt/hoon/lib/tests}" +EXPECTED_DIR="${EXPECTED_DIR:-$SCRIPT_DIR/expected}" +TIMEOUT="${TEST_TIMEOUT:-60}" + +mkdir -p "$EXPECTED_DIR" + +pass=0 +skip=0 + +run_one() { + local test_name="$1" + local test_path="$TEST_DIR/$test_name" + + local tmpfile + tmpfile=$(mktemp) + + "$JOCKC" "$test_path" --import-dir "$IMPORT_DIR" >"$tmpfile" 2>&1 & + local JOCK_PID=$! + + # Poll every 0.5s until [%nock appears (actual result) or timeout. + # We look for \[%nock (with bracket) to avoid matching the bare ~| %nock hint + # which fires early on CI (Linux) before computation completes. + local max_checks=$((TIMEOUT * 2)) + local checks=0 + while [ $checks -lt $max_checks ]; do + if tr -d '\0' < "$tmpfile" | grep -q '\[%nock' 2>/dev/null; then + sleep 0.5 # let the full %nock line flush before killing + break + fi + sleep 0.5 + checks=$((checks + 1)) + done + + kill "$JOCK_PID" 2>/dev/null || true + wait "$JOCK_PID" 2>/dev/null || true + + local output + output=$(tr -d '\0' < "$tmpfile" | sed 's/\x1b\[[0-9;]*m//g') + rm -f "$tmpfile" + + # Check if %nock stage was reached at all (hint or result). + local nock_hint + nock_hint=$(printf '%s' "$output" | grep '%nock' | head -1 || true) + if [ -z "$nock_hint" ]; then + echo "SKIP [$test_name]: did not reach %nock" + skip=$((skip + 1)) + return + fi + + # Extract the actual [%nock result] line (may be absent if program crashed inside runner). + local nock_line + nock_line=$(printf '%s' "$output" | grep '\[%nock' | head -1 || true) + + local nock_value + nock_value=$(printf '%s' "$nock_line" \ + | sed 's/.*%nock//' \ + | tr -s ' \t' ' ' \ + | sed 's/^ //;s/ $//') + + printf '%s' "$nock_value" > "$EXPECTED_DIR/$test_name.expected" + local preview + preview=$(printf '%s' "$nock_value" | head -c 80) + echo "WROTE [$test_name]: $preview" + pass=$((pass + 1)) +} + +if [ $# -gt 0 ]; then + for name in "$@"; do + run_one "$name" + done +else + for jock_file in "$TEST_DIR"/*.jock; do + test_name="$(basename "$jock_file" .jock)" + run_one "$test_name" + done +fi + +echo "" +echo "Done: $pass expected files written, $skip tests skipped (no %nock output)" diff --git a/crates/jockc/Cargo.toml b/crates/jockc/Cargo.toml index 7f6be4e..3cd8398 100644 --- a/crates/jockc/Cargo.toml +++ b/crates/jockc/Cargo.toml @@ -7,6 +7,7 @@ edition.workspace = true nockapp = { workspace = true } nockvm = { workspace = true } nockvm_macros = { workspace = true } +either = "1" clap = { workspace = true, features = ["derive", "cargo", "color", "env"] } tokio = { workspace = true, features = ["sync"] } tracing = { workspace = true } diff --git a/crates/jockc/hoon/lib/runner.hoon b/crates/jockc/hoon/lib/runner.hoon index 70a9446..0bec07a 100644 --- a/crates/jockc/hoon/lib/runner.hoon +++ b/crates/jockc/hoon/lib/runner.hoon @@ -1,11 +1,11 @@ /+ jock :: -|_ libs=(map term cord) +|_ [libs=(map term cord) dbg=?] ++ parse |= =cord ^- (list token:jock) ~| %parse - (rash cord parse-tokens:~(. jock libs)) + (rash cord parse-tokens:~(. jock [libs dbg])) :: ++ jeam |= =cord @@ -14,7 +14,7 @@ =/ res=(unit jock:jock) %- mole |. - (jeam:~(. jock libs) cord) + (jeam:~(. jock [libs dbg]) cord) ?~ res *jock:jock u.res @@ -26,7 +26,7 @@ =/ res=(unit *) %- mole |. - (mint:~(. jock libs) cord) + (mint:~(. jock [libs dbg]) cord) ?~ res *nock:jock ;;(nock:jock u.res) @@ -38,7 +38,7 @@ =/ res=(unit jype:jock) %- mole |. - (jypist:~(. jock libs) cord) + (jypist:~(. jock [libs dbg]) cord) ?~ res *jype:jock u.res @@ -47,18 +47,20 @@ |= =cord ^- * ~| %nock + =/ nok (mint:~(. jock [libs dbg]) cord) =/ res=(unit *) %- mole |. - .*(%0 (mint:~(. jock libs) cord)) + .*(0 nok) ?~ res - *nock:jock + ~& %nock-crashed + 0 u.res :: ++ exec |= =cord ^- * - =/ nok (mint:~(. jock libs) cord) + =/ nok (mint:~(. jock [libs dbg]) cord) .*(0 +.nok) :: -- diff --git a/crates/jockc/hoon/main.hoon b/crates/jockc/hoon/main.hoon index f06e94f..7e545b4 100644 --- a/crates/jockc/hoon/main.hoon +++ b/crates/jockc/hoon/main.hoon @@ -6,7 +6,7 @@ +$ test-state [%0 ~] ++ moat (keep test-state) +$ cause - $% [%jock name=@t text=@t args=(list @) libs-list=(list (pair term cord))] + $% [%jock name=@t text=@t args=(list @) libs-list=(list (pair term cord)) dbg=?] == +$ effect ~ -- @@ -42,14 +42,15 @@ =/ args (turn args.cau (cury scot %ud)) =/ code (preprocess text.cau args) =/ libs `(map term cord)`(malt libs-list.cau) - ~& libs+[~(tap by libs)] + =/ dbg dbg.cau + ~& libs+(turn ~(tap by libs) |=([k=term v=cord] k)) ~& code+[code] - ~& parse+(parse:~(. runner libs) code) - ~& jeam+(jeam:~(. runner libs) code) - =/ res `*`(mint:~(. runner libs) code) + ~& parse+(parse:~(. runner [libs dbg]) code) + ~& jeam+(jeam:~(. runner [libs dbg]) code) + =/ res `*`(mint:~(. runner [libs dbg]) code) ~& mint+res - ~& jype+(jype:~(. runner libs) code) - ~& nock+(nock:~(. runner libs) code) + ~& jype+(jype:~(. runner [libs dbg]) code) + ~& nock+(nock:~(. runner [libs dbg]) code) [~ k] :: ++ preprocess diff --git a/crates/jockc/main.rs b/crates/jockc/main.rs index 86de4b6..c7672a6 100644 --- a/crates/jockc/main.rs +++ b/crates/jockc/main.rs @@ -2,8 +2,33 @@ use nockapp::driver::Operation; use nockapp::{kernel::boot, noun::slab::NounSlab}; use nockapp::{one_punch_driver, Noun, AtomExt}; use nockvm::noun::{Atom, D, T}; +use nockvm::jets::hot::HotEntry; +use nockvm::jets::math::{jet_add, jet_dec, jet_div, jet_dvr, jet_gte, jet_gth, jet_lte, jet_lth, jet_mod, jet_mul, jet_sub}; +use nockvm::jets::hash::jet_mug; +use nockvm::jets::sort::{jet_dor, jet_gor, jet_mor}; +use either::Either::{Left, Right}; use nockvm_macros::tas; +const K_136: either::Either<&'static [u8], (u64, u64)> = Right((tas!(b"k"), 136)); + +static JOCK_HOT_STATE: &[HotEntry] = &[ + (&[K_136, Left(b"add")], 1, jet_add), + (&[K_136, Left(b"dec")], 1, jet_dec), + (&[K_136, Left(b"div")], 1, jet_div), + (&[K_136, Left(b"dvr")], 1, jet_dvr), + (&[K_136, Left(b"gte")], 1, jet_gte), + (&[K_136, Left(b"gth")], 1, jet_gth), + (&[K_136, Left(b"lte")], 1, jet_lte), + (&[K_136, Left(b"lth")], 1, jet_lth), + (&[K_136, Left(b"mod")], 1, jet_mod), + (&[K_136, Left(b"mul")], 1, jet_mul), + (&[K_136, Left(b"sub")], 1, jet_sub), + (&[K_136, Left(b"mug")], 1, jet_mug), + (&[K_136, Left(b"dor")], 1, jet_dor), + (&[K_136, Left(b"gor")], 1, jet_gor), + (&[K_136, Left(b"mor")], 1, jet_mor), +]; + use clap::{arg, command, ColorChoice, Parser}; static KERNEL_JAM: &[u8] = include_bytes!(concat!(env!("CARGO_WORKSPACE_DIR"), "assets/jockc.jam")); @@ -37,13 +62,20 @@ struct TestCli { num_args = 1 )] lib_path: Option, + + #[arg( + long = "debug", + help = "Emit source location hints for crash traces", + default_value_t = false + )] + debug: bool, } #[tokio::main] async fn main() -> Result<(), Box> { let cli = TestCli::parse(); - let mut nockapp:nockapp::NockApp = boot::setup(KERNEL_JAM, Some(cli.boot.clone()), &[], "jockc", None).await?; + let mut nockapp:nockapp::NockApp = boot::setup(KERNEL_JAM, Some(cli.boot.clone()), JOCK_HOT_STATE, "jockc", None).await?; boot::init_default_tracing(&cli.boot.clone()); let mut slab:NounSlab = NounSlab::new(); @@ -58,6 +90,11 @@ async fn main() -> Result<(), Box> { .unwrap(); // Acquire file text. + let string = if string.ends_with(".jock") { + string.trim_end_matches(".jock").to_string() + } else { + string + }; println!("Reading file: {}.jock", string); let text = std::fs::read_to_string(format!("{}.jock", string)).expect("Unable to read file"); @@ -108,12 +145,16 @@ async fn main() -> Result<(), Box> { let texts = vec_to_hoon_tuple_list(&mut slab, lib_texts); + // Hoon loobean: %.y = 0, %.n = 1 + let dbg = if cli.debug { D(0) } else { D(1) }; + slab.modify(|_root| { vec![D(tas!(b"jock")), name.as_noun(), text.as_noun(), args, - texts] }); + texts, + dbg] }); slab }; diff --git a/crates/jockt/hoon/lib/test-jock.hoon b/crates/jockt/hoon/lib/test-jock.hoon index 1b30ace..f023485 100644 --- a/crates/jockt/hoon/lib/test-jock.hoon +++ b/crates/jockt/hoon/lib/test-jock.hoon @@ -74,7 +74,7 @@ :: /* test-fib %hoon /tests/lib/fib/hoon :: /* test-lists-indexing %hoon /tests/lib/lists-indexing/hoon :: -|_ libs=(map term cord) +|_ [libs=(map term cord) dbg=?] ++ list-jocks ^- (list [term @t]) :~ [%let-edit q.let-edit] :: 0 @@ -264,7 +264,7 @@ |= =cord ^- (list token:jock) ~| %parse - (rash cord parse-tokens:~(. jock libs)) + (rash cord parse-tokens:~(. jock [libs dbg])) :: ++ parse-all ^- (list (pair term (list token:jock))) @@ -280,7 +280,7 @@ =/ res=(unit jock:jock) %- mole |. - (jeam:~(. jock libs) cord) + (jeam:~(. jock [libs dbg]) cord) ?~ res *jock:jock u.res @@ -303,7 +303,7 @@ =/ res=(unit *) %- mole |. - (mint:~(. jock libs) cord) + (mint:~(. jock [libs dbg]) cord) ?~ res *nock:jock ;;(nock:jock u.res) @@ -326,7 +326,7 @@ =/ res=(unit jype:jock) %- mole |. - (jypist:~(. jock libs) cord) + (jypist:~(. jock [libs dbg]) cord) ?~ res *jype:jock u.res @@ -349,7 +349,7 @@ =/ res=(unit *) %- mole |. - .*(%0 (mint:~(. jock libs) cord)) + .*(%0 (mint:~(. jock [libs dbg]) cord)) ?~ res *nock:jock u.res diff --git a/crates/jockt/hoon/lib/tests/alias-basic.jock b/crates/jockt/hoon/lib/tests/alias-basic.jock new file mode 100644 index 0000000..bc9ecd5 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/alias-basic.jock @@ -0,0 +1,3 @@ +alias Number Real; +let x:Number = 42; +x diff --git a/crates/jockt/hoon/lib/tests/alias-chain.jock b/crates/jockt/hoon/lib/tests/alias-chain.jock new file mode 100644 index 0000000..da4c92f --- /dev/null +++ b/crates/jockt/hoon/lib/tests/alias-chain.jock @@ -0,0 +1,6 @@ +struct Point { x: Real, y: Real }; +alias Pt Point; +alias Vec Pt; +alias Point Vec; +let p = Point { x: 42, y: 7 }; +(p.x p.y) diff --git a/crates/jockt/hoon/lib/tests/alias-diamond.jock b/crates/jockt/hoon/lib/tests/alias-diamond.jock new file mode 100644 index 0000000..a5bee6a --- /dev/null +++ b/crates/jockt/hoon/lib/tests/alias-diamond.jock @@ -0,0 +1,5 @@ +struct Point { x: Real, y: Real }; +alias Pos Point; +alias Vec Pos; +let p = Vec { x: 42, y: 7 }; +p.x diff --git a/crates/jockt/hoon/lib/tests/alias-struct.jock b/crates/jockt/hoon/lib/tests/alias-struct.jock new file mode 100644 index 0000000..9bf6c81 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/alias-struct.jock @@ -0,0 +1,4 @@ +struct Point { x: Real, y: Real }; +alias Pt Point; +let p = Pt { x: 42, y: 7 }; +p.x diff --git a/crates/jockt/hoon/lib/tests/cast-as-wut-fail.jock b/crates/jockt/hoon/lib/tests/cast-as-wut-fail.jock new file mode 100644 index 0000000..a5fa21d --- /dev/null +++ b/crates/jockt/hoon/lib/tests/cast-as-wut-fail.jock @@ -0,0 +1,2 @@ +let x = (1 2); +x as? Atom diff --git a/crates/jockt/hoon/lib/tests/cast-as-wut.jock b/crates/jockt/hoon/lib/tests/cast-as-wut.jock new file mode 100644 index 0000000..840b236 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/cast-as-wut.jock @@ -0,0 +1,2 @@ +let x:@ = 42; +x as? Atom diff --git a/crates/jockt/hoon/lib/tests/cast-as-zap.jock b/crates/jockt/hoon/lib/tests/cast-as-zap.jock new file mode 100644 index 0000000..4be43af --- /dev/null +++ b/crates/jockt/hoon/lib/tests/cast-as-zap.jock @@ -0,0 +1,2 @@ +let x:@ = 42; +x as! Atom diff --git a/crates/jockt/hoon/lib/tests/cast-as.jock b/crates/jockt/hoon/lib/tests/cast-as.jock new file mode 100644 index 0000000..8818d07 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/cast-as.jock @@ -0,0 +1,4 @@ +struct Point { x: Real, y: Real }; +let p = Point { x: 42, y: 7 }; +let q = p as (Real Real); +q diff --git a/crates/jockt/hoon/lib/tests/chars-concat.jock b/crates/jockt/hoon/lib/tests/chars-concat.jock new file mode 100644 index 0000000..1e01c87 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/chars-concat.jock @@ -0,0 +1,4 @@ +// Chars concatenation via + +import hoon; +let c = 'foo' + 'bar'; +c diff --git a/crates/jockt/hoon/lib/tests/chars-index.jock b/crates/jockt/hoon/lib/tests/chars-index.jock new file mode 100644 index 0000000..5ab4e82 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/chars-index.jock @@ -0,0 +1,4 @@ +// Chars byte indexing: 'hello'[0] returns a one-byte Chars +import hoon; +let c = 'hello'; +c[0] diff --git a/crates/jockt/hoon/lib/tests/class-3d.jock b/crates/jockt/hoon/lib/tests/class-3d.jock new file mode 100644 index 0000000..d43ed8d --- /dev/null +++ b/crates/jockt/hoon/lib/tests/class-3d.jock @@ -0,0 +1,9 @@ +struct Vectre { x: Real, y: Real, z: Real }; +alias Point Vectre; +class Body(Vectre) { + getx(self: Vectre) -> Real { + self.x + } +}; +let p = Point { x: 10, y: 20, z: 30 }; +p.z diff --git a/crates/jockt/hoon/lib/tests/class-basic.jock b/crates/jockt/hoon/lib/tests/class-basic.jock new file mode 100644 index 0000000..9805b7d --- /dev/null +++ b/crates/jockt/hoon/lib/tests/class-basic.jock @@ -0,0 +1,8 @@ +struct PointState { x: Real, y: Real }; +class Point(PointState) { + getx(self: PointState) -> Real { + self.x + } +}; +let p = Point { x: 42, y: 7 }; +p diff --git a/crates/jockt/hoon/lib/tests/class-define.jock b/crates/jockt/hoon/lib/tests/class-define.jock new file mode 100644 index 0000000..01a178a --- /dev/null +++ b/crates/jockt/hoon/lib/tests/class-define.jock @@ -0,0 +1,7 @@ +struct PointState { x: Real, y: Real }; +class Point(PointState) { + getx(self: PointState) -> Real { + self.x + } +}; +0 diff --git a/crates/jockt/hoon/lib/tests/class-ops.jock b/crates/jockt/hoon/lib/tests/class-ops.jock index 1b504fe..e43a36a 100644 --- a/crates/jockt/hoon/lib/tests/class-ops.jock +++ b/crates/jockt/hoon/lib/tests/class-ops.jock @@ -1,39 +1,10 @@ -compose - class Point(x:@ y:@) { - add(p:(x:@ y:@)) -> Point { - (x + p.x - y + p.y) - } +// Test class method call returning parameter +struct PointState { x: Real, y: Real }; +class Point(PointState) { + echo(self: PointState, val: Real) -> Real { + val } -; - -let point_1 = Point(14 104); -point_1 = point_1.add(28 38); -(point_1.x() point_1.y()) - -/* -!= -=> mini=mini -=> - ^= door - |_ [x=@ y=@] - ++ add - |= p=[x=@ y=@] - [(add:mini x x.p) (add:mini y y.p)] - -- -=/ point-1 - ~(. door [14 104]) -=. point-1 ~(. door (add:point-1 [28 38])) -[+12 +13]:point-1 - -!= -=> mini=mini -=> - ^= door - |_ [x=@ y=@] - ++ add - |= p=[x=@ y=@] - [(add:mini x x.p) (add:mini y y.p)] - -- -~(. door [14 104]) -*/ +}; +let point1 = Point { x: 14, y: 104 }; +let result = point1.echo(42); +result diff --git a/crates/jockt/hoon/lib/tests/class-state.jock b/crates/jockt/hoon/lib/tests/class-state.jock index e1d1c86..53f5397 100644 --- a/crates/jockt/hoon/lib/tests/class-state.jock +++ b/crates/jockt/hoon/lib/tests/class-state.jock @@ -1,14 +1,13 @@ -compose - class Point(x:@ y:@) { - inc(q:@) -> @ { - +(q) - } +// Test class state access +struct PointState { x: Real, y: Real }; +class Point(PointState) { + inc(self: PointState, q: Real) -> Real { + +(q) } -; - -let point_1 = Point(70 80); -let point_2 = Point(90 100); -((point_2.x() point_2.y()) (point_1.x() point_1.y())) +}; +let point1 = Point { x: 70, y: 80 }; +let point2 = Point { x: 90, y: 100 }; +((point2.x point2.y) (point1.x point1.y)) /* != diff --git a/crates/jockt/hoon/lib/tests/coalesce-fallback.jock b/crates/jockt/hoon/lib/tests/coalesce-fallback.jock new file mode 100644 index 0000000..773c804 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/coalesce-fallback.jock @@ -0,0 +1,2 @@ +let x = (1 2); +(x as? Atom) ?? 99 diff --git a/crates/jockt/hoon/lib/tests/coalesce.jock b/crates/jockt/hoon/lib/tests/coalesce.jock new file mode 100644 index 0000000..4d979f2 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/coalesce.jock @@ -0,0 +1,2 @@ +let x:@ = 42; +(x as? Atom) ?? 0 diff --git a/crates/jockt/hoon/lib/tests/implicit-compose.jock b/crates/jockt/hoon/lib/tests/implicit-compose.jock new file mode 100644 index 0000000..517a5e0 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/implicit-compose.jock @@ -0,0 +1,3 @@ +struct Point { x: Real, y: Real }; +let p = Point { x: 1, y: 2 }; +p.x diff --git a/crates/jockt/hoon/lib/tests/indexing-list.jock b/crates/jockt/hoon/lib/tests/indexing-list.jock new file mode 100644 index 0000000..4daf509 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/indexing-list.jock @@ -0,0 +1,2 @@ +let a = [100 200 300 400 500]; +a[0] diff --git a/crates/jockt/hoon/lib/tests/indexing-nested.jock b/crates/jockt/hoon/lib/tests/indexing-nested.jock new file mode 100644 index 0000000..1c9dca5 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/indexing-nested.jock @@ -0,0 +1,4 @@ +// Test nested list indexing +let b:List(List(@)) = [[10 20] [30 40] [50 60]]; +let inner:List(@) = b[1]; +inner[0] diff --git a/crates/jockt/hoon/lib/tests/indexing-tuple.jock b/crates/jockt/hoon/lib/tests/indexing-tuple.jock new file mode 100644 index 0000000..cbc4c99 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/indexing-tuple.jock @@ -0,0 +1,2 @@ +let t = (100 200 300); +(t[0] t[1] t[2]) diff --git a/crates/jockt/hoon/lib/tests/kernel-prelude.jock b/crates/jockt/hoon/lib/tests/kernel-prelude.jock new file mode 100644 index 0000000..86cd856 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/kernel-prelude.jock @@ -0,0 +1,17 @@ +alias Wire Path; + +struct Input { eny: Atom, our: Hex, now: Date, cause: * }; + +trait Kernel { load; peek; poke; }; + +struct CounterState { count: Real }; + +class Counter(CounterState) impl Kernel { + load(self: CounterState, old: CounterState) -> CounterState { old } + peek(self: CounterState, path: Path) -> ??* { ~ } + poke(self: CounterState, input: Input) -> * { + ( ~ CounterState { count: self.count + 1 } ) + } +}; + +Counter { count: 0 } diff --git a/crates/jockt/hoon/lib/tests/lists-nested.jock b/crates/jockt/hoon/lib/tests/lists-nested.jock index b1fbf2e..605e98b 100644 --- a/crates/jockt/hoon/lib/tests/lists-nested.jock +++ b/crates/jockt/hoon/lib/tests/lists-nested.jock @@ -1,11 +1,10 @@ +// Test nested lists and tuples in lists let a:List(@) = [1]; - let b:List(@) = [1 2]; - let c:List(@) = [1 2 3]; - let d:List((@ @)) = [(1 2) (3 4)]; -let e:List((@ List(@))) = [(1 [2]) (3 [4 5])]; +// Test nested lists (list of list) +let e:List(List(@)) = [[1 2] [3 4 5]]; (a b c d e) diff --git a/crates/jockt/hoon/lib/tests/maps-char-del.jock b/crates/jockt/hoon/lib/tests/maps-char-del.jock new file mode 100644 index 0000000..577fa61 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-char-del.jock @@ -0,0 +1,8 @@ +// Test map del with char keys +let a = {'a' -> 100, 'b' -> 200, 'c' -> 300}; + +let b = a[!'a']; +let c = b[!'b']; +let d = a[!'z']; + +(a b c d) diff --git a/crates/jockt/hoon/lib/tests/maps-char-get.jock b/crates/jockt/hoon/lib/tests/maps-char-get.jock new file mode 100644 index 0000000..82ecf04 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-char-get.jock @@ -0,0 +1,4 @@ +// Test map get with char keys +import hoon; +let m = {'a' -> 100, 'b' -> 200, 'c' -> 300}; +(m['a'] m['b'] m['c'] m['z']) diff --git a/crates/jockt/hoon/lib/tests/maps-char-has.jock b/crates/jockt/hoon/lib/tests/maps-char-has.jock new file mode 100644 index 0000000..6ca3e65 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-char-has.jock @@ -0,0 +1,8 @@ +// Test map has with char keys +let a = {'a' -> 100, 'b' -> 200, 'c' -> 300}; + +let b = a['a'?]; +let c = a['b'?]; +let d = a['z'?]; + +(b c d) diff --git a/crates/jockt/hoon/lib/tests/maps-char-literal.jock b/crates/jockt/hoon/lib/tests/maps-char-literal.jock new file mode 100644 index 0000000..8e17387 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-char-literal.jock @@ -0,0 +1,4 @@ +// Test map literal with char keys +let a = {'a' -> 1, 'b' -> 2, 'c' -> 3}; +let b = {->}; +(a b) diff --git a/crates/jockt/hoon/lib/tests/maps-char-put.jock b/crates/jockt/hoon/lib/tests/maps-char-put.jock new file mode 100644 index 0000000..17cb054 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-char-put.jock @@ -0,0 +1,17 @@ +// Test map put with char keys +let a = {'a' -> 100, 'b' -> 200}; + +// Add new key +a['c'] = 300; +let b = a; + +// Update existing key +let a = {'a' -> 100, 'b' -> 200}; +a['a'] = 999; +let c = a; + +// Put into empty map +let d = {->}; +d['x'] = 42; + +(b c d) diff --git a/crates/jockt/hoon/lib/tests/maps-del.jock b/crates/jockt/hoon/lib/tests/maps-del.jock new file mode 100644 index 0000000..8fd4689 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-del.jock @@ -0,0 +1,11 @@ +// Test map del operation +let a = {1 -> 100, 2 -> 200, 3 -> 300}; + +// Delete existing key +let b = a[!1]; +let c = b[!2]; + +// Delete missing key +//let d = a.[!999]; + +(a b c) diff --git a/crates/jockt/hoon/lib/tests/maps-get-only.jock b/crates/jockt/hoon/lib/tests/maps-get-only.jock new file mode 100644 index 0000000..4535667 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-get-only.jock @@ -0,0 +1,4 @@ +// Test map bracket indexing: existing keys and missing key +import hoon; +let m: Map(@, @) = {1 -> 100, 2 -> 200, 3 -> 300}; +(m[1] m[2] m[3] m[999]) diff --git a/crates/jockt/hoon/lib/tests/maps-get.jock b/crates/jockt/hoon/lib/tests/maps-get.jock new file mode 100644 index 0000000..27c8d41 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-get.jock @@ -0,0 +1,3 @@ +import hoon; +let m: Map(@, @) = {1 -> 100, 2 -> 200}; +m[1] diff --git a/crates/jockt/hoon/lib/tests/maps-has.jock b/crates/jockt/hoon/lib/tests/maps-has.jock new file mode 100644 index 0000000..2786550 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-has.jock @@ -0,0 +1,11 @@ +// Test map has operation +let a = {1 -> 100, 2 -> 200, 3 -> 300}; + +// Has existing key +let b = a[1?]; +let c = a[2?]; + +// Has missing key +let d = a[999?]; + +(b c d) diff --git a/crates/jockt/hoon/lib/tests/maps-literal.jock b/crates/jockt/hoon/lib/tests/maps-literal.jock new file mode 100644 index 0000000..8ead82a --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-literal.jock @@ -0,0 +1,5 @@ +// Test basic map literals only +let a = {1 -> 100, 2 -> 200}; +let b = {->}; + +(a b) diff --git a/crates/jockt/hoon/lib/tests/maps-put.jock b/crates/jockt/hoon/lib/tests/maps-put.jock new file mode 100644 index 0000000..63704c6 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-put.jock @@ -0,0 +1,17 @@ +// Test map put operation +let a = {1 -> 100, 2 -> 200}; + +// Add new key +a[3] = 300; +let b = a; + +// Update existing key (start fresh) +let a = {1 -> 100, 2 -> 200}; +a[1] = 999; +let c = a; + +// Put into empty map +let d = {->}; +d[1] = 100; + +(b c d) diff --git a/crates/jockt/hoon/lib/tests/maps-simple.jock b/crates/jockt/hoon/lib/tests/maps-simple.jock new file mode 100644 index 0000000..0ecfe2c --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps-simple.jock @@ -0,0 +1,4 @@ +// Minimal map test +let a = {1 -> 100}; +a[2] = 200; +a diff --git a/crates/jockt/hoon/lib/tests/maps.jock b/crates/jockt/hoon/lib/tests/maps.jock new file mode 100644 index 0000000..fd2ccaa --- /dev/null +++ b/crates/jockt/hoon/lib/tests/maps.jock @@ -0,0 +1,7 @@ +let a = {1 -> 100, 2 -> 200}; + +let b:Map(@, @) = {1 -> 10, 2 -> 20, 3 -> 30}; + +let c = {1 -> "one", 2 -> "two"}; + +(a b c) diff --git a/crates/jockt/hoon/lib/tests/match-option-none.jock b/crates/jockt/hoon/lib/tests/match-option-none.jock new file mode 100644 index 0000000..e52b245 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/match-option-none.jock @@ -0,0 +1,5 @@ +let x = (1 2); +switch (x as? Atom) { + ~ -> 99; + v -> v; +} diff --git a/crates/jockt/hoon/lib/tests/match-option.jock b/crates/jockt/hoon/lib/tests/match-option.jock new file mode 100644 index 0000000..9f1f38f --- /dev/null +++ b/crates/jockt/hoon/lib/tests/match-option.jock @@ -0,0 +1,5 @@ +let x:@ = 42; +switch (x as? Atom) { + ~ -> 0; + v -> v; +} diff --git a/crates/jockt/hoon/lib/tests/op-overload.jock b/crates/jockt/hoon/lib/tests/op-overload.jock new file mode 100644 index 0000000..715f9c8 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/op-overload.jock @@ -0,0 +1,10 @@ +trait Add(+) { add; }; +trait Sub(-) { sub; }; +struct PointState { x: Real, y: Real }; +class Point(PointState) impl Add, Sub { + add(self: Self, p: Self) -> Self { ( self.x + p.x self.y + p.y ) } + sub(self: Self, p: Self) -> Self { ( self.x - p.x self.y - p.y ) } +}; +let p = Point { x: 101, y: 105 }; +let q = Point { x: 42, y: 7 }; +p + q diff --git a/crates/jockt/hoon/lib/tests/path-basic.jock b/crates/jockt/hoon/lib/tests/path-basic.jock new file mode 100644 index 0000000..6bca9e3 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/path-basic.jock @@ -0,0 +1,2 @@ +let p = /foo/bar/baz; +p diff --git a/crates/jockt/hoon/lib/tests/sets-del.jock b/crates/jockt/hoon/lib/tests/sets-del.jock new file mode 100644 index 0000000..0d53ab8 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/sets-del.jock @@ -0,0 +1,11 @@ +// Test set del operation +let a:Set(@) = {1, 2, 3}; + +// Delete existing element +let b = a[!1]; +let c = b[!2]; + +// Delete missing element (no-op) +let d = a[!999]; + +(a b c d) diff --git a/crates/jockt/hoon/lib/tests/sets-get.jock b/crates/jockt/hoon/lib/tests/sets-get.jock new file mode 100644 index 0000000..ee8a693 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/sets-get.jock @@ -0,0 +1,11 @@ +// Test set get operation (returns Option) +let a:Set(@) = {1, 2, 3}; + +// Get existing element (returns [~ val]) +let b = a[1]; +let c = a[2]; + +// Get missing element (returns ~) +let d = a[999]; + +(b c d) diff --git a/crates/jockt/hoon/lib/tests/sets-has.jock b/crates/jockt/hoon/lib/tests/sets-has.jock new file mode 100644 index 0000000..a7bb155 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/sets-has.jock @@ -0,0 +1,11 @@ +// Test set has operation +let a:Set(@) = {1, 2, 3}; + +// Has existing element +let b = a[1?]; +let c = a[2?]; + +// Has missing element +let d = a[999?]; + +(b c d) diff --git a/crates/jockt/hoon/lib/tests/sets-put.jock b/crates/jockt/hoon/lib/tests/sets-put.jock new file mode 100644 index 0000000..1c41b78 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/sets-put.jock @@ -0,0 +1,17 @@ +// Test set put operation +let a:Set(@) = {1, 2, 3}; + +// Add new element +a[] = 4; +let b = a; + +// Start fresh, add existing (idempotent) +let a:Set(@) = {1, 2, 3}; +a[] = 1; +let c = a; + +// Put into empty set +let d:Set(@) = {}; +d[] = 1; + +(b c d) diff --git a/crates/jockt/hoon/lib/tests/string-concat.jock b/crates/jockt/hoon/lib/tests/string-concat.jock new file mode 100644 index 0000000..e656334 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/string-concat.jock @@ -0,0 +1,4 @@ +// String concatenation via + +import hoon; +let s = "hello" + " " + "world"; +s diff --git a/crates/jockt/hoon/lib/tests/string-index.jock b/crates/jockt/hoon/lib/tests/string-index.jock new file mode 100644 index 0000000..ea177d0 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/string-index.jock @@ -0,0 +1,4 @@ +// String byte indexing: s[i] returns a one-byte String +import hoon; +let s = "hello"; +s[0] diff --git a/crates/jockt/hoon/lib/tests/string-lent.jock b/crates/jockt/hoon/lib/tests/string-lent.jock new file mode 100644 index 0000000..ed17e8c --- /dev/null +++ b/crates/jockt/hoon/lib/tests/string-lent.jock @@ -0,0 +1,4 @@ +// lent on a String returns byte count +import hoon; +let s = "hello"; +lent(s) diff --git a/crates/jockt/hoon/lib/tests/string-literal.jock b/crates/jockt/hoon/lib/tests/string-literal.jock new file mode 100644 index 0000000..db7114b --- /dev/null +++ b/crates/jockt/hoon/lib/tests/string-literal.jock @@ -0,0 +1,4 @@ +// String literal test: "hello" compiles to a cord +import hoon; +let s = "hello"; +s diff --git a/crates/jockt/hoon/lib/tests/string-slice.jock b/crates/jockt/hoon/lib/tests/string-slice.jock new file mode 100644 index 0000000..a7508d9 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/string-slice.jock @@ -0,0 +1,4 @@ +// String byte slicing: s[i:j] +import hoon; +let s = "hello"; +s[1:4] diff --git a/crates/jockt/hoon/lib/tests/struct-basic.jock b/crates/jockt/hoon/lib/tests/struct-basic.jock new file mode 100644 index 0000000..e725a5b --- /dev/null +++ b/crates/jockt/hoon/lib/tests/struct-basic.jock @@ -0,0 +1,2 @@ +struct Point { x: Real, y: Real }; +Point diff --git a/crates/jockt/hoon/lib/tests/struct-field-access.jock b/crates/jockt/hoon/lib/tests/struct-field-access.jock new file mode 100644 index 0000000..7feb3b3 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/struct-field-access.jock @@ -0,0 +1,3 @@ +struct Point { x: Real, y: Real }; +let p = Point { x: 42, y: 7 }; +p.x diff --git a/crates/jockt/hoon/lib/tests/struct-field-update-y.jock b/crates/jockt/hoon/lib/tests/struct-field-update-y.jock new file mode 100644 index 0000000..f19056e --- /dev/null +++ b/crates/jockt/hoon/lib/tests/struct-field-update-y.jock @@ -0,0 +1,4 @@ +struct Point { x: Real, y: Real }; +let p = Point { x: 42, y: 7 }; +p.y = 99; +(p.x p.y) diff --git a/crates/jockt/hoon/lib/tests/struct-field-update.jock b/crates/jockt/hoon/lib/tests/struct-field-update.jock new file mode 100644 index 0000000..d9a627e --- /dev/null +++ b/crates/jockt/hoon/lib/tests/struct-field-update.jock @@ -0,0 +1,4 @@ +struct Point { x: Real, y: Real }; +let p = Point { x: 42, y: 7 }; +p.x = 99; +p.x diff --git a/crates/jockt/hoon/lib/tests/struct-func-param.jock b/crates/jockt/hoon/lib/tests/struct-func-param.jock new file mode 100644 index 0000000..50a01f5 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/struct-func-param.jock @@ -0,0 +1,6 @@ +struct Point { x: Real, y: Real }; +func getx(p: Point) -> Real { + p.x +}; +let pt = Point { x: 42, y: 7 }; +getx(pt) diff --git a/crates/jockt/hoon/lib/tests/struct-func-simple.jock b/crates/jockt/hoon/lib/tests/struct-func-simple.jock new file mode 100644 index 0000000..501160f --- /dev/null +++ b/crates/jockt/hoon/lib/tests/struct-func-simple.jock @@ -0,0 +1,6 @@ +struct Point { x: Real, y: Real }; +func identity(p: Point) -> Point { + p +}; +let pt = Point { x: 42, y: 7 }; +identity(pt) diff --git a/crates/jockt/hoon/lib/tests/struct-nested-basic.jock b/crates/jockt/hoon/lib/tests/struct-nested-basic.jock new file mode 100644 index 0000000..ce0585a --- /dev/null +++ b/crates/jockt/hoon/lib/tests/struct-nested-basic.jock @@ -0,0 +1,4 @@ +struct Point { x: Real, y: Real }; +struct Rect { origin: Point, size: Point }; +let r = Rect { origin: Point { x: 1, y: 2 }, size: Point { x: 10, y: 5 } }; +r.origin.x diff --git a/crates/jockt/hoon/lib/tests/struct-nested-shallow.jock b/crates/jockt/hoon/lib/tests/struct-nested-shallow.jock new file mode 100644 index 0000000..2a87af4 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/struct-nested-shallow.jock @@ -0,0 +1,4 @@ +struct Point { x: Real, y: Real }; +struct Rect { origin: Point, size: Point }; +let r = Rect { origin: Point { x: 1, y: 2 }, size: Point { x: 10, y: 5 } }; +r.origin diff --git a/crates/jockt/hoon/lib/tests/trait-basic.jock b/crates/jockt/hoon/lib/tests/trait-basic.jock new file mode 100644 index 0000000..ca0ef04 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/trait-basic.jock @@ -0,0 +1,8 @@ +trait Arithmetic { add; neg; }; +struct PointState { x: Real, y: Real }; +class Point(PointState) impl Arithmetic { + add(self: PointState) -> Real { self.x } + neg(self: PointState) -> Real { self.y } +}; +let p = Point { x: 42, y: 7 }; +p diff --git a/crates/jockt/hoon/lib/tests/trait-multiple.jock b/crates/jockt/hoon/lib/tests/trait-multiple.jock new file mode 100644 index 0000000..8cfccfa --- /dev/null +++ b/crates/jockt/hoon/lib/tests/trait-multiple.jock @@ -0,0 +1,11 @@ +trait Arithmetic { add; neg; }; +trait Subtraction { sub; }; +struct PointState { x: Real, y: Real }; +class Point(PointState) impl Arithmetic, Subtraction { + add(self: PointState, p:PointState) -> PointState { ( self.x + p.x self.y + p.y ) } + neg(self: PointState) -> Real { self.y } + sub(self: PointState, p:PointState) -> PointState { ( self.x - p.x self.y - p.y ) } +}; +let p = Point { x: 101, y: 105 }; +let q = Point { x: 42, y: 7 }; +p.sub(q) diff --git a/crates/jockt/hoon/lib/tests/trait-self.jock b/crates/jockt/hoon/lib/tests/trait-self.jock new file mode 100644 index 0000000..6edf27f --- /dev/null +++ b/crates/jockt/hoon/lib/tests/trait-self.jock @@ -0,0 +1,11 @@ +trait Arithmetic { add; neg; }; +trait Subtraction { sub; }; +struct PointState { x: Real, y: Real }; +class Point(PointState) impl Arithmetic, Subtraction { + add(self: Self, p: Self) -> Self { ( self.x + p.x self.y + p.y ) } + neg(self: Self) -> Real { self.y } + sub(self: Self, p: Self) -> Self { ( self.x - p.x self.y - p.y ) } +}; +let p = Point { x: 101, y: 105 }; +let q = Point { x: 42, y: 7 }; +p.sub(q) diff --git a/crates/jockt/hoon/lib/tests/type-point-2.jock b/crates/jockt/hoon/lib/tests/type-point-2.jock index f19a125..465c2c1 100644 --- a/crates/jockt/hoon/lib/tests/type-point-2.jock +++ b/crates/jockt/hoon/lib/tests/type-point-2.jock @@ -1,71 +1,16 @@ -compose - class Point(x:Uint y:Uint) { - add(p:(x:Uint y:Uint)) -> Point { - (x + p.x - y + p.y) - } - sub(p:(x:Uint y:Uint)) -> Point { - (x - p.x - y - p.y) - } +// Test class with multiple methods accessing self fields +struct PointState { x: Real, y: Real }; +class Point(PointState) { + getx(self: PointState) -> Real { + self.x } -; + gety(self: PointState) -> Real { + self.y + } +}; -let point_1 = Point(104 124); -point_1 = point_1.add(38 38); -let point_2 = Point(30 40); -point_2 = point_2.add(212 302); -point_1 = point_1.sub(100 20); -( (point_1.x() point_1.y()) - (point_2.x() point_2.y()) +let point1 = Point { x: 104, y: 62 }; +let point2 = Point { x: 50, y: 8 }; +( (point1.getx() point1.gety()) + (point2.getx() point2.gety()) ) - -/* -:: Hoon equivalent program -!= -=> mini=mini -=> - ^= door - |_ [x=@ y=@] - ++ add - |= p=[x=@ y=@] - ~(. +> [(add:mini x x.p) (add:mini y y.p)]) - ++ sub - |= p=[x=@ y=@] - ~(. +> [(sub:mini x x.p) (sub:mini y y.p)]) - -- -=/ point-1 - ~(. door [104 124]) -=. point-1 (add:point-1 [38 38]) -=/ point-2 - ~(. door [30 40]) -=. point-1 (sub:point-1 [100 20]) -=. point-2 (add:point-2 [212 302]) -[[+12 +13]:point-1 [+12 +13]:point-2] - -Jock: -[7 [0 2] - 7 [8 [[1 0] 1 0] - [1 [8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] - 8 [[1 0] 1 0] [1 [8 [9 3.061 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 3.061 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] 0 1] - 8 [8 [0 1] 10 [6 7 [0 3] [1 104] 1 124] 0 2] - 7 [10 [2 8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 38] 1 38] 0 2] 0 1] - 8 [8 [0 3] 10 [6 7 [0 3] [1 30] 1 40] 0 2] - 7 [10 [2 8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 212] 1 302] 0 2] 0 1] - 7 [10 [6 8 [7 [0 6] 9 5 0 1] 9 2 10 [6 7 [0 3] [1 100] 1 20] 0 2] 0 1] - [[7 [0 6] 7 [0 6] 0 2] 7 [0 6] 7 [0 6] 0 3] - [7 [0 2] 7 [0 6] 0 2] 7 [0 2] 7 [0 6] 0 3] - -Hoon: -[ 7 [0 4] - 7 [8 [1 0 0] - [1 [8 [1 0 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 124] 0 28] 0 2] 8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 125] 0 29] 0 2] 0 2] 0 1] - 8 [1 0 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [7 [0 31] 9 3.061 0 1] 9 2 10 [6 [0 124] 0 28] 0 2] 8 [7 [0 31] 9 3.061 0 1] 9 2 10 [6 [0 125] 0 29] 0 2] 0 2] 0 1] 0 1] - 8 [8 [0 1] 10 [6 7 [0 3] 1 104 124] 0 2] - 7 [10 [2 8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] 1 38 38] 0 2] 0 1] -* 8 [8 [0 3] 10 [6 7 [0 3] 1 30 40] 0 2] - 7 [10 [2 8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] 1 212 302] 0 2] 0 1] - 7 [10 [6 8 [7 [0 6] 9 5 0 1] 9 2 10 [6 7 [0 3] 1 100 20] 0 2] 0 1] - [7 [0 6] [0 12] 0 13] - 7 [0 2] [0 12] 0 13] -*/ diff --git a/crates/jockt/hoon/lib/tests/type-point-3.jock b/crates/jockt/hoon/lib/tests/type-point-3.jock index 70454e9..b0a24dd 100644 --- a/crates/jockt/hoon/lib/tests/type-point-3.jock +++ b/crates/jockt/hoon/lib/tests/type-point-3.jock @@ -1,23 +1,20 @@ -compose - class Point(x:Uint y:Uint) { - add(p:(x:Uint y:Uint)) -> Point { - (x + p.x - y + p.y) - } - add_cell(p:(x:Uint y:Uint)) -> (Uint Uint) { - (x + p.x - y + p.y) - } - inc(q:Uint) -> @ { - +(q) - } +// Test class with multiple methods and different return types +struct PointState { x: Real, y: Real }; +class Point(PointState) { + getx(self: PointState) -> Real { + self.x } -; + gety(self: PointState) -> Real { + self.y + } + inc(self: PointState, q: Real) -> Real { + +(q) + } +}; -let one = Point(2 13); -let two = one.add(30 19); -let three = one.inc(41); -(two.add_cell(10 10) three) +let one = Point { x: 32, y: 10 }; +let two = one.inc(41); +((one.getx() one.gety()) two) /* :: Hoon equivalent program @@ -41,49 +38,4 @@ let three = one.inc(41); =/ two (add:one [30 19]) =/ three (inc:one 41) [(add-cell:two [10 10]) three] - -<<<<<<< HEAD -Jock: -[7 [8 [[1 0] 1 0] [1 [8 [[1 0] 1 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 2] 0 1] [8 [1 0] [1 4 0 6] 0 1] 8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] 0 1] 8 [8 [0 1] 10 [6 7 [0 3] [1 2] 1 13] 0 2] 8 [8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 30] 1 19] 0 2] 8 [8 [7 [0 6] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2] [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] [1 10] 1 10] 0 2] 0 2] - -Hoon: -======= -H: ->>>>>>> sigilante/itll-cost-you-an-arm-and-a-leg -[ 7 - [0 2] - 7 - [ 8 - [1 0 0] - [ 1 - [8 [1 0 0] [1 [8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 124] 0 28] 0 2] 8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 125] 0 29] 0 2] 0 1] - [8 [1 0 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 124] 0 28] 0 2] 8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 125] 0 29] 0 2] 0 2] 0 1] - 8 [1 0] [1 4 0 6] 0 1] -<<<<<<< HEAD - 0 1] - 8 [8 [0 1] 10 [6 7 [0 3] 1 2 13] 0 2] 8 - [8 [7 [0 2] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 30 19] 0 2] - 8 [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2] - [8 [7 [0 6] 9 4 0 1] 9 2 10 [6 7 [0 3] 1 10 10] 0 2] 0 2] -======= - 0 1] - 8 [8 [0 1] 10 [6 7 [0 3] 1 2 13] 0 2] - 8 [8 [7 [0 2] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 30 19] 0 2] - 8 [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2] - [8 [7 [0 6] 9 4 0 1] 9 2 10 [6 7 [0 3] 1 10 10] 0 2] 0 2] - -J: -[7 - [8 [[1 0] 1 0] - [1 [8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] - [8 [1 0] [1 4 0 6] 0 1] - 8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] - 0 1] - 8 [8 [0 1] 10 [6 7 [0 3] [1 2] 1 13] 0 2] - 8 [8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 30] 1 19] 0 2] - 8 [8 [7 [0 6] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2] - [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] [1 10] 1 10] 0 2] 0 2] - -7 [8 [[1 0] 1 0] [1 [8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] [8 [1 0] [1 4 0 6] 0 1] 8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] 0 1] 8 [8 [0 1] 10 [6 7 [0 3] [1 2] 1 13] 0 2] 8 [8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 30] 1 19] 0 2] 8 [8 [7 [0 6] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2] [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] [1 10] 1 10] 0 2] 0 2]] ->>>>>>> sigilante/itll-cost-you-an-arm-and-a-leg */ diff --git a/crates/jockt/hoon/lib/tests/type-point.jock b/crates/jockt/hoon/lib/tests/type-point.jock index d6dde80..e345a10 100644 --- a/crates/jockt/hoon/lib/tests/type-point.jock +++ b/crates/jockt/hoon/lib/tests/type-point.jock @@ -1,22 +1,19 @@ /* A class is broadly equivalent to a Hoon door. It has a top-level sample which represents its state, along with methods that have each their own samples. - - A class must be composed into the subject to be accessible. */ -compose - class Foo(x:@) { - bar(p:@) -> Foo { - p - } +struct FooState { x: Real }; +class Foo(FooState) { + bar(self: FooState, p: Real) -> Real { + p } -; // end compose +}; // let name:Type = value; -let a:Foo = Foo(41); -// let name = Type(value); -let b = Foo(42); +let a = Foo { x: 41 }; +// let name = Type { fields }; +let b = Foo { x: 42 }; // let name:type = value; let c:@ = 43; -(Foo(40) a b c) +(Foo { x: 40 } a b c) diff --git a/crates/jockt/hoon/lib/tests/unary-parens.jock b/crates/jockt/hoon/lib/tests/unary-parens.jock new file mode 100644 index 0000000..3eb7cbe --- /dev/null +++ b/crates/jockt/hoon/lib/tests/unary-parens.jock @@ -0,0 +1,7 @@ +trait Neg(unary -) { neg; }; +struct S { val: Real }; +class C(S) impl Neg { + neg(self: Self) -> Real { (100 - self.val) } +}; +let w = C { val: 30 }; +(-w) diff --git a/crates/jockt/hoon/lib/tests/unary-sint.jock b/crates/jockt/hoon/lib/tests/unary-sint.jock new file mode 100644 index 0000000..dedaab7 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/unary-sint.jock @@ -0,0 +1 @@ ++100 + (-30) diff --git a/crates/jockt/hoon/lib/tests/unary-tuple-2.jock b/crates/jockt/hoon/lib/tests/unary-tuple-2.jock new file mode 100644 index 0000000..a4bfb42 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/unary-tuple-2.jock @@ -0,0 +1 @@ +(100 42 - 5) diff --git a/crates/jockt/hoon/lib/tests/unary-tuple-3.jock b/crates/jockt/hoon/lib/tests/unary-tuple-3.jock new file mode 100644 index 0000000..4aed538 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/unary-tuple-3.jock @@ -0,0 +1 @@ +(100 42 (-5)) diff --git a/crates/jockt/hoon/lib/tests/unary-unicode.jock b/crates/jockt/hoon/lib/tests/unary-unicode.jock new file mode 100644 index 0000000..55ca475 --- /dev/null +++ b/crates/jockt/hoon/lib/tests/unary-unicode.jock @@ -0,0 +1,7 @@ +trait Neg(unary ⊖) { neg; }; +struct S { val: Real }; +class C(S) impl Neg { + neg(self: Self) -> Real { (100 - self.val) } +}; +let w = C { val: 30 }; +⊖w diff --git a/crates/jockt/hoon/main.hoon b/crates/jockt/hoon/main.hoon index c02324e..139527e 100644 --- a/crates/jockt/hoon/main.hoon +++ b/crates/jockt/hoon/main.hoon @@ -54,55 +54,55 @@ :: %exec ~& loaded-libs+[~(key by libs.k)] - ?. (gth (lent list-jocks:~(. test-jock libs.k)) n.c) + ?. (gth (lent list-jocks:~(. test-jock [libs.k %.n])) n.c) ~& >>> "index out of range: {}" [~ k] ~& > "running code {}" - =/ code (snag n.c list-jocks:~(. test-jock libs.k)) + =/ code (snag n.c list-jocks:~(. test-jock [libs.k %.n])) ~& code+[-:code] - ~& > parse+(parse:~(. test-jock libs.k) +.code) - ~& >> jeam+(jeam:~(. test-jock libs.k) +.code) - =/ res `*`(mint:~(. test-jock libs.k) +.code) + ~& > parse+(parse:~(. test-jock [libs.k %.n]) +.code) + ~& >> jeam+(jeam:~(. test-jock [libs.k %.n]) +.code) + =/ res `*`(mint:~(. test-jock [libs.k %.n]) +.code) ~& > mint+res - ~& >> jype+(jype:~(. test-jock libs.k) +.code) - ~& >>> nock+(nock:~(. test-jock libs.k) +.code) + ~& >> jype+(jype:~(. test-jock [libs.k %.n]) +.code) + ~& >>> nock+(nock:~(. test-jock [libs.k %.n]) +.code) [~ k] :: %exec-all - ~& exec-all:~(. test-jock libs.k) + ~& exec-all:~(. test-jock [libs.k %.n]) [~ k] :: %test ~& "testing {}" - ~& (test:~(. test-jock libs.k) n.c) + ~& (test:~(. test-jock [libs.k %.n]) n.c) [~ k] :: %test-all - ~& test-all:~(. test-jock libs.k) + ~& test-all:~(. test-jock [libs.k %.n]) [~ k] :: %parseall - ~& parse-all:~(. test-jock libs.k) + ~& parse-all:~(. test-jock [libs.k %.n]) [~ k] :: %jeam-all - ~& jeam-all:~(. test-jock libs.k) + ~& jeam-all:~(. test-jock [libs.k %.n]) [~ k] :: %mint-all - ~& mint-all:~(. test-jock libs.k) + ~& mint-all:~(. test-jock [libs.k %.n]) [~ k] :: %jype-all - ~& jype-all:~(. test-jock libs.k) + ~& jype-all:~(. test-jock [libs.k %.n]) [~ k] :: %nock-all - ~& nock-all:~(. test-jock libs.k) + ~& nock-all:~(. test-jock [libs.k %.n]) [~ k] :: %run - ~& run-details:~(. test-jock libs.k) + ~& run-details:~(. test-jock [libs.k %.n]) [~ k] :: == diff --git a/crates/jockt/hoon/tests/lib/assert.hoon b/crates/jockt/hoon/tests/lib/assert.hoon index 361b344..f9d08f5 100644 --- a/crates/jockt/hoon/tests/lib/assert.hoon +++ b/crates/jockt/hoon/tests/lib/assert.hoon @@ -8,13 +8,13 @@ 'let a: @ = 5;\0alet b: @ = 0;\0a\0aassert a != 0;\0alet c = ?((a a));\0aloop;\0a\0aif a == +(b) {\0a b\0a} else {\0a b = +(b);\0a recur\0a}\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %'{'] [%literal [[%number p=42] q=%.n]] [%punctuator %'}'] [%keyword %else] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%punctuator %'{'] [%literal [[%number p=17] q=%.n]] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%literal [[%number p=15] q=%.n]] [%punctuator %'}']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %'{'] [%literal [[%number p=42] q=%.n]] [%punctuator %'}'] [%keyword %else] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%punctuator %'{'] [%literal [[%number p=17] q=%.n]] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%literal [[%number p=15] q=%.n]] [%punctuator %'}']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=3] q=%.n]] next=[%if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=3] q=%.n]]] then=[%atom p=[[%number p=42] q=%.n]] after=[%else-if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=5] q=%.n]]] then=[%atom p=[[%number p=17] q=%.n]] after=[%else then=[%atom p=[[%number p=15] q=%.n]]]]]] + [%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=3] q=%.n]] next=[%if pos=[0 0] cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=3] q=%.n]]] then=[%atom p=[[%number p=42] q=%.n]] after=[%else-if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=5] q=%.n]]] then=[%atom p=[[%number p=17] q=%.n]] after=[%else then=[%atom p=[[%number p=15] q=%.n]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/axis-call.hoon b/crates/jockt/hoon/tests/lib/axis-call.hoon index f4c94de..036036b 100644 --- a/crates/jockt/hoon/tests/lib/axis-call.hoon +++ b/crates/jockt/hoon/tests/lib/axis-call.hoon @@ -8,13 +8,13 @@ 'func a(b:@) -> @ {\0a +(b)\0a};\0a\0a&2(17)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %func] [%name %a] [%punctuator %'(('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%punctuator %'&'] [%literal [[%number p=2] q=%.n]] [%punctuator %'('] [%literal [[%number p=17] q=%.n]] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %func] [%name %a] [%punctuator %'(('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%punctuator %'&'] [%literal [[%number p=2] q=%.n]] [%punctuator %'('] [%literal [[%number p=17] q=%.n]] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%func type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='a'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%b]]]] context=~]] next=[%call func=[%limb p=~[[%axis p=2]]] arg=[~ [%atom p=[[%number p=17] q=%.n]]]]] + [%func pos=[0 0] type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='a'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%b]]]] context=~]] next=[%call pos=[0 0] func=[%limb p=~[[%axis p=2]]] arg=[~ [%atom p=[[%number p=17] q=%.n]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/baby.hoon b/crates/jockt/hoon/tests/lib/baby.hoon index 83fd7e8..3ade4e5 100644 --- a/crates/jockt/hoon/tests/lib/baby.hoon +++ b/crates/jockt/hoon/tests/lib/baby.hoon @@ -7,13 +7,13 @@ 'compose with 0; object {\0a load = crash\0a peek = crash\0a poke = (a:* -> (* &1)) {\0a (a &1)\0a }\0a wish = crash\0a};\0a\0apoke(3)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %compose] [%keyword %with] [%literal [%number 0]] [%punctuator %';'] [%keyword %object] [%punctuator %'{'] [%name %load] [%punctuator %'='] [%keyword %crash] [%name %peek] [%punctuator %'='] [%keyword %crash] [%name %poke] [%punctuator %'='] [%punctuator %'('] [%name %a] [%punctuator %':'] [%punctuator %'*'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'('] [%punctuator %'*'] [%punctuator %'&'] [%literal [%number 1]] [%punctuator %')'] [%punctuator %')'] [%punctuator %'{'] [%punctuator %'('] [%name %a] [%punctuator %'&'] [%literal [%number 1]] [%punctuator %')'] [%punctuator %'}'] [%name %wish] [%punctuator %'='] [%keyword %crash] [%punctuator %'}'] [%punctuator %';'] [%name %poke] [%punctuator %'('] [%literal [%number 3]] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %compose] [%keyword %with] [%literal [%number 0]] [%punctuator %';'] [%keyword %object] [%punctuator %'{'] [%name %load] [%punctuator %'='] [%keyword %crash] [%name %peek] [%punctuator %'='] [%keyword %crash] [%name %poke] [%punctuator %'='] [%punctuator %'('] [%name %a] [%punctuator %':'] [%punctuator %'*'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'('] [%punctuator %'*'] [%punctuator %'&'] [%literal [%number 1]] [%punctuator %')'] [%punctuator %')'] [%punctuator %'{'] [%punctuator %'('] [%name %a] [%punctuator %'&'] [%literal [%number 1]] [%punctuator %')'] [%punctuator %'}'] [%name %wish] [%punctuator %'='] [%keyword %crash] [%punctuator %'}'] [%punctuator %';'] [%name %poke] [%punctuator %'('] [%literal [%number 3]] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%compose p=[%object name=%$ p=[n=[p=%load q=[%crash ~]] l=[n=[p=%wish q=[%crash ~]] l=~ r=~] r=[n=[p=%peek q=[%crash ~]] l=[p=%poke q=[%lambda p=[arg=[inp=[~ [p=[%none ~] name=%a]] out=[[p=[p=[%none ~] name=%$] q=[p=[%limb p=~[[%axis p=1]]] name=%$]] name=%$]] body=[p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%axis p=1]]]] payload=~]]] r=~]] q=[~ [%atom p=[%number 0] q=%.n]]] q=[%call func=[%limb p=~[[%name p=%poke]]] arg=[~ [%atom p=[%number 3] q=%.n]]]] + [%compose pos=[0 0] p=[%object name=%$ p=[n=[p=%load q=[%crash ~]] l=[n=[p=%wish q=[%crash ~]] l=~ r=~] r=[n=[p=%peek q=[%crash ~]] l=[p=%poke q=[%lambda p=[arg=[inp=[~ [p=[%none ~] name=%a]] out=[[p=[p=[%none ~] name=%$] q=[p=[%limb p=~[[%axis p=1]]] name=%$]] name=%$]] body=[p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%axis p=1]]]] payload=~]]] r=~]] q=[~ [%atom p=[%number 0] q=%.n]]] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%poke]]] arg=[~ [%atom p=[%number 3] q=%.n]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/call-let-edit.hoon b/crates/jockt/hoon/tests/lib/call-let-edit.hoon index 41cb687..c1331e3 100644 --- a/crates/jockt/hoon/tests/lib/call-let-edit.hoon +++ b/crates/jockt/hoon/tests/lib/call-let-edit.hoon @@ -8,13 +8,13 @@ 'func a(c:@) -> @ {\0a +(c)\0a};\0a\0alet b: @ = 42;\0ab = a(23);\0a\0ab\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%keyword %assert] [%name %a] [%punctuator %'!'] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %'='] [%punctuator %'?'] [%punctuator %'('] [%punctuator %'('] [%name %a] [%name %a] [%punctuator %')'] [%punctuator %')'] [%punctuator %';'] [%keyword %loop] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'{'] [%name %b] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %';'] [%keyword %recur] [%punctuator %'}']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%keyword %assert] [%name %a] [%punctuator %'!'] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %'='] [%punctuator %'?'] [%punctuator %'('] [%punctuator %'('] [%name %a] [%name %a] [%punctuator %')'] [%punctuator %')'] [%punctuator %';'] [%keyword %loop] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'{'] [%name %b] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %';'] [%keyword %recur] [%punctuator %'}']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=5] q=%.n]] next=[%let type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=0] q=%.n]] next=[%assert cond=[%compare comp=%'!=' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=0] q=%.n]]] then=[%let type=[p=[%none p=~] name='c'] val=[%cell-check val=[p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%a]]]]] next=[%loop next=[%if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%increment val=[%limb p=~[[%name p=%b]]]]] then=[%limb p=~[[%name p=%b]]] after=[%else then=[%edit limb=~[[%name p=%b]] val=[%increment val=[%limb p=~[[%name p=%b]]]] next=[%call func=[%limb p=~[[%axis p=0]]] arg=~]]]]]]]]] + [%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=5] q=%.n]] next=[%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=0] q=%.n]] next=[%assert cond=[%compare comp=%'!=' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=0] q=%.n]]] then=[%let pos=[0 0] type=[p=[%none p=~] name='c'] val=[%cell-check val=[p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%a]]]]] next=[%loop next=[%if pos=[0 0] cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%increment val=[%limb p=~[[%name p=%b]]]]] then=[%limb p=~[[%name p=%b]]] after=[%else then=[%edit limb=~[[%name p=%b]] val=[%increment val=[%limb p=~[[%name p=%b]]]] next=[%call pos=[0 0] func=[%limb p=~[[%axis p=0]]] arg=~]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/call.hoon b/crates/jockt/hoon/tests/lib/call.hoon index 3d76667..b4a0714 100644 --- a/crates/jockt/hoon/tests/lib/call.hoon +++ b/crates/jockt/hoon/tests/lib/call.hoon @@ -8,13 +8,13 @@ 'func a(b:@) -> @ {\0a +(b)\0a};\0a\0aa(23)\0a\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %func] [%name %a] [%punctuator %'(('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%name %a] [%punctuator %'(('] [%literal [[%number p=23] q=%.n]] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %func] [%name %a] [%punctuator %'(('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%name %a] [%punctuator %'(('] [%literal [[%number p=23] q=%.n]] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%func type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='a'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%b]]]] context=~]] next=[%call func=[%limb p=~[[%name p=%a]]] arg=[~ [%atom p=[[%number p=23] q=%.n]]]]] + [%func pos=[0 0] type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='a'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%b]]]] context=~]] next=[%call pos=[0 0] func=[%limb p=~[[%name p=%a]]] arg=[~ [%atom p=[[%number p=23] q=%.n]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/class-ops.hoon b/crates/jockt/hoon/tests/lib/class-ops.hoon deleted file mode 100644 index e432d0d..0000000 --- a/crates/jockt/hoon/tests/lib/class-ops.hoon +++ /dev/null @@ -1,36 +0,0 @@ -:: /lib/tests/class-ops -/+ jock, - test -/* hoon %txt /lib/mini/txt -:: -|% -++ text - 'compose\0a class Point(x:@ y:@) {\0a add(p:(x:@ y:@)) -> Point {\0a (x + p.x\0a y + p.y)\0a }\0a }\0a;\0a\0alet point_1 = Point(14 104);\0apoint_1 = point_1.add(28 38);\0a(point_1.x() point_1.y())\0a\0a/*\0a!=\0a=> mini=mini\0a=>\0a ^= door\0a |_ [x=@ y=@]\0a ++ add\0a |= p=[x=@ y=@]\0a [(add:mini x x.p) (add:mini y y.p)]\0a --\0a=/ point_1\0a ~(. door [14 104])\0a=. point_1 ~(. door (add:point_1 [28 38]))\0a[+12 +13]:point_1\0a\0a!=\0a=> mini=mini\0a=>\0a ^= door\0a |_ [x=@ y=@]\0a ++ add\0a |= p=[x=@ y=@]\0a [(add:mini x x.p) (add:mini y y.p)]\0a --\0a~(. door [14 104])\0a*/\0a' -++ test-tokenize - %+ expect-eq:test - !> ~[[%keyword %compose] [%keyword %class] [%type 'Point'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%punctuator %'@'] [%name %y] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'{'] [%name %add] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%punctuator %'@'] [%name %y] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Point'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %point_1] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=14] q=%.n]] [%literal [[%number p=104] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name %point_1] [%punctuator %'='] [%name %point_1] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=28] q=%.n]] [%literal [[%number p=38] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%name %point_1] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name %point_1] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')']] - !> (rash text parse-tokens:jock) -:: -++ test-jeam - %+ expect-eq:test - !> ^- jock:jock - [%compose p=[%class state=[p=[%state p=[[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='']] name='Point'] arms=[n=[p=%add q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']]] q=~] name='add'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']] body=[p=[%operator op=%'+' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'+' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=~ r=~]] q=[%let type=[p=[%none p=~] name='point_1'] val=[%call func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=14] q=%.n]] q=[%atom p=[[%number p=104] q=%.n]]]]] next=[%edit limb=~[[%name p=%point_1]] val=[%call func=[%limb p=~[[%name p=%point_1] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=28] q=%.n]] q=[%atom p=[[%number p=38] q=%.n]]]]] next=[p=[%call func=[%limb p=~[[%name p=%point_1] [%name p=%x]]] arg=~] q=[%call func=[%limb p=~[[%name p=%point_1] [%name p=%y]]] arg=~]]]]] - !> (jeam:jock text) -:: -++ test-mint - %+ expect-eq:test - !> [%7 p=[%8 p=[p=[%1 p=0] q=[%1 p=0]] q=[p=[%1 p=[8 [[1 0] 1 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 2] 0 1]] q=[%0 p=1]]] q=[%8 p=[%8 p=[%0 p=1] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=14] q=[%1 p=104]]]] q=[%0 p=2]]] q=[%7 p=[%10 p=[p=2 q=[%8 p=[%7 p=[%0 p=2] q=[%9 p=2 q=[%0 p=1]]] q=[%9 p=2 q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=28] q=[%1 p=38]]]] q=[%0 p=2]]]]] q=[%0 p=1]] q=[p=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=3]]]]]]] - !> +>:(mint:jock text) -:: -++ test-nock - =/ past (rush q.hoon (ifix [gay gay] tall:(vang | /))) - ?~ past ~|("unable to parse Hoon library" !!) - =/ p (~(mint ut %noun) %noun u.past) - %+ expect-eq:test - !> .* 0 - :+ %8 - +.p - [%7 p=[%8 p=[p=[%1 p=0] q=[%1 p=0]] q=[p=[%1 p=[8 [[1 0] 1 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 2] 0 1]] q=[%0 p=1]]] q=[%8 p=[%8 p=[%0 p=1] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=14] q=[%1 p=104]]]] q=[%0 p=2]]] q=[%7 p=[%10 p=[p=2 q=[%8 p=[%7 p=[%0 p=2] q=[%9 p=2 q=[%0 p=1]]] q=[%9 p=2 q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=28] q=[%1 p=38]]]] q=[%0 p=2]]]]] q=[%0 p=1]] q=[p=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=3]]]]]]] - !> .*(0 (mint:jock text)) -:: --- diff --git a/crates/jockt/hoon/tests/lib/class-ops.hoon.skip b/crates/jockt/hoon/tests/lib/class-ops.hoon.skip new file mode 100644 index 0000000..9be92b6 --- /dev/null +++ b/crates/jockt/hoon/tests/lib/class-ops.hoon.skip @@ -0,0 +1,36 @@ +:: /lib/tests/class-ops +/+ jock, + test +/* hoon %txt /lib/mini/txt +:: +|% +++ text + 'compose\0a class Point(x:@ y:@) {\0a add(p:(x:@ y:@)) -> Point {\0a (x + p.x\0a y + p.y)\0a }\0a }\0a;\0a\0alet point_1 = Point(14 104);\0apoint_1 = point_1.add(28 38);\0a(point_1.x() point_1.y())\0a\0a/*\0a!=\0a=> mini=mini\0a=>\0a ^= door\0a |_ [x=@ y=@]\0a ++ add\0a |= p=[x=@ y=@]\0a [(add:mini x x.p) (add:mini y y.p)]\0a --\0a=/ point_1\0a ~(. door [14 104])\0a=. point_1 ~(. door (add:point_1 [28 38]))\0a[+12 +13]:point_1\0a\0a!=\0a=> mini=mini\0a=>\0a ^= door\0a |_ [x=@ y=@]\0a ++ add\0a |= p=[x=@ y=@]\0a [(add:mini x x.p) (add:mini y y.p)]\0a --\0a~(. door [14 104])\0a*/\0a' +++ test-tokenize + %+ expect-eq:test + !> ^- (list token-body:jock) ~[[%keyword %compose] [%keyword %class] [%type 'Point'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%punctuator %'@'] [%name %y] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'{'] [%name %add] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%punctuator %'@'] [%name %y] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Point'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %point_1] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=14] q=%.n]] [%literal [[%number p=104] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name %point_1] [%punctuator %'='] [%name %point_1] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=28] q=%.n]] [%literal [[%number p=38] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%name %point_1] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name %point_1] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) +:: +++ test-jeam + %+ expect-eq:test + !> ^- jock:jock + [%compose pos=[0 0] p=[%class state=[p=[%state p=[[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='']] name='Point'] arms=[n=[p=%add q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']]] q=~] name='add'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']] body=[p=[%operator op=%'+' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'+' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=~ r=~]] q=[%let pos=[0 0] type=[p=[%none p=~] name='point_1'] val=[%call pos=[0 0] func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=14] q=%.n]] q=[%atom p=[[%number p=104] q=%.n]]]]] next=[%edit limb=~[[%name p=%point_1]] val=[%call pos=[0 0] func=[%limb p=~[[%name p=%point_1] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=28] q=%.n]] q=[%atom p=[[%number p=38] q=%.n]]]]] next=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%point_1] [%name p=%x]]] arg=~] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%point_1] [%name p=%y]]] arg=~]]]]] + !> (jeam:jock text) +:: +++ test-mint + %+ expect-eq:test + !> [%7 p=[%8 p=[p=[%1 p=0] q=[%1 p=0]] q=[p=[%1 p=[8 [[1 0] 1 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 2] 0 1]] q=[%0 p=1]]] q=[%8 p=[%8 p=[%0 p=1] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=14] q=[%1 p=104]]]] q=[%0 p=2]]] q=[%7 p=[%10 p=[p=2 q=[%8 p=[%7 p=[%0 p=2] q=[%9 p=2 q=[%0 p=1]]] q=[%9 p=2 q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=28] q=[%1 p=38]]]] q=[%0 p=2]]]]] q=[%0 p=1]] q=[p=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=3]]]]]]] + !> +>:(mint:jock text) +:: +++ test-nock + =/ past (rush q.hoon (ifix [gay gay] tall:(vang | /))) + ?~ past ~|("unable to parse Hoon library" !!) + =/ p (~(mint ut %noun) %noun u.past) + %+ expect-eq:test + !> .* 0 + :+ %8 + +.p + [%7 p=[%8 p=[p=[%1 p=0] q=[%1 p=0]] q=[p=[%1 p=[8 [[1 0] 1 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 2] 0 1]] q=[%0 p=1]]] q=[%8 p=[%8 p=[%0 p=1] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=14] q=[%1 p=104]]]] q=[%0 p=2]]] q=[%7 p=[%10 p=[p=2 q=[%8 p=[%7 p=[%0 p=2] q=[%9 p=2 q=[%0 p=1]]] q=[%9 p=2 q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=28] q=[%1 p=38]]]] q=[%0 p=2]]]]] q=[%0 p=1]] q=[p=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=3]]]]]]] + !> .*(0 (mint:jock text)) +:: +-- diff --git a/crates/jockt/hoon/tests/lib/class-state.hoon b/crates/jockt/hoon/tests/lib/class-state.hoon deleted file mode 100644 index 0d53aeb..0000000 --- a/crates/jockt/hoon/tests/lib/class-state.hoon +++ /dev/null @@ -1,36 +0,0 @@ -:: /lib/tests/class-state -/+ jock, - test -/* hoon %txt /lib/mini/txt -:: -|% -++ text - 'compose\0a class Point(x:@ y:@) {\0a inc(q:@) -> @ {\0a +(q)\0a }\0a }\0a;\0a\0alet point_1 = Point(70 80);\0alet point_2 = Point(90 100);\0a((point_2.x() point_2.y()) (point_1.x() point_1.y()))\0a\0a/*\0a!=\0a=> mini=mini\0a=>\0a ^= door\0a |_ [x=@ y=@]\0a ++ add\0a |= p=[x=@ y=@]\0a [(add:mini x x.p) (add:mini y y.p)]\0a ++ inc\0a |= q=@\0a +(q)\0a --\0a=/ point_1\0a ~(. door [70 80])\0a=/ point_2\0a ~(. door [90 100])\0a[[+13 +12]:point_2 [+13 +12]:point_1]\0a*/\0a' -++ test-tokenize - %+ expect-eq:test - !> ~[[%keyword %compose] [%keyword %class] [%type 'Point'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%punctuator %'@'] [%name %y] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'{'] [%name %inc] [%punctuator %'(('] [%name %q] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %q] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %point_1] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=70] q=%.n]] [%literal [[%number p=80] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %point_2] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=90] q=%.n]] [%literal [[%number p=100] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%punctuator %'('] [%name %point_2] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name %point_2] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')'] [%punctuator %'('] [%name %point_1] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name %point_1] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')'] [%punctuator %')']] - !> (rash text parse-tokens:jock) -:: -++ test-jeam - %+ expect-eq:test - !> ^- jock:jock - [%compose p=[%class state=[p=[%state p=[[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='']] name='Point'] arms=[n=[p=%inc q=[%method type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='q']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='inc'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='q']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%q]]]] context=~]]]] l=~ r=~]] q=[%let type=[p=[%none p=~] name='point_1'] val=[%call func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=70] q=%.n]] q=[%atom p=[[%number p=80] q=%.n]]]]] next=[%let type=[p=[%none p=~] name='point_2'] val=[%call func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=90] q=%.n]] q=[%atom p=[[%number p=100] q=%.n]]]]] next=[p=[p=[%call func=[%limb p=~[[%name p=%point_2] [%name p=%x]]] arg=~] q=[%call func=[%limb p=~[[%name p=%point_2] [%name p=%y]]] arg=~]] q=[p=[%call func=[%limb p=~[[%name p=%point_1] [%name p=%x]]] arg=~] q=[%call func=[%limb p=~[[%name p=%point_1] [%name p=%y]]] arg=~]]]]]] - !> (jeam:jock text) -:: -++ test-mint - %+ expect-eq:test - !> [%7 p=[%8 p=[p=[%1 p=0] q=[%1 p=0]] q=[p=[%1 p=[8 [1 0] [1 4 0 6] 0 1]] q=[%0 p=1]]] q=[%8 p=[%8 p=[%0 p=1] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=70] q=[%1 p=80]]]] q=[%0 p=2]]] q=[%8 p=[%8 p=[%0 p=3] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=90] q=[%1 p=100]]]] q=[%0 p=2]]] q=[p=[p=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=3]]]] q=[p=[%7 p=[%0 p=6] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=6] q=[%7 p=[%0 p=6] q=[%0 p=3]]]]]]]] - !> +>:(mint:jock text) -:: -++ test-nock - =/ past (rush q.hoon (ifix [gay gay] tall:(vang | /))) - ?~ past ~|("unable to parse Hoon library" !!) - =/ p (~(mint ut %noun) %noun u.past) - %+ expect-eq:test - !> .* 0 - :+ %8 - +.p - [%7 p=[%8 p=[p=[%1 p=0] q=[%1 p=0]] q=[p=[%1 p=[8 [1 0] [1 4 0 6] 0 1]] q=[%0 p=1]]] q=[%8 p=[%8 p=[%0 p=1] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=70] q=[%1 p=80]]]] q=[%0 p=2]]] q=[%8 p=[%8 p=[%0 p=3] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=90] q=[%1 p=100]]]] q=[%0 p=2]]] q=[p=[p=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=3]]]] q=[p=[%7 p=[%0 p=6] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=6] q=[%7 p=[%0 p=6] q=[%0 p=3]]]]]]]] - !> .*(0 (mint:jock text)) -:: --- diff --git a/crates/jockt/hoon/tests/lib/class-state.hoon.skip b/crates/jockt/hoon/tests/lib/class-state.hoon.skip new file mode 100644 index 0000000..eba06fe --- /dev/null +++ b/crates/jockt/hoon/tests/lib/class-state.hoon.skip @@ -0,0 +1,36 @@ +:: /lib/tests/class-state +/+ jock, + test +/* hoon %txt /lib/mini/txt +:: +|% +++ text + 'compose\0a class Point(x:@ y:@) {\0a inc(q:@) -> @ {\0a +(q)\0a }\0a }\0a;\0a\0alet point_1 = Point(70 80);\0alet point_2 = Point(90 100);\0a((point_2.x() point_2.y()) (point_1.x() point_1.y()))\0a\0a/*\0a!=\0a=> mini=mini\0a=>\0a ^= door\0a |_ [x=@ y=@]\0a ++ add\0a |= p=[x=@ y=@]\0a [(add:mini x x.p) (add:mini y y.p)]\0a ++ inc\0a |= q=@\0a +(q)\0a --\0a=/ point_1\0a ~(. door [70 80])\0a=/ point_2\0a ~(. door [90 100])\0a[[+13 +12]:point_2 [+13 +12]:point_1]\0a*/\0a' +++ test-tokenize + %+ expect-eq:test + !> ^- (list token-body:jock) ~[[%keyword %compose] [%keyword %class] [%type 'Point'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%punctuator %'@'] [%name %y] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'{'] [%name %inc] [%punctuator %'(('] [%name %q] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %q] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %point_1] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=70] q=%.n]] [%literal [[%number p=80] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %point_2] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=90] q=%.n]] [%literal [[%number p=100] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%punctuator %'('] [%name %point_2] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name %point_2] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')'] [%punctuator %'('] [%name %point_1] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name %point_1] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')'] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) +:: +++ test-jeam + %+ expect-eq:test + !> ^- jock:jock + [%compose pos=[0 0] p=[%class state=[p=[%state p=[[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='']] name='Point'] arms=[n=[p=%inc q=[%method type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='q']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='inc'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='q']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%q]]]] context=~]]]] l=~ r=~]] q=[%let pos=[0 0] type=[p=[%none p=~] name='point_1'] val=[%call pos=[0 0] func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=70] q=%.n]] q=[%atom p=[[%number p=80] q=%.n]]]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='point_2'] val=[%call pos=[0 0] func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=90] q=%.n]] q=[%atom p=[[%number p=100] q=%.n]]]]] next=[p=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%point_2] [%name p=%x]]] arg=~] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%point_2] [%name p=%y]]] arg=~]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%point_1] [%name p=%x]]] arg=~] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%point_1] [%name p=%y]]] arg=~]]]]]] + !> (jeam:jock text) +:: +++ test-mint + %+ expect-eq:test + !> [%7 p=[%8 p=[p=[%1 p=0] q=[%1 p=0]] q=[p=[%1 p=[8 [1 0] [1 4 0 6] 0 1]] q=[%0 p=1]]] q=[%8 p=[%8 p=[%0 p=1] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=70] q=[%1 p=80]]]] q=[%0 p=2]]] q=[%8 p=[%8 p=[%0 p=3] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=90] q=[%1 p=100]]]] q=[%0 p=2]]] q=[p=[p=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=3]]]] q=[p=[%7 p=[%0 p=6] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=6] q=[%7 p=[%0 p=6] q=[%0 p=3]]]]]]]] + !> +>:(mint:jock text) +:: +++ test-nock + =/ past (rush q.hoon (ifix [gay gay] tall:(vang | /))) + ?~ past ~|("unable to parse Hoon library" !!) + =/ p (~(mint ut %noun) %noun u.past) + %+ expect-eq:test + !> .* 0 + :+ %8 + +.p + [%7 p=[%8 p=[p=[%1 p=0] q=[%1 p=0]] q=[p=[%1 p=[8 [1 0] [1 4 0 6] 0 1]] q=[%0 p=1]]] q=[%8 p=[%8 p=[%0 p=1] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=70] q=[%1 p=80]]]] q=[%0 p=2]]] q=[%8 p=[%8 p=[%0 p=3] q=[%10 p=[p=6 q=[%7 p=[%0 p=3] q=[p=[%1 p=90] q=[%1 p=100]]]] q=[%0 p=2]]] q=[p=[p=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=2] q=[%7 p=[%0 p=6] q=[%0 p=3]]]] q=[p=[%7 p=[%0 p=6] q=[%7 p=[%0 p=6] q=[%0 p=2]]] q=[%7 p=[%0 p=6] q=[%7 p=[%0 p=6] q=[%0 p=3]]]]]]]] + !> .*(0 (mint:jock text)) +:: +-- diff --git a/crates/jockt/hoon/tests/lib/comparator.hoon b/crates/jockt/hoon/tests/lib/comparator.hoon index 0e3e996..bb1ec1b 100644 --- a/crates/jockt/hoon/tests/lib/comparator.hoon +++ b/crates/jockt/hoon/tests/lib/comparator.hoon @@ -8,13 +8,13 @@ 'let a = true;\0alet b = a == true;\0alet c = a < 1;\0alet d = a > 2;\0alet e = b != true;\0alet f = a <= 1;\0alet g = a >= 2;\0a\0ag\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %'='] [%literal [[%loobean p=%.y] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%name %a] [%punctuator %'='] [%punctuator %'='] [%literal [[%loobean p=%.y] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %'='] [%name %a] [%punctuator %'<'] [%literal [[%number p=1] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %d] [%punctuator %'='] [%name %a] [%punctuator %'>'] [%literal [[%number p=2] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %e] [%punctuator %'='] [%name %b] [%punctuator %'!'] [%punctuator %'='] [%literal [[%loobean p=%.y] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %f] [%punctuator %'='] [%name %a] [%punctuator %'<'] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %g] [%punctuator %'='] [%name %a] [%punctuator %'>'] [%punctuator %'='] [%literal [[%number p=2] q=%.n]] [%punctuator %';'] [%name %g]] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %'='] [%literal [[%loobean p=%.y] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%name %a] [%punctuator %'='] [%punctuator %'='] [%literal [[%loobean p=%.y] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %'='] [%name %a] [%punctuator %'<'] [%literal [[%number p=1] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %d] [%punctuator %'='] [%name %a] [%punctuator %'>'] [%literal [[%number p=2] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %e] [%punctuator %'='] [%name %b] [%punctuator %'!'] [%punctuator %'='] [%literal [[%loobean p=%.y] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %f] [%punctuator %'='] [%name %a] [%punctuator %'<'] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %g] [%punctuator %'='] [%name %a] [%punctuator %'>'] [%punctuator %'='] [%literal [[%number p=2] q=%.n]] [%punctuator %';'] [%name %g]] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%none p=~] name='a'] val=[%atom p=[[%loobean p=%.y] q=%.n]] next=[%let type=[p=[%none p=~] name='b'] val=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%loobean p=%.y] q=%.n]]] next=[%let type=[p=[%none p=~] name='c'] val=[%compare comp=%'<' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=1] q=%.n]]] next=[%let type=[p=[%none p=~] name='d'] val=[%compare comp=%'>' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=2] q=%.n]]] next=[%let type=[p=[%none p=~] name='e'] val=[%compare comp=%'!=' a=[%limb p=~[[%name p=%b]]] b=[%atom p=[[%loobean p=%.y] q=%.n]]] next=[%let type=[p=[%none p=~] name='f'] val=[%compare comp=%'<=' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=1] q=%.n]]] next=[%let type=[p=[%none p=~] name='g'] val=[%compare comp=%'>=' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=2] q=%.n]]] next=[%limb p=~[[%name p=%g]]]]]]]]]] + [%let pos=[0 0] type=[p=[%none p=~] name='a'] val=[%atom p=[[%loobean p=%.y] q=%.n]] next=[%let pos=[0 0] type=[p=[%none p=~] name='b'] val=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%loobean p=%.y] q=%.n]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='c'] val=[%compare comp=%'<' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=1] q=%.n]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='d'] val=[%compare comp=%'>' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=2] q=%.n]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='e'] val=[%compare comp=%'!=' a=[%limb p=~[[%name p=%b]]] b=[%atom p=[[%loobean p=%.y] q=%.n]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='f'] val=[%compare comp=%'<=' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=1] q=%.n]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='g'] val=[%compare comp=%'>=' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=2] q=%.n]]] next=[%limb p=~[[%name p=%g]]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/compose-cores.hoon b/crates/jockt/hoon/tests/lib/compose-cores.hoon index 9442e00..068d381 100644 --- a/crates/jockt/hoon/tests/lib/compose-cores.hoon +++ b/crates/jockt/hoon/tests/lib/compose-cores.hoon @@ -8,13 +8,13 @@ 'func g(a:@) -> @ {\0a 29\0a};\0a\0acompose\0a with this; object {\0a b = lambda (c:@) -> @ {\0a g(5)\0a }\0a c = 89\0a };\0a\0ab(3)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %func] [%name %g] [%punctuator %'(('] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%literal [[%number p=29] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%keyword %compose] [%keyword %with] [%keyword %this] [%punctuator %';'] [%keyword %object] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%keyword %lambda] [%punctuator %'('] [%name %c] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%name %g] [%punctuator %'(('] [%literal [[%number p=5] q=%.n]] [%punctuator %')'] [%punctuator %'}'] [%name %c] [%punctuator %'='] [%literal [[%number p=89] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%name %b] [%punctuator %'(('] [%literal [[%number p=3] q=%.n]] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %func] [%name %g] [%punctuator %'(('] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%literal [[%number p=29] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%keyword %compose] [%keyword %with] [%keyword %this] [%punctuator %';'] [%keyword %object] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%keyword %lambda] [%punctuator %'('] [%name %c] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%name %g] [%punctuator %'(('] [%literal [[%number p=5] q=%.n]] [%punctuator %')'] [%punctuator %'}'] [%name %c] [%punctuator %'='] [%literal [[%number p=89] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%name %b] [%punctuator %'(('] [%literal [[%number p=3] q=%.n]] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%func type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='a']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='g'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='a']] out=[p=[%atom p=%number q=%.n] name='']] body=[%atom p=[[%number p=29] q=%.n]] context=~]] next=[%compose p=[%object name=%$ p=[n=[p=%b q=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='c']] out=[p=[%atom p=%number q=%.n] name='']] body=[%call func=[%limb p=~[[%name p=%g]]] arg=[~ [%atom p=[[%number p=5] q=%.n]]]] context=~]]] l=~ r=[n=[p=%c q=[%atom p=[[%number p=89] q=%.n]]] l=~ r=~]] q=[~ [%limb p=~[[%axis p=1]]]]] q=[%call func=[%limb p=~[[%name p=%b]]] arg=[~ [%atom p=[[%number p=3] q=%.n]]]]]] + [%func pos=[0 0] type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='a']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='g'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='a']] out=[p=[%atom p=%number q=%.n] name='']] body=[%atom p=[[%number p=29] q=%.n]] context=~]] next=[%compose pos=[0 0] p=[%object name=%$ p=[n=[p=%b q=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='c']] out=[p=[%atom p=%number q=%.n] name='']] body=[%call pos=[0 0] func=[%limb p=~[[%name p=%g]]] arg=[~ [%atom p=[[%number p=5] q=%.n]]]] context=~]]] l=~ r=[n=[p=%c q=[%atom p=[[%number p=89] q=%.n]]] l=~ r=~]] q=[~ [%limb p=~[[%axis p=1]]]]] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%b]]] arg=[~ [%atom p=[[%number p=3] q=%.n]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/compose.hoon b/crates/jockt/hoon/tests/lib/compose.hoon index f5b3564..9fa9d24 100644 --- a/crates/jockt/hoon/tests/lib/compose.hoon +++ b/crates/jockt/hoon/tests/lib/compose.hoon @@ -8,13 +8,13 @@ 'compose\0a object {\0a b = 5\0a a = lambda (c: @) -> @ {\0a +(c)\0a }\0a };\0aa(b)\0a\0a/*\0a=>\0a |%\0a ++ b 5\0a ++ a |=(c=@ +(c))\0a --\0a(a b)\0a\0a[7 [1 [1 5] 8 [1 0] [1 4 0 6] 0 1] 8 [9 3 0 1] 9 2 10 [6 7 [0 3] 9 2 0 1] 0 2]\0a*/\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %compose] [%keyword %object] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%name %a] [%punctuator %'='] [%keyword %lambda] [%punctuator %'('] [%name %c] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %c] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%name %a] [%punctuator %'(('] [%name %b] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %compose] [%keyword %object] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%name %a] [%punctuator %'='] [%keyword %lambda] [%punctuator %'('] [%name %c] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %c] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%name %a] [%punctuator %'(('] [%name %b] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%compose p=[%object name=%$ p=[n=[p=%b q=[%atom p=[[%number p=5] q=%.n]]] l=~ r=[n=[p=%a q=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='c']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%c]]]] context=~]]] l=~ r=~]] q=~] q=[%call func=[%limb p=~[[%name p=%a]]] arg=[~ [%limb p=~[[%name p=%b]]]]]] + [%compose pos=[0 0] p=[%object name=%$ p=[n=[p=%b q=[%atom p=[[%number p=5] q=%.n]]] l=~ r=[n=[p=%a q=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='c']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%c]]]] context=~]]] l=~ r=~]] q=~] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%a]]] arg=[~ [%limb p=~[[%name p=%b]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/dec.hoon b/crates/jockt/hoon/tests/lib/dec.hoon index b0e2cea..4927b5c 100644 --- a/crates/jockt/hoon/tests/lib/dec.hoon +++ b/crates/jockt/hoon/tests/lib/dec.hoon @@ -8,13 +8,13 @@ 'func dec(a:@) -> @ {\0a let b = 0;\0a loop;\0a if a == +(b) {\0a b\0a } else {\0a b = +(b);\0a recur\0a }\0a};\0a\0adec(43)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %func] [%name %dec] [%punctuator %'(('] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%keyword %let] [%name %b] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%keyword %loop] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'{'] [%name %b] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %';'] [%keyword %recur] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%name %dec] [%punctuator %'(('] [%literal [[%number p=43] q=%.n]] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %func] [%name %dec] [%punctuator %'(('] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%keyword %let] [%name %b] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%keyword %loop] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'{'] [%name %b] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %';'] [%keyword %recur] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%name %dec] [%punctuator %'(('] [%literal [[%number p=43] q=%.n]] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%func type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='a']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='dec'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='a']] out=[p=[%atom p=%number q=%.n] name='']] body=[%let type=[p=[%none p=~] name='b'] val=[%atom p=[[%number p=0] q=%.n]] next=[%loop next=[%if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%increment val=[%limb p=~[[%name p=%b]]]]] then=[%limb p=~[[%name p=%b]]] after=[%else then=[%edit limb=~[[%name p=%b]] val=[%increment val=[%limb p=~[[%name p=%b]]]] next=[%call func=[%limb p=~[[%axis p=0]]] arg=~]]]]]] context=~]] next=[%call func=[%limb p=~[[%name p=%dec]]] arg=[~ [%atom p=[[%number p=43] q=%.n]]]]] + [%func pos=[0 0] type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='a']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='dec'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='a']] out=[p=[%atom p=%number q=%.n] name='']] body=[%let pos=[0 0] type=[p=[%none p=~] name='b'] val=[%atom p=[[%number p=0] q=%.n]] next=[%loop next=[%if pos=[0 0] cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%increment val=[%limb p=~[[%name p=%b]]]]] then=[%limb p=~[[%name p=%b]]] after=[%else then=[%edit limb=~[[%name p=%b]] val=[%increment val=[%limb p=~[[%name p=%b]]]] next=[%call pos=[0 0] func=[%limb p=~[[%axis p=0]]] arg=~]]]]]] context=~]] next=[%call pos=[0 0] func=[%limb p=~[[%name p=%dec]]] arg=[~ [%atom p=[[%number p=43] q=%.n]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/eval.hoon b/crates/jockt/hoon/tests/lib/eval.hoon index 2fb6d17..f8b7187 100644 --- a/crates/jockt/hoon/tests/lib/eval.hoon +++ b/crates/jockt/hoon/tests/lib/eval.hoon @@ -8,13 +8,13 @@ 'let a = eval (42 55) (0 2);\0a\0aa\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %'='] [%keyword %eval] [%punctuator %'('] [%literal [[%number p=42] q=%.n]] [%literal [[%number p=55] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=0] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name %a]] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %'='] [%keyword %eval] [%punctuator %'('] [%literal [[%number p=42] q=%.n]] [%literal [[%number p=55] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=0] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name %a]] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%none p=~] name='a'] val=[%eval p=[p=[%atom p=[[%number p=42] q=%.n]] q=[%atom p=[[%number p=55] q=%.n]]] q=[p=[%atom p=[[%number p=0] q=%.n]] q=[%atom p=[[%number p=2] q=%.n]]]] next=[%limb p=~[[%name p=%a]]]] + [%let pos=[0 0] type=[p=[%none p=~] name='a'] val=[%eval p=[p=[%atom p=[[%number p=42] q=%.n]] q=[%atom p=[[%number p=55] q=%.n]]] q=[p=[%atom p=[[%number p=0] q=%.n]] q=[%atom p=[[%number p=2] q=%.n]]]] next=[%limb p=~[[%name p=%a]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/example-atom.hoon b/crates/jockt/hoon/tests/lib/example-atom.hoon index ee48a4e..3bee9f5 100644 --- a/crates/jockt/hoon/tests/lib/example-atom.hoon +++ b/crates/jockt/hoon/tests/lib/example-atom.hoon @@ -8,13 +8,13 @@ 'let a:@ = 42;\0a\0a(a a a)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%punctuator %'('] [%name %a] [%name %a] [%name %a] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%punctuator %'('] [%name %a] [%name %a] [%name %a] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=42] q=%.n]] next=[p=[%limb p=~[[%name p=%a]]] q=[p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%a]]]]]] + [%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=42] q=%.n]] next=[p=[%limb p=~[[%name p=%a]]] q=[p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%a]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/fib.hoon b/crates/jockt/hoon/tests/lib/fib.hoon index 03426f7..00fc5ed 100644 --- a/crates/jockt/hoon/tests/lib/fib.hoon +++ b/crates/jockt/hoon/tests/lib/fib.hoon @@ -8,13 +8,13 @@ '// fibonacci\0a\0afunc fib(n:@) -> @ {\0a if n == 0 {\0a 1\0a } else if n == 1 {\0a 1\0a } else {\0a $(n - 1) + $(n - 2)\0a }\0a};\0a\0a(\0a fib(0)\0a fib(1)\0a fib(2)\0a fib(3)\0a fib(4)\0a fib(5)\0a fib(6)\0a fib(7)\0a fib(8)\0a fib(9)\0a fib(10)\0a)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %func] [%name %fib] [%punctuator %'(('] [%name %n] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%keyword %if] [%name %n] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%punctuator %'}'] [%keyword %else] [%keyword %if] [%name %n] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%punctuator %'$'] [%punctuator %'('] [%name %n] [%punctuator %'-'] [%literal [[%number p=1] q=%.n]] [%punctuator %')'] [%punctuator %'+'] [%punctuator %'$'] [%punctuator %'('] [%name %n] [%punctuator %'-'] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%punctuator %'('] [%name %fib] [%punctuator %'(('] [%literal [[%number p=0] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=1] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=3] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=4] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=5] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=6] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=7] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=8] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=9] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=10] q=%.n]] [%punctuator %')'] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %func] [%name %fib] [%punctuator %'(('] [%name %n] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%keyword %if] [%name %n] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%punctuator %'}'] [%keyword %else] [%keyword %if] [%name %n] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%punctuator %'$'] [%punctuator %'('] [%name %n] [%punctuator %'-'] [%literal [[%number p=1] q=%.n]] [%punctuator %')'] [%punctuator %'+'] [%punctuator %'$'] [%punctuator %'('] [%name %n] [%punctuator %'-'] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%punctuator %'('] [%name %fib] [%punctuator %'(('] [%literal [[%number p=0] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=1] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=3] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=4] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=5] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=6] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=7] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=8] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=9] q=%.n]] [%punctuator %')'] [%name %fib] [%punctuator %'(('] [%literal [[%number p=10] q=%.n]] [%punctuator %')'] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%func type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='n']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='fib'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='n']] out=[p=[%atom p=%number q=%.n] name='']] body=[%if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%n]]] b=[%atom p=[[%number p=0] q=%.n]]] then=[%atom p=[[%number p=1] q=%.n]] after=[%else-if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%n]]] b=[%atom p=[[%number p=1] q=%.n]]] then=[%atom p=[[%number p=1] q=%.n]] after=[%else then=[%operator op=%'+' a=[%call func=[%limb p=~[[%axis p=0]]] arg=[~ [%operator op=%'-' a=[%limb p=~[[%name p=%n]]] b=[~ [%atom p=[[%number p=1] q=%.n]]]]]] b=[~ [%call func=[%limb p=~[[%axis p=0]]] arg=[~ [%operator op=%'-' a=[%limb p=~[[%name p=%n]]] b=[~ [%atom p=[[%number p=2] q=%.n]]]]]]]]]]] context=~]] next=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=0] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=1] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=2] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=3] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=4] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=5] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=6] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=7] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=8] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=9] q=%.n]]]] q=[%call func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=10] q=%.n]]]]]]]]]]]]]]] + [%func pos=[0 0] type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='n']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='fib'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='n']] out=[p=[%atom p=%number q=%.n] name='']] body=[%if pos=[0 0] cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%n]]] b=[%atom p=[[%number p=0] q=%.n]]] then=[%atom p=[[%number p=1] q=%.n]] after=[%else-if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%n]]] b=[%atom p=[[%number p=1] q=%.n]]] then=[%atom p=[[%number p=1] q=%.n]] after=[%else then=[%operator op=%'+' a=[%call pos=[0 0] func=[%limb p=~[[%axis p=0]]] arg=[~ [%operator op=%'-' a=[%limb p=~[[%name p=%n]]] b=[~ [%atom p=[[%number p=1] q=%.n]]]]]] b=[~ [%call pos=[0 0] func=[%limb p=~[[%axis p=0]]] arg=[~ [%operator op=%'-' a=[%limb p=~[[%name p=%n]]] b=[~ [%atom p=[[%number p=2] q=%.n]]]]]]]]]]] context=~]] next=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=0] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=1] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=2] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=3] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=4] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=5] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=6] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=7] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=8] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=9] q=%.n]]]] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%fib]]] arg=[~ [%atom p=[[%number p=10] q=%.n]]]]]]]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/hoon-alias.hoon b/crates/jockt/hoon/tests/lib/hoon-alias.hoon index 9ab3f64..2f2d043 100644 --- a/crates/jockt/hoon/tests/lib/hoon-alias.hoon +++ b/crates/jockt/hoon/tests/lib/hoon-alias.hoon @@ -8,13 +8,13 @@ 'import hoon as lib;\0a\0alet a:@ = 6;\0alet b:@ = 7;\0a\0alib.mul(a b)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %import] [%name %hoon] [%keyword %as] [%name %lib] [%punctuator %';'] [%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=6] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=7] q=%.n]] [%punctuator %';'] [%name %lib] [%punctuator %'.'] [%name %mul] [%punctuator %'(('] [%name %a] [%name %b] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %import] [%name %hoon] [%keyword %as] [%name %lib] [%punctuator %';'] [%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=6] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=7] q=%.n]] [%punctuator %';'] [%name %lib] [%punctuator %'.'] [%name %mul] [%punctuator %'(('] [%name %a] [%name %b] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%import name=[p=[%hoon p=[#t/<64.kjn %ab-urbe-condita> q=[[[8 [1 1 1] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 179.060 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 348 0 31] 9 2 10 [6 [0 125] 0 14] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 29] [11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 110 97 103 45 102 97 105 108 0] 9 2 0 1] 0 1] 0 0] 6 [5 [1 0] 0 28] [0 58] 9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 0] 1 1] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 12] [10 [1 0 13] 0 12] 10 [3 9 2 10 [12 0 25] 0 1] 0 12] 0 1] 8 [1 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 7 [0 3] 8 [9 11.190 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 22.378 0 127] 9 23 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[6 [5 [1 0] 0 12] [1 0] 0 0] 8 [0 30] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] [8 [9 358.122 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 9 2 10 [13 8 [9 11.246 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 5 [8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 9 2 10 [6 [8 [9 179.060 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 89.518 0 127] 9 11 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 0] [1 8 [6 [3 0 6] [[8 [7 [0 7] 9 11.196 0 1] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 9 89.535 0 1] 9 2 10 [6 0 29] 0 2] 8 [7 [0 7] 9 11.196 0 1] 9 2 10 [6 0 14] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [0 29] 6 [5 [1 0] 0 29] [1 0] 9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 7 [9 11.190 0 1] 9 2 0 1] 0 2] 9 2 0 1] 7 [0 1] [1 [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 62] [[[0 28] 0 29] 1 0 0] 6 [5 [0 28] 0 248] [6 [5 [0 29] 0 249] [0 62] 10 [2 [0 28] 0 29] 0 62] 6 [8 [9 92 0 63] 9 2 10 [6 [0 60] 0 504] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 4.072] 0 4.076] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] [8 [1 0] [1 7 [10 [6 0 6] 0 1] 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [[1 0] 0 249] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [9 2 10 [62 0 250] 0 1] 9 2 10 [62 0 251] 0 1] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 6 [8 [9 92 0 31] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [0 120] 0 25] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 13] [1 0] 6 [8 [9 92 0 31] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [0 27] 0 120] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [6 [5 [0 120] 0 488] [1 1] 1 0] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [6 [5 [0 120] 0 492] [1 1] 1 0] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] [[8 [1 1 1] [1 [8 [9 44.764 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 8 [9 6.014 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 8 [9 11.190 0 1] 9 2 10 [6 [7 [0 3] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 7 [0 3] 7 [9 5.622 0 1] 9 2 0 1] 0 2] 0 2] 9 2 0 1] [1 [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [9 22.378 0 63] 9 4 10 [6 0 126] 0 2] 9 2 10 [6 [0 60] 7 [0 3] 8 [8 [9 89.518 0 63] 9 4 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 0 2] 0 1] [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [8 [9 89.518 0 63] 9 10 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 6 [5 [1 0] 0 2] [8 [8 [9 22.378 0 127] 9 10 10 [6 0 254] 0 2] 9 2 10 [6 0 124] 0 2] 8 [8 [9 22.378 0 127] 9 4 10 [6 0 254] 0 2] 9 2 10 [6 [0 124] 0 6] 0 2] 0 1] 8 [1 0] [1 8 [8 [8 [9 22.378 0 31] 9 22 10 [6 0 62] 0 2] 9 2 10 [6 0 14] 0 2] 6 [5 [1 0] 0 2] [1 0] 0 5] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 4 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [7 [7 [9 5.622 0 1] 9 2 0 1] 9 2 0 1] [1 [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [[0 14] 1 0 0] 6 [5 [0 14] 0 124] [0 62] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 124] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 2.036] 0 2.038] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [9 92 0 31] 9 2 10 [6 [0 124] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [9 92 0 31] 9 2 10 [6 [0 59] 0 124] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 500] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 502] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 7 [10 [6 8 [9 22.395 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 [0 60] 0 6] 0 1] 9 2 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 50] 0 54] [1 8 [[8 [0 60] 9 2 10 [6 0 28] 0 2] 8 [0 61] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 1 1] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 105 118 105 100 101 45 98 121 45 122 101 114 111 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 358.123 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 3.061 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 101 99 114 101 109 101 110 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 6] [0 0] 8 [1 0] 8 [1 6 [5 [0 30] 4 0 6] [0 6] 9 2 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 6.014 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [6 [5 [0 12] 0 13] [1 1] 1 0] [6 [8 [1 6 [5 [1 0] 0 28] [1 0] 6 [6 [6 [5 [1 0] 0 29] [1 1] 1 0] [6 [9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 179.060 0 15] 9 2 10 [6 0 61] 0 2] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] 8 [1 0 0] [1 8 [[6 [6 [3 0 12] [1 1] 1 0] [0 12] 0 0] 6 [6 [3 0 13] [1 1] 1 0] [0 13] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 61] [0 6] 9 2 10 [61 8 [9 11.246 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 8 [7 [0 7] 1 1] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 1] 8 [9 4 0 7] 9 2 10 [6 [7 [0 3] 1 2] 7 [0 3] 9 2 10 [6 8 [9 179.060 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] 8 [1 0] [1 0 6] 0 1] [8 [1 0 [1 1] 0] [1 8 [9 358.122 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 53] 7 [0 3] 8 [9 11.246 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 59] 0 2] 0 2] 0 1] [8 [1 0] [1 8 [1 [6 [6 [3 0 14] [1 1] 1 0] [8 [9 5 0 1] 9 2 10 [6 [7 [0 3] 1 3.405.691.582] [7 [0 3] 1 32.767] 0 30] 0 2] 8 [8 [9 22 0 15] 9 2 10 [6 [7 [0 3] 1 5] [7 [0 3] 9 4 10 [14 0 28] 0 1] 7 [0 3] 9 4 10 [14 0 29] 0 1] 0 2] 8 [9 5 0 3] 9 2 10 [6 [7 [0 3] 1 3.735.928.559] [7 [0 3] 1 65.534] 0 6] 0 2] 8 [1 0 0 0] [1 8 [8 [9 89.534 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 8 [1 0] 8 [1 6 [5 [1 8] 0 6] [0 250] 8 [8 [9 764 0 511] 9 2 10 [6 [0 252] [0 30] 0 507] 0 2] 8 [8 [9 86 0 1.023] 9 2 10 [6 [7 [0 3] 8 [9 11.246 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 7 [0 3] 8 [9 358.122 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 0 2] 6 [5 [1 0] 0 2] [9 2 10 [124 4 0 508] 10 [6 4 0 30] 0 7] 0 2] 9 2 0 1] 0 1] 9 4 0 1] 0 1] 8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [1 0] 6 [5 [1 0] 0 61] [1 0] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [1 0] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 8 [9 383 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 89.519 0 7] 9 2 10 [6 7 [0 3] 8 [9 1.375 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] [8 [1 0] [1 8 [9 89.534 0 7] 9 2 10 [6 [7 [0 3] 1 0] 0 14] 0 2] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 58] 0 2] 8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 59] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 44.764 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 0 0] 8 [[8 [9 44.764 0 7] 9 2 10 [6 [7 [0 3] 8 [9 179.060 0 7] 9 2 10 [6 7 [0 3] 8 [9 2.810 0 7] 9 2 10 [6 0 14] 0 2] 0 2] 7 [0 3] 1 2] 0 2] 1 0] 8 [8 [1 8 [8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 22.394 0 31] 9 2 10 [6 0 28] 0 2] 0 2] 8 [8 [9 4 0 63] 9 2 10 [6 [0 6] 0 6] 0 2] 6 [5 [0 60] 1 0] [6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [[0 6] 0 2] [0 61] 8 [9 4 0 127] 9 2 10 [6 [0 125] 0 125] 0 2] 6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [9 2 10 [6 [8 [9 179.060 0 127] 9 2 10 [6 0 124] 0 2] 0 6] 0 7] 9 2 10 [12 8 [9 179.060 0 127] 9 2 10 [6 0 124] 0 2] 0 7] 9 2 0 1] [0 4] 8 [9 3.061 0 31] 9 2 10 [6 [0 62] 0 13] 0 2] 0 1] [8 [1 0 0] [1 [8 [1 6 [5 [1 0] 0 29] [1 0] 8 [9 348 0 15] 9 2 10 [6 [0 244] 7 [0 3] 9 2 10 [29 0 59] 0 1] 0 2] 9 2 0 1] 8 [9 6.015 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 8 [1 0] 8 [1 6 [5 [0 6] 1 2] [8 [9 340 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 8 [[8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 124] 0 2] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 125] 0 2] 6 [5 [0 4] 0 5] [9 2 10 [30 [8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 252] 0 2] 8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 253] 0 2] 10 [6 4 0 14] 0 3] 8 [9 358.123 0 63] 9 2 10 [6 [0 12] 0 13] 0 2] 9 2 0 1] 0 1] 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0 0] [1 6 [8 [9 340 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [1 0 0 0] [1 8 [9 348 0 7] 9 2 10 [6 [7 [0 3] 8 [9 179.035 0 7] 9 2 10 [6 [7 [0 3] [0 12] 8 [9 89.534 0 7] 9 2 10 [6 [0 28] 0 58] 0 2] 0 59] 0 2] 0 58] 0 2] 0 1] [[8 [1 0 0] [1 8 [[8 [9 22.398 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 22.398 0 7] 9 2 10 [6 0 29] 0 2] 6 [5 [0 4] 0 5] [8 [9 374 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 358.123 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [1 0] [0 29] 9 2 10 [28 8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 1] 9 2 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [6 [3 0 12] [1 1] 1 0] [6 [6 [3 0 13] [1 1] 1 0] [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 1 0] 6 [6 [3 0 13] [1 1] 1 0] [1 1] 6 [5 [0 24] 0 26] [9 2 10 [6 [0 25] 0 27] 0 1] 9 2 10 [6 [0 24] 0 26] 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [9 686 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 698 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 26] 7 [8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 0 6] [1 8 [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [[7 [9 89.983 0 1] 9 2 0 1] 7 [9 89.983 0 1] 9 2 0 1] [1 8 [1 8 [[0 114] 0 118] [1 8 [[8 [0 124] 9 2 10 [6 0 28] 0 2] 8 [0 125] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [7 [[[7 [0 28] 9 2 0 1] 7 [0 28] 9 2 0 1] 1 0] 8 [0 2] [1 0 15] 0 1] [1 [1 [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] [7 [0 252] 9 2 0 1] 7 [0 253] 9 2 0 1] [1 6 [5 [1 0] 0 12] [[[0 26] 0 27] 1 0 0] 6 [5 [0 48] 0 26] [10 [5 0 27] 0 12] 6 [8 [0 62] 9 2 10 [6 [0 58] 0 112] 0 2] [8 [9 2 10 [12 0 50] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [6 0 2] 0 28] 10 [7 10 [6 0 11] 0 28] 0 2] 0 0] 8 [9 2 10 [12 0 51] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [7 0 2] 0 28] 10 [6 10 [7 0 10] 0 28] 0 2] 0 0] 0 1] [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 0 12] [1 0] 6 [5 [0 13] 0 48] [[1 0] 0 49] 6 [8 [0 62] 9 2 10 [6 [0 29] 0 112] 0 2] [9 2 10 [12 0 50] 0 1] 9 2 10 [12 0 51] 0 1] 0 1] [8 [1 0] [1 8 [[7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 8 [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [0 254] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [0 254] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 9 2 0 1] 0 1] 8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 8 [9 10 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] 0 1] 0 1] 0 1] [8 [1 1 1] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 3.061 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 4 0 7] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 44.764 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] 8 [9 348 0 7] 9 2 10 [6 [7 [0 3] 8 [9 358.122 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 117] 0 2] 7 [0 3] 8 [9 179.035 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 7 [0 3] 9 2 10 [13 0 27] 0 1] 0 2] 0 2] 0 1] [8 [1 0 0] [1 6 [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [1 0 0] [1 8 [[8 [9 22.398 0 7] 9 2 10 [6 7 [0 3] 8 [9 22.398 0 7] 9 2 10 [6 0 28] 0 2] 0 2] 8 [9 22.398 0 7] 9 2 10 [6 7 [0 3] 8 [9 22.398 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 6 [5 [0 4] 0 5] [8 [9 374 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 358.123 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [[8 [8 [9 3.063 0 1] 10 [6 7 [0 3] 1 5] 0 2] 8 [1 0 0 0] [1 7 [10 [12 8 [9 358.122 0 59] 9 2 10 [6 [7 [0 3] 1 5] 0 28] 0 2] 0 1] 8 [8 [9 3.061 0 59] 9 2 10 [6 [0 58] 7 [0 3] 8 [9 89.534 0 59] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 0 2] 8 [8 [9 682 0 123] 9 2 10 [6 [7 [0 3] 8 [9 1.375 0 123] 9 2 10 [6 [7 [0 3] 1 3] 0 123] 0 2] 7 [0 3] 8 [9 186 0 123] 9 2 10 [6 [0 6] 7 [0 3] 1 0] 0 2] 0 2] 8 [8 [9 44.764 0 251] 9 2 10 [6 [0 250] 7 [0 3] 1 4] 0 2] 8 [0 124] 8 [1 3.432.918.353 461.845.907] 8 [8 [9 1.375 0 2.043] 9 2 10 [6 [7 [0 3] 1 5] 0 2.043] 0 2] 8 [0 30] 7 [10 [30 8 [0 30] 8 [1 6 [5 [1 0] 0 14] [0 6] 8 [8 [9 84 0 32.763] 9 2 10 [6 [7 [0 3] 8 [9 3.061 0 32.763] 9 2 10 [6 [0 510] 0 30] 0 2] 0 62] 0 2] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 508] 0 2] 0 2] 0 1] 7 [10 [2 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 6] 0 2] 0 1] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 509] 0 2] 0 2] 0 1] 7 [10 [14 8 [9 86 0 65.531] 9 2 10 [6 [0 30] 0 6] 0 2] 0 1] 7 [10 [14 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 13] 0 30] 0 2] 0 1] 7 [10 [14 8 [9 4 0 16.382] 9 2 10 [6 [7 [0 3] 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 30] 7 [0 3] 1 5] 0 2] 0 2] 7 [0 3] 1 3.864.292.196] 0 2] 0 1] 9 2 10 [14 8 [9 179.060 0 65.531] 9 2 10 [6 0 62] 0 2] 0 3] 9 2 0 1] 0 1] 8 [8 [9 11.188 0 8.187] 9 2 10 [6 [7 [0 3] 8 [9 4 0 8.187] 9 2 10 [6 [7 [0 3] 1 4] 0 126] 0 2] 0 254] 0 2] 8 [1 0] 8 [8 [9 350 0 32.763] 9 2 10 [6 [0 32.762] 7 [0 3] 1 3] 0 2] 7 [10 [254 6 [5 [1 3] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 16] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 2] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 2] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 1] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 11 [1.936.945.012 1 0] 0 254] 0 1] 7 [10 [254 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 65.530] 0 2] 0 1] 8 [1 [8 [9 5 0 1] 9 2 10 [6 0 1.022] 0 2] 8 [1 0] [1 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 2.246.822.507] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 13] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 3.266.489.909] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 0 6] 0 1] 9 4 0 1] 0 1] [[8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 117 98 116 114 97 99 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 12] 9 2 10 [6 [8 [9 179.060 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 179.060 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 13] 1 0] [1 1] 8 [1 6 [5 [0 29] 1 1] [0 28] 8 [9 2 10 [29 8 [9 44.764 0 15] 9 2 10 [6 [0 61] 7 [0 3] 1 2] 0 2] 0 1] 8 [8 [9 4 0 31] 9 2 10 [6 [0 6] 0 6] 0 2] 8 [8 [9 350 0 63] 9 2 10 [6 [0 253] 7 [0 3] 1 1] 0 2] 6 [5 [1 0] 0 2] [0 6] 7 [0 3] 8 [9 4 0 63] 9 2 10 [6 [0 6] 0 252] 0 2] 9 2 0 1] 0 1] 8 [1 0] [1 [8 [1 0 0] [1 8 [9 11 0 7] 9 2 10 [6 7 [0 3] 8 [9 348 0 31] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 1] [8 [1 0 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 59] 0 2] 8 [8 [9 22.394 0 63] 9 2 10 [6 7 [0 3] 8 [9 3.061 0 63] 9 2 10 [6 [0 126] 0 60] 0 2] 0 2] 8 [8 [9 6.014 0 127] 9 2 10 [6 [0 250] 0 6] 0 2] 8 [9 11 0 63] 9 2 10 [6 7 [0 3] 8 [9 2.798 0 255] 9 2 10 [6 [7 [0 3] 8 [9 179.035 0 255] 9 2 10 [6 [7 [0 3] [0 124] 0 2] 0 30] 0 2] 7 [0 3] 8 [9 11.246 0 255] 9 2 10 [6 [7 [0 3] [0 124] 8 [9 3.061 0 255] 9 2 10 [6 [0 14] 0 6] 0 2] 0 30] 0 2] 0 2] 0 2] 0 1] 8 [1 0] [1 8 [9 358.122 0 31] 9 2 10 [6 [0 62] 0 14] 0 2] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [1 0] 8 [1 6 [5 [1 0] 0 125] [1 0] 8 [9 348 0 63] 9 2 10 [6 [7 [0 3] 9 2 10 [125 0 251] 10 [6 4 0 6] 0 1] 7 [0 3] 8 [9 179.035 0 63] 9 2 10 [6 [7 [0 3] [0 28] 8 [9 4 0 63] 9 2 10 [6 [0 61] 0 14] 0 2] 7 [0 3] 8 [9 358.122 0 63] 9 2 10 [6 [7 [0 3] [0 28] 0 29] 0 506] 0 2] 0 2] 0 2] 9 2 0 1] 0 1] 506.013.904.830.974.705.962.590.204.844.663.393]]] name='lib'] next=[%let type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=6] q=%.n]] next=[%let type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=7] q=%.n]] next=[%call func=[%limb p=~[[%name p=%lib] [%name p=%mul]]] arg=[~ [p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%b]]]]]]]]] + [%import pos=[0 0] name=[p=[%hoon p=[#t/<64.kjn %ab-urbe-condita> q=[[[8 [1 1 1] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 179.060 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 348 0 31] 9 2 10 [6 [0 125] 0 14] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 29] [11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 110 97 103 45 102 97 105 108 0] 9 2 0 1] 0 1] 0 0] 6 [5 [1 0] 0 28] [0 58] 9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 0] 1 1] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 12] [10 [1 0 13] 0 12] 10 [3 9 2 10 [12 0 25] 0 1] 0 12] 0 1] 8 [1 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 7 [0 3] 8 [9 11.190 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 22.378 0 127] 9 23 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[6 [5 [1 0] 0 12] [1 0] 0 0] 8 [0 30] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] [8 [9 358.122 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 9 2 10 [13 8 [9 11.246 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 5 [8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 9 2 10 [6 [8 [9 179.060 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 89.518 0 127] 9 11 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 0] [1 8 [6 [3 0 6] [[8 [7 [0 7] 9 11.196 0 1] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 9 89.535 0 1] 9 2 10 [6 0 29] 0 2] 8 [7 [0 7] 9 11.196 0 1] 9 2 10 [6 0 14] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [0 29] 6 [5 [1 0] 0 29] [1 0] 9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 7 [9 11.190 0 1] 9 2 0 1] 0 2] 9 2 0 1] 7 [0 1] [1 [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 62] [[[0 28] 0 29] 1 0 0] 6 [5 [0 28] 0 248] [6 [5 [0 29] 0 249] [0 62] 10 [2 [0 28] 0 29] 0 62] 6 [8 [9 92 0 63] 9 2 10 [6 [0 60] 0 504] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 4.072] 0 4.076] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] [8 [1 0] [1 7 [10 [6 0 6] 0 1] 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [[1 0] 0 249] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [9 2 10 [62 0 250] 0 1] 9 2 10 [62 0 251] 0 1] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 6 [8 [9 92 0 31] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [0 120] 0 25] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 13] [1 0] 6 [8 [9 92 0 31] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [0 27] 0 120] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [6 [5 [0 120] 0 488] [1 1] 1 0] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [6 [5 [0 120] 0 492] [1 1] 1 0] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] [[8 [1 1 1] [1 [8 [9 44.764 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 8 [9 6.014 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 8 [9 11.190 0 1] 9 2 10 [6 [7 [0 3] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 7 [0 3] 7 [9 5.622 0 1] 9 2 0 1] 0 2] 0 2] 9 2 0 1] [1 [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [9 22.378 0 63] 9 4 10 [6 0 126] 0 2] 9 2 10 [6 [0 60] 7 [0 3] 8 [8 [9 89.518 0 63] 9 4 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 0 2] 0 1] [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [8 [9 89.518 0 63] 9 10 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 6 [5 [1 0] 0 2] [8 [8 [9 22.378 0 127] 9 10 10 [6 0 254] 0 2] 9 2 10 [6 0 124] 0 2] 8 [8 [9 22.378 0 127] 9 4 10 [6 0 254] 0 2] 9 2 10 [6 [0 124] 0 6] 0 2] 0 1] 8 [1 0] [1 8 [8 [8 [9 22.378 0 31] 9 22 10 [6 0 62] 0 2] 9 2 10 [6 0 14] 0 2] 6 [5 [1 0] 0 2] [1 0] 0 5] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 4 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [7 [7 [9 5.622 0 1] 9 2 0 1] 9 2 0 1] [1 [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [[0 14] 1 0 0] 6 [5 [0 14] 0 124] [0 62] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 124] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 2.036] 0 2.038] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [9 92 0 31] 9 2 10 [6 [0 124] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [9 92 0 31] 9 2 10 [6 [0 59] 0 124] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 500] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 502] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 7 [10 [6 8 [9 22.395 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 [0 60] 0 6] 0 1] 9 2 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 50] 0 54] [1 8 [[8 [0 60] 9 2 10 [6 0 28] 0 2] 8 [0 61] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 1 1] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 105 118 105 100 101 45 98 121 45 122 101 114 111 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 358.123 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 3.061 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 101 99 114 101 109 101 110 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 6] [0 0] 8 [1 0] 8 [1 6 [5 [0 30] 4 0 6] [0 6] 9 2 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 6.014 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [6 [5 [0 12] 0 13] [1 1] 1 0] [6 [8 [1 6 [5 [1 0] 0 28] [1 0] 6 [6 [6 [5 [1 0] 0 29] [1 1] 1 0] [6 [9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 179.060 0 15] 9 2 10 [6 0 61] 0 2] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] 8 [1 0 0] [1 8 [[6 [6 [3 0 12] [1 1] 1 0] [0 12] 0 0] 6 [6 [3 0 13] [1 1] 1 0] [0 13] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 61] [0 6] 9 2 10 [61 8 [9 11.246 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 8 [7 [0 7] 1 1] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 1] 8 [9 4 0 7] 9 2 10 [6 [7 [0 3] 1 2] 7 [0 3] 9 2 10 [6 8 [9 179.060 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] 8 [1 0] [1 0 6] 0 1] [8 [1 0 [1 1] 0] [1 8 [9 358.122 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 53] 7 [0 3] 8 [9 11.246 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 59] 0 2] 0 2] 0 1] [8 [1 0] [1 8 [1 [6 [6 [3 0 14] [1 1] 1 0] [8 [9 5 0 1] 9 2 10 [6 [7 [0 3] 1 3.405.691.582] [7 [0 3] 1 32.767] 0 30] 0 2] 8 [8 [9 22 0 15] 9 2 10 [6 [7 [0 3] 1 5] [7 [0 3] 9 4 10 [14 0 28] 0 1] 7 [0 3] 9 4 10 [14 0 29] 0 1] 0 2] 8 [9 5 0 3] 9 2 10 [6 [7 [0 3] 1 3.735.928.559] [7 [0 3] 1 65.534] 0 6] 0 2] 8 [1 0 0 0] [1 8 [8 [9 89.534 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 8 [1 0] 8 [1 6 [5 [1 8] 0 6] [0 250] 8 [8 [9 764 0 511] 9 2 10 [6 [0 252] [0 30] 0 507] 0 2] 8 [8 [9 86 0 1.023] 9 2 10 [6 [7 [0 3] 8 [9 11.246 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 7 [0 3] 8 [9 358.122 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 0 2] 6 [5 [1 0] 0 2] [9 2 10 [124 4 0 508] 10 [6 4 0 30] 0 7] 0 2] 9 2 0 1] 0 1] 9 4 0 1] 0 1] 8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [1 0] 6 [5 [1 0] 0 61] [1 0] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [1 0] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 8 [9 383 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 89.519 0 7] 9 2 10 [6 7 [0 3] 8 [9 1.375 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] [8 [1 0] [1 8 [9 89.534 0 7] 9 2 10 [6 [7 [0 3] 1 0] 0 14] 0 2] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 58] 0 2] 8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 59] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 44.764 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 0 0] 8 [[8 [9 44.764 0 7] 9 2 10 [6 [7 [0 3] 8 [9 179.060 0 7] 9 2 10 [6 7 [0 3] 8 [9 2.810 0 7] 9 2 10 [6 0 14] 0 2] 0 2] 7 [0 3] 1 2] 0 2] 1 0] 8 [8 [1 8 [8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 22.394 0 31] 9 2 10 [6 0 28] 0 2] 0 2] 8 [8 [9 4 0 63] 9 2 10 [6 [0 6] 0 6] 0 2] 6 [5 [0 60] 1 0] [6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [[0 6] 0 2] [0 61] 8 [9 4 0 127] 9 2 10 [6 [0 125] 0 125] 0 2] 6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [9 2 10 [6 [8 [9 179.060 0 127] 9 2 10 [6 0 124] 0 2] 0 6] 0 7] 9 2 10 [12 8 [9 179.060 0 127] 9 2 10 [6 0 124] 0 2] 0 7] 9 2 0 1] [0 4] 8 [9 3.061 0 31] 9 2 10 [6 [0 62] 0 13] 0 2] 0 1] [8 [1 0 0] [1 [8 [1 6 [5 [1 0] 0 29] [1 0] 8 [9 348 0 15] 9 2 10 [6 [0 244] 7 [0 3] 9 2 10 [29 0 59] 0 1] 0 2] 9 2 0 1] 8 [9 6.015 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 8 [1 0] 8 [1 6 [5 [0 6] 1 2] [8 [9 340 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 8 [[8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 124] 0 2] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 125] 0 2] 6 [5 [0 4] 0 5] [9 2 10 [30 [8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 252] 0 2] 8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 253] 0 2] 10 [6 4 0 14] 0 3] 8 [9 358.123 0 63] 9 2 10 [6 [0 12] 0 13] 0 2] 9 2 0 1] 0 1] 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0 0] [1 6 [8 [9 340 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [1 0 0 0] [1 8 [9 348 0 7] 9 2 10 [6 [7 [0 3] 8 [9 179.035 0 7] 9 2 10 [6 [7 [0 3] [0 12] 8 [9 89.534 0 7] 9 2 10 [6 [0 28] 0 58] 0 2] 0 59] 0 2] 0 58] 0 2] 0 1] [[8 [1 0 0] [1 8 [[8 [9 22.398 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 22.398 0 7] 9 2 10 [6 0 29] 0 2] 6 [5 [0 4] 0 5] [8 [9 374 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 358.123 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [1 0] [0 29] 9 2 10 [28 8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 1] 9 2 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [6 [3 0 12] [1 1] 1 0] [6 [6 [3 0 13] [1 1] 1 0] [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 1 0] 6 [6 [3 0 13] [1 1] 1 0] [1 1] 6 [5 [0 24] 0 26] [9 2 10 [6 [0 25] 0 27] 0 1] 9 2 10 [6 [0 24] 0 26] 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [9 686 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 698 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 26] 7 [8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 0 6] [1 8 [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [[7 [9 89.983 0 1] 9 2 0 1] 7 [9 89.983 0 1] 9 2 0 1] [1 8 [1 8 [[0 114] 0 118] [1 8 [[8 [0 124] 9 2 10 [6 0 28] 0 2] 8 [0 125] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [7 [[[7 [0 28] 9 2 0 1] 7 [0 28] 9 2 0 1] 1 0] 8 [0 2] [1 0 15] 0 1] [1 [1 [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] [7 [0 252] 9 2 0 1] 7 [0 253] 9 2 0 1] [1 6 [5 [1 0] 0 12] [[[0 26] 0 27] 1 0 0] 6 [5 [0 48] 0 26] [10 [5 0 27] 0 12] 6 [8 [0 62] 9 2 10 [6 [0 58] 0 112] 0 2] [8 [9 2 10 [12 0 50] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [6 0 2] 0 28] 10 [7 10 [6 0 11] 0 28] 0 2] 0 0] 8 [9 2 10 [12 0 51] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [7 0 2] 0 28] 10 [6 10 [7 0 10] 0 28] 0 2] 0 0] 0 1] [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 0 12] [1 0] 6 [5 [0 13] 0 48] [[1 0] 0 49] 6 [8 [0 62] 9 2 10 [6 [0 29] 0 112] 0 2] [9 2 10 [12 0 50] 0 1] 9 2 10 [12 0 51] 0 1] 0 1] [8 [1 0] [1 8 [[7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 8 [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [0 254] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [0 254] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 9 2 0 1] 0 1] 8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 8 [9 10 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] 0 1] 0 1] 0 1] [8 [1 1 1] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 3.061 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 4 0 7] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 44.764 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] 8 [9 348 0 7] 9 2 10 [6 [7 [0 3] 8 [9 358.122 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 117] 0 2] 7 [0 3] 8 [9 179.035 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 7 [0 3] 9 2 10 [13 0 27] 0 1] 0 2] 0 2] 0 1] [8 [1 0 0] [1 6 [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [1 0 0] [1 8 [[8 [9 22.398 0 7] 9 2 10 [6 7 [0 3] 8 [9 22.398 0 7] 9 2 10 [6 0 28] 0 2] 0 2] 8 [9 22.398 0 7] 9 2 10 [6 7 [0 3] 8 [9 22.398 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 6 [5 [0 4] 0 5] [8 [9 374 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 358.123 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [[8 [8 [9 3.063 0 1] 10 [6 7 [0 3] 1 5] 0 2] 8 [1 0 0 0] [1 7 [10 [12 8 [9 358.122 0 59] 9 2 10 [6 [7 [0 3] 1 5] 0 28] 0 2] 0 1] 8 [8 [9 3.061 0 59] 9 2 10 [6 [0 58] 7 [0 3] 8 [9 89.534 0 59] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 0 2] 8 [8 [9 682 0 123] 9 2 10 [6 [7 [0 3] 8 [9 1.375 0 123] 9 2 10 [6 [7 [0 3] 1 3] 0 123] 0 2] 7 [0 3] 8 [9 186 0 123] 9 2 10 [6 [0 6] 7 [0 3] 1 0] 0 2] 0 2] 8 [8 [9 44.764 0 251] 9 2 10 [6 [0 250] 7 [0 3] 1 4] 0 2] 8 [0 124] 8 [1 3.432.918.353 461.845.907] 8 [8 [9 1.375 0 2.043] 9 2 10 [6 [7 [0 3] 1 5] 0 2.043] 0 2] 8 [0 30] 7 [10 [30 8 [0 30] 8 [1 6 [5 [1 0] 0 14] [0 6] 8 [8 [9 84 0 32.763] 9 2 10 [6 [7 [0 3] 8 [9 3.061 0 32.763] 9 2 10 [6 [0 510] 0 30] 0 2] 0 62] 0 2] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 508] 0 2] 0 2] 0 1] 7 [10 [2 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 6] 0 2] 0 1] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 509] 0 2] 0 2] 0 1] 7 [10 [14 8 [9 86 0 65.531] 9 2 10 [6 [0 30] 0 6] 0 2] 0 1] 7 [10 [14 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 13] 0 30] 0 2] 0 1] 7 [10 [14 8 [9 4 0 16.382] 9 2 10 [6 [7 [0 3] 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 30] 7 [0 3] 1 5] 0 2] 0 2] 7 [0 3] 1 3.864.292.196] 0 2] 0 1] 9 2 10 [14 8 [9 179.060 0 65.531] 9 2 10 [6 0 62] 0 2] 0 3] 9 2 0 1] 0 1] 8 [8 [9 11.188 0 8.187] 9 2 10 [6 [7 [0 3] 8 [9 4 0 8.187] 9 2 10 [6 [7 [0 3] 1 4] 0 126] 0 2] 0 254] 0 2] 8 [1 0] 8 [8 [9 350 0 32.763] 9 2 10 [6 [0 32.762] 7 [0 3] 1 3] 0 2] 7 [10 [254 6 [5 [1 3] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 16] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 2] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 2] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 1] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 11 [1.936.945.012 1 0] 0 254] 0 1] 7 [10 [254 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 65.530] 0 2] 0 1] 8 [1 [8 [9 5 0 1] 9 2 10 [6 0 1.022] 0 2] 8 [1 0] [1 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 2.246.822.507] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 13] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 3.266.489.909] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 0 6] 0 1] 9 4 0 1] 0 1] [[8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 117 98 116 114 97 99 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 12] 9 2 10 [6 [8 [9 179.060 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 179.060 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 13] 1 0] [1 1] 8 [1 6 [5 [0 29] 1 1] [0 28] 8 [9 2 10 [29 8 [9 44.764 0 15] 9 2 10 [6 [0 61] 7 [0 3] 1 2] 0 2] 0 1] 8 [8 [9 4 0 31] 9 2 10 [6 [0 6] 0 6] 0 2] 8 [8 [9 350 0 63] 9 2 10 [6 [0 253] 7 [0 3] 1 1] 0 2] 6 [5 [1 0] 0 2] [0 6] 7 [0 3] 8 [9 4 0 63] 9 2 10 [6 [0 6] 0 252] 0 2] 9 2 0 1] 0 1] 8 [1 0] [1 [8 [1 0 0] [1 8 [9 11 0 7] 9 2 10 [6 7 [0 3] 8 [9 348 0 31] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 1] [8 [1 0 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 59] 0 2] 8 [8 [9 22.394 0 63] 9 2 10 [6 7 [0 3] 8 [9 3.061 0 63] 9 2 10 [6 [0 126] 0 60] 0 2] 0 2] 8 [8 [9 6.014 0 127] 9 2 10 [6 [0 250] 0 6] 0 2] 8 [9 11 0 63] 9 2 10 [6 7 [0 3] 8 [9 2.798 0 255] 9 2 10 [6 [7 [0 3] 8 [9 179.035 0 255] 9 2 10 [6 [7 [0 3] [0 124] 0 2] 0 30] 0 2] 7 [0 3] 8 [9 11.246 0 255] 9 2 10 [6 [7 [0 3] [0 124] 8 [9 3.061 0 255] 9 2 10 [6 [0 14] 0 6] 0 2] 0 30] 0 2] 0 2] 0 2] 0 1] 8 [1 0] [1 8 [9 358.122 0 31] 9 2 10 [6 [0 62] 0 14] 0 2] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [1 0] 8 [1 6 [5 [1 0] 0 125] [1 0] 8 [9 348 0 63] 9 2 10 [6 [7 [0 3] 9 2 10 [125 0 251] 10 [6 4 0 6] 0 1] 7 [0 3] 8 [9 179.035 0 63] 9 2 10 [6 [7 [0 3] [0 28] 8 [9 4 0 63] 9 2 10 [6 [0 61] 0 14] 0 2] 7 [0 3] 8 [9 358.122 0 63] 9 2 10 [6 [7 [0 3] [0 28] 0 29] 0 506] 0 2] 0 2] 0 2] 9 2 0 1] 0 1] 506.013.904.830.974.705.962.590.204.844.663.393]]] name='lib'] next=[%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=6] q=%.n]] next=[%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=7] q=%.n]] next=[%call pos=[0 0] func=[%limb p=~[[%name p=%lib] [%name p=%mul]]] arg=[~ [p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%b]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/hoon-arithmetic.hoon b/crates/jockt/hoon/tests/lib/hoon-arithmetic.hoon index ce475f4..1363796 100644 --- a/crates/jockt/hoon/tests/lib/hoon-arithmetic.hoon +++ b/crates/jockt/hoon/tests/lib/hoon-arithmetic.hoon @@ -8,13 +8,13 @@ 'import hoon;\0a\0alet a:@ = 5;\0alet b:@ = 37;\0a\0a(\0a hoon.dec(43)\0a hoon.add(5 37)\0a hoon.add(a b)\0a hoon.sub(47 a)\0a hoon.lent([1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42])\0a)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %import] [%name %hoon] [%punctuator %';'] [%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=37] q=%.n]] [%punctuator %';'] [%punctuator %'('] [%name %hoon] [%punctuator %'.'] [%name %dec] [%punctuator %'(('] [%literal [[%number p=43] q=%.n]] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=5] q=%.n]] [%literal [[%number p=37] q=%.n]] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%name %a] [%name %b] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %sub] [%punctuator %'(('] [%literal [[%number p=47] q=%.n]] [%name %a] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %lent] [%punctuator %'(('] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=4] q=%.n]] [%literal [[%number p=5] q=%.n]] [%literal [[%number p=6] q=%.n]] [%literal [[%number p=7] q=%.n]] [%literal [[%number p=8] q=%.n]] [%literal [[%number p=9] q=%.n]] [%literal [[%number p=10] q=%.n]] [%literal [[%number p=11] q=%.n]] [%literal [[%number p=12] q=%.n]] [%literal [[%number p=13] q=%.n]] [%literal [[%number p=14] q=%.n]] [%literal [[%number p=15] q=%.n]] [%literal [[%number p=16] q=%.n]] [%literal [[%number p=17] q=%.n]] [%literal [[%number p=18] q=%.n]] [%literal [[%number p=19] q=%.n]] [%literal [[%number p=20] q=%.n]] [%literal [[%number p=21] q=%.n]] [%literal [[%number p=22] q=%.n]] [%literal [[%number p=23] q=%.n]] [%literal [[%number p=24] q=%.n]] [%literal [[%number p=25] q=%.n]] [%literal [[%number p=26] q=%.n]] [%literal [[%number p=27] q=%.n]] [%literal [[%number p=28] q=%.n]] [%literal [[%number p=29] q=%.n]] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=31] q=%.n]] [%literal [[%number p=32] q=%.n]] [%literal [[%number p=33] q=%.n]] [%literal [[%number p=34] q=%.n]] [%literal [[%number p=35] q=%.n]] [%literal [[%number p=36] q=%.n]] [%literal [[%number p=37] q=%.n]] [%literal [[%number p=38] q=%.n]] [%literal [[%number p=39] q=%.n]] [%literal [[%number p=40] q=%.n]] [%literal [[%number p=41] q=%.n]] [%literal [[%number p=42] q=%.n]] [%punctuator %']'] [%punctuator %')'] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %import] [%name %hoon] [%punctuator %';'] [%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=37] q=%.n]] [%punctuator %';'] [%punctuator %'('] [%name %hoon] [%punctuator %'.'] [%name %dec] [%punctuator %'(('] [%literal [[%number p=43] q=%.n]] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=5] q=%.n]] [%literal [[%number p=37] q=%.n]] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%name %a] [%name %b] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %sub] [%punctuator %'(('] [%literal [[%number p=47] q=%.n]] [%name %a] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %lent] [%punctuator %'(('] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=4] q=%.n]] [%literal [[%number p=5] q=%.n]] [%literal [[%number p=6] q=%.n]] [%literal [[%number p=7] q=%.n]] [%literal [[%number p=8] q=%.n]] [%literal [[%number p=9] q=%.n]] [%literal [[%number p=10] q=%.n]] [%literal [[%number p=11] q=%.n]] [%literal [[%number p=12] q=%.n]] [%literal [[%number p=13] q=%.n]] [%literal [[%number p=14] q=%.n]] [%literal [[%number p=15] q=%.n]] [%literal [[%number p=16] q=%.n]] [%literal [[%number p=17] q=%.n]] [%literal [[%number p=18] q=%.n]] [%literal [[%number p=19] q=%.n]] [%literal [[%number p=20] q=%.n]] [%literal [[%number p=21] q=%.n]] [%literal [[%number p=22] q=%.n]] [%literal [[%number p=23] q=%.n]] [%literal [[%number p=24] q=%.n]] [%literal [[%number p=25] q=%.n]] [%literal [[%number p=26] q=%.n]] [%literal [[%number p=27] q=%.n]] [%literal [[%number p=28] q=%.n]] [%literal [[%number p=29] q=%.n]] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=31] q=%.n]] [%literal [[%number p=32] q=%.n]] [%literal [[%number p=33] q=%.n]] [%literal [[%number p=34] q=%.n]] [%literal [[%number p=35] q=%.n]] [%literal [[%number p=36] q=%.n]] [%literal [[%number p=37] q=%.n]] [%literal [[%number p=38] q=%.n]] [%literal [[%number p=39] q=%.n]] [%literal [[%number p=40] q=%.n]] [%literal [[%number p=41] q=%.n]] [%literal [[%number p=42] q=%.n]] [%punctuator %']'] [%punctuator %')'] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%import name=[p=[%hoon p=[#t/<64.kjn %ab-urbe-condita> q=[[[8 [1 1 1] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 179.060 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 348 0 31] 9 2 10 [6 [0 125] 0 14] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 29] [11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 110 97 103 45 102 97 105 108 0] 9 2 0 1] 0 1] 0 0] 6 [5 [1 0] 0 28] [0 58] 9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 0] 1 1] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 12] [10 [1 0 13] 0 12] 10 [3 9 2 10 [12 0 25] 0 1] 0 12] 0 1] 8 [1 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 7 [0 3] 8 [9 11.190 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 22.378 0 127] 9 23 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[6 [5 [1 0] 0 12] [1 0] 0 0] 8 [0 30] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] [8 [9 358.122 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 9 2 10 [13 8 [9 11.246 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 5 [8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 9 2 10 [6 [8 [9 179.060 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 89.518 0 127] 9 11 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 0] [1 8 [6 [3 0 6] [[8 [7 [0 7] 9 11.196 0 1] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 9 89.535 0 1] 9 2 10 [6 0 29] 0 2] 8 [7 [0 7] 9 11.196 0 1] 9 2 10 [6 0 14] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [0 29] 6 [5 [1 0] 0 29] [1 0] 9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 7 [9 11.190 0 1] 9 2 0 1] 0 2] 9 2 0 1] 7 [0 1] [1 [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 62] [[[0 28] 0 29] 1 0 0] 6 [5 [0 28] 0 248] [6 [5 [0 29] 0 249] [0 62] 10 [2 [0 28] 0 29] 0 62] 6 [8 [9 92 0 63] 9 2 10 [6 [0 60] 0 504] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 4.072] 0 4.076] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] [8 [1 0] [1 7 [10 [6 0 6] 0 1] 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [[1 0] 0 249] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [9 2 10 [62 0 250] 0 1] 9 2 10 [62 0 251] 0 1] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 6 [8 [9 92 0 31] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [0 120] 0 25] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 13] [1 0] 6 [8 [9 92 0 31] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [0 27] 0 120] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [6 [5 [0 120] 0 488] [1 1] 1 0] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [6 [5 [0 120] 0 492] [1 1] 1 0] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] [[8 [1 1 1] [1 [8 [9 44.764 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 8 [9 6.014 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 8 [9 11.190 0 1] 9 2 10 [6 [7 [0 3] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 7 [0 3] 7 [9 5.622 0 1] 9 2 0 1] 0 2] 0 2] 9 2 0 1] [1 [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [9 22.378 0 63] 9 4 10 [6 0 126] 0 2] 9 2 10 [6 [0 60] 7 [0 3] 8 [8 [9 89.518 0 63] 9 4 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 0 2] 0 1] [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [8 [9 89.518 0 63] 9 10 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 6 [5 [1 0] 0 2] [8 [8 [9 22.378 0 127] 9 10 10 [6 0 254] 0 2] 9 2 10 [6 0 124] 0 2] 8 [8 [9 22.378 0 127] 9 4 10 [6 0 254] 0 2] 9 2 10 [6 [0 124] 0 6] 0 2] 0 1] 8 [1 0] [1 8 [8 [8 [9 22.378 0 31] 9 22 10 [6 0 62] 0 2] 9 2 10 [6 0 14] 0 2] 6 [5 [1 0] 0 2] [1 0] 0 5] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 4 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [7 [7 [9 5.622 0 1] 9 2 0 1] 9 2 0 1] [1 [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [[0 14] 1 0 0] 6 [5 [0 14] 0 124] [0 62] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 124] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 2.036] 0 2.038] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [9 92 0 31] 9 2 10 [6 [0 124] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [9 92 0 31] 9 2 10 [6 [0 59] 0 124] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 500] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 502] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 7 [10 [6 8 [9 22.395 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 [0 60] 0 6] 0 1] 9 2 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 50] 0 54] [1 8 [[8 [0 60] 9 2 10 [6 0 28] 0 2] 8 [0 61] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 1 1] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 105 118 105 100 101 45 98 121 45 122 101 114 111 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 358.123 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 3.061 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 101 99 114 101 109 101 110 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 6] [0 0] 8 [1 0] 8 [1 6 [5 [0 30] 4 0 6] [0 6] 9 2 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 6.014 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [6 [5 [0 12] 0 13] [1 1] 1 0] [6 [8 [1 6 [5 [1 0] 0 28] [1 0] 6 [6 [6 [5 [1 0] 0 29] [1 1] 1 0] [6 [9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 179.060 0 15] 9 2 10 [6 0 61] 0 2] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] 8 [1 0 0] [1 8 [[6 [6 [3 0 12] [1 1] 1 0] [0 12] 0 0] 6 [6 [3 0 13] [1 1] 1 0] [0 13] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 61] [0 6] 9 2 10 [61 8 [9 11.246 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 8 [7 [0 7] 1 1] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 1] 8 [9 4 0 7] 9 2 10 [6 [7 [0 3] 1 2] 7 [0 3] 9 2 10 [6 8 [9 179.060 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] 8 [1 0] [1 0 6] 0 1] [8 [1 0 [1 1] 0] [1 8 [9 358.122 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 53] 7 [0 3] 8 [9 11.246 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 59] 0 2] 0 2] 0 1] [8 [1 0] [1 8 [1 [6 [6 [3 0 14] [1 1] 1 0] [8 [9 5 0 1] 9 2 10 [6 [7 [0 3] 1 3.405.691.582] [7 [0 3] 1 32.767] 0 30] 0 2] 8 [8 [9 22 0 15] 9 2 10 [6 [7 [0 3] 1 5] [7 [0 3] 9 4 10 [14 0 28] 0 1] 7 [0 3] 9 4 10 [14 0 29] 0 1] 0 2] 8 [9 5 0 3] 9 2 10 [6 [7 [0 3] 1 3.735.928.559] [7 [0 3] 1 65.534] 0 6] 0 2] 8 [1 0 0 0] [1 8 [8 [9 89.534 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 8 [1 0] 8 [1 6 [5 [1 8] 0 6] [0 250] 8 [8 [9 764 0 511] 9 2 10 [6 [0 252] [0 30] 0 507] 0 2] 8 [8 [9 86 0 1.023] 9 2 10 [6 [7 [0 3] 8 [9 11.246 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 7 [0 3] 8 [9 358.122 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 0 2] 6 [5 [1 0] 0 2] [9 2 10 [124 4 0 508] 10 [6 4 0 30] 0 7] 0 2] 9 2 0 1] 0 1] 9 4 0 1] 0 1] 8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [1 0] 6 [5 [1 0] 0 61] [1 0] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [1 0] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 8 [9 383 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 89.519 0 7] 9 2 10 [6 7 [0 3] 8 [9 1.375 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] [8 [1 0] [1 8 [9 89.534 0 7] 9 2 10 [6 [7 [0 3] 1 0] 0 14] 0 2] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 58] 0 2] 8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 59] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 44.764 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 0 0] 8 [[8 [9 44.764 0 7] 9 2 10 [6 [7 [0 3] 8 [9 179.060 0 7] 9 2 10 [6 7 [0 3] 8 [9 2.810 0 7] 9 2 10 [6 0 14] 0 2] 0 2] 7 [0 3] 1 2] 0 2] 1 0] 8 [8 [1 8 [8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 22.394 0 31] 9 2 10 [6 0 28] 0 2] 0 2] 8 [8 [9 4 0 63] 9 2 10 [6 [0 6] 0 6] 0 2] 6 [5 [0 60] 1 0] [6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [[0 6] 0 2] [0 61] 8 [9 4 0 127] 9 2 10 [6 [0 125] 0 125] 0 2] 6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [9 2 10 [6 [8 [9 179.060 0 127] 9 2 10 [6 0 124] 0 2] 0 6] 0 7] 9 2 10 [12 8 [9 179.060 0 127] 9 2 10 [6 0 124] 0 2] 0 7] 9 2 0 1] [0 4] 8 [9 3.061 0 31] 9 2 10 [6 [0 62] 0 13] 0 2] 0 1] [8 [1 0 0] [1 [8 [1 6 [5 [1 0] 0 29] [1 0] 8 [9 348 0 15] 9 2 10 [6 [0 244] 7 [0 3] 9 2 10 [29 0 59] 0 1] 0 2] 9 2 0 1] 8 [9 6.015 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 8 [1 0] 8 [1 6 [5 [0 6] 1 2] [8 [9 340 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 8 [[8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 124] 0 2] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 125] 0 2] 6 [5 [0 4] 0 5] [9 2 10 [30 [8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 252] 0 2] 8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 253] 0 2] 10 [6 4 0 14] 0 3] 8 [9 358.123 0 63] 9 2 10 [6 [0 12] 0 13] 0 2] 9 2 0 1] 0 1] 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0 0] [1 6 [8 [9 340 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [1 0 0 0] [1 8 [9 348 0 7] 9 2 10 [6 [7 [0 3] 8 [9 179.035 0 7] 9 2 10 [6 [7 [0 3] [0 12] 8 [9 89.534 0 7] 9 2 10 [6 [0 28] 0 58] 0 2] 0 59] 0 2] 0 58] 0 2] 0 1] [[8 [1 0 0] [1 8 [[8 [9 22.398 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 22.398 0 7] 9 2 10 [6 0 29] 0 2] 6 [5 [0 4] 0 5] [8 [9 374 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 358.123 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [1 0] [0 29] 9 2 10 [28 8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 1] 9 2 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [6 [3 0 12] [1 1] 1 0] [6 [6 [3 0 13] [1 1] 1 0] [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 1 0] 6 [6 [3 0 13] [1 1] 1 0] [1 1] 6 [5 [0 24] 0 26] [9 2 10 [6 [0 25] 0 27] 0 1] 9 2 10 [6 [0 24] 0 26] 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [9 686 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 698 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 26] 7 [8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 0 6] [1 8 [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [[7 [9 89.983 0 1] 9 2 0 1] 7 [9 89.983 0 1] 9 2 0 1] [1 8 [1 8 [[0 114] 0 118] [1 8 [[8 [0 124] 9 2 10 [6 0 28] 0 2] 8 [0 125] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [7 [[[7 [0 28] 9 2 0 1] 7 [0 28] 9 2 0 1] 1 0] 8 [0 2] [1 0 15] 0 1] [1 [1 [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] [7 [0 252] 9 2 0 1] 7 [0 253] 9 2 0 1] [1 6 [5 [1 0] 0 12] [[[0 26] 0 27] 1 0 0] 6 [5 [0 48] 0 26] [10 [5 0 27] 0 12] 6 [8 [0 62] 9 2 10 [6 [0 58] 0 112] 0 2] [8 [9 2 10 [12 0 50] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [6 0 2] 0 28] 10 [7 10 [6 0 11] 0 28] 0 2] 0 0] 8 [9 2 10 [12 0 51] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [7 0 2] 0 28] 10 [6 10 [7 0 10] 0 28] 0 2] 0 0] 0 1] [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 0 12] [1 0] 6 [5 [0 13] 0 48] [[1 0] 0 49] 6 [8 [0 62] 9 2 10 [6 [0 29] 0 112] 0 2] [9 2 10 [12 0 50] 0 1] 9 2 10 [12 0 51] 0 1] 0 1] [8 [1 0] [1 8 [[7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 8 [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [0 254] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [0 254] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 9 2 0 1] 0 1] 8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 8 [9 10 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] 0 1] 0 1] 0 1] [8 [1 1 1] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 3.061 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 4 0 7] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 44.764 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] 8 [9 348 0 7] 9 2 10 [6 [7 [0 3] 8 [9 358.122 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 117] 0 2] 7 [0 3] 8 [9 179.035 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 7 [0 3] 9 2 10 [13 0 27] 0 1] 0 2] 0 2] 0 1] [8 [1 0 0] [1 6 [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [1 0 0] [1 8 [[8 [9 22.398 0 7] 9 2 10 [6 7 [0 3] 8 [9 22.398 0 7] 9 2 10 [6 0 28] 0 2] 0 2] 8 [9 22.398 0 7] 9 2 10 [6 7 [0 3] 8 [9 22.398 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 6 [5 [0 4] 0 5] [8 [9 374 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 358.123 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [[8 [8 [9 3.063 0 1] 10 [6 7 [0 3] 1 5] 0 2] 8 [1 0 0 0] [1 7 [10 [12 8 [9 358.122 0 59] 9 2 10 [6 [7 [0 3] 1 5] 0 28] 0 2] 0 1] 8 [8 [9 3.061 0 59] 9 2 10 [6 [0 58] 7 [0 3] 8 [9 89.534 0 59] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 0 2] 8 [8 [9 682 0 123] 9 2 10 [6 [7 [0 3] 8 [9 1.375 0 123] 9 2 10 [6 [7 [0 3] 1 3] 0 123] 0 2] 7 [0 3] 8 [9 186 0 123] 9 2 10 [6 [0 6] 7 [0 3] 1 0] 0 2] 0 2] 8 [8 [9 44.764 0 251] 9 2 10 [6 [0 250] 7 [0 3] 1 4] 0 2] 8 [0 124] 8 [1 3.432.918.353 461.845.907] 8 [8 [9 1.375 0 2.043] 9 2 10 [6 [7 [0 3] 1 5] 0 2.043] 0 2] 8 [0 30] 7 [10 [30 8 [0 30] 8 [1 6 [5 [1 0] 0 14] [0 6] 8 [8 [9 84 0 32.763] 9 2 10 [6 [7 [0 3] 8 [9 3.061 0 32.763] 9 2 10 [6 [0 510] 0 30] 0 2] 0 62] 0 2] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 508] 0 2] 0 2] 0 1] 7 [10 [2 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 6] 0 2] 0 1] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 509] 0 2] 0 2] 0 1] 7 [10 [14 8 [9 86 0 65.531] 9 2 10 [6 [0 30] 0 6] 0 2] 0 1] 7 [10 [14 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 13] 0 30] 0 2] 0 1] 7 [10 [14 8 [9 4 0 16.382] 9 2 10 [6 [7 [0 3] 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 30] 7 [0 3] 1 5] 0 2] 0 2] 7 [0 3] 1 3.864.292.196] 0 2] 0 1] 9 2 10 [14 8 [9 179.060 0 65.531] 9 2 10 [6 0 62] 0 2] 0 3] 9 2 0 1] 0 1] 8 [8 [9 11.188 0 8.187] 9 2 10 [6 [7 [0 3] 8 [9 4 0 8.187] 9 2 10 [6 [7 [0 3] 1 4] 0 126] 0 2] 0 254] 0 2] 8 [1 0] 8 [8 [9 350 0 32.763] 9 2 10 [6 [0 32.762] 7 [0 3] 1 3] 0 2] 7 [10 [254 6 [5 [1 3] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 16] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 2] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 2] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 1] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 11 [1.936.945.012 1 0] 0 254] 0 1] 7 [10 [254 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 65.530] 0 2] 0 1] 8 [1 [8 [9 5 0 1] 9 2 10 [6 0 1.022] 0 2] 8 [1 0] [1 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 2.246.822.507] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 13] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 3.266.489.909] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 0 6] 0 1] 9 4 0 1] 0 1] [[8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 117 98 116 114 97 99 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 12] 9 2 10 [6 [8 [9 179.060 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 179.060 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 13] 1 0] [1 1] 8 [1 6 [5 [0 29] 1 1] [0 28] 8 [9 2 10 [29 8 [9 44.764 0 15] 9 2 10 [6 [0 61] 7 [0 3] 1 2] 0 2] 0 1] 8 [8 [9 4 0 31] 9 2 10 [6 [0 6] 0 6] 0 2] 8 [8 [9 350 0 63] 9 2 10 [6 [0 253] 7 [0 3] 1 1] 0 2] 6 [5 [1 0] 0 2] [0 6] 7 [0 3] 8 [9 4 0 63] 9 2 10 [6 [0 6] 0 252] 0 2] 9 2 0 1] 0 1] 8 [1 0] [1 [8 [1 0 0] [1 8 [9 11 0 7] 9 2 10 [6 7 [0 3] 8 [9 348 0 31] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 1] [8 [1 0 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 59] 0 2] 8 [8 [9 22.394 0 63] 9 2 10 [6 7 [0 3] 8 [9 3.061 0 63] 9 2 10 [6 [0 126] 0 60] 0 2] 0 2] 8 [8 [9 6.014 0 127] 9 2 10 [6 [0 250] 0 6] 0 2] 8 [9 11 0 63] 9 2 10 [6 7 [0 3] 8 [9 2.798 0 255] 9 2 10 [6 [7 [0 3] 8 [9 179.035 0 255] 9 2 10 [6 [7 [0 3] [0 124] 0 2] 0 30] 0 2] 7 [0 3] 8 [9 11.246 0 255] 9 2 10 [6 [7 [0 3] [0 124] 8 [9 3.061 0 255] 9 2 10 [6 [0 14] 0 6] 0 2] 0 30] 0 2] 0 2] 0 2] 0 1] 8 [1 0] [1 8 [9 358.122 0 31] 9 2 10 [6 [0 62] 0 14] 0 2] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [1 0] 8 [1 6 [5 [1 0] 0 125] [1 0] 8 [9 348 0 63] 9 2 10 [6 [7 [0 3] 9 2 10 [125 0 251] 10 [6 4 0 6] 0 1] 7 [0 3] 8 [9 179.035 0 63] 9 2 10 [6 [7 [0 3] [0 28] 8 [9 4 0 63] 9 2 10 [6 [0 61] 0 14] 0 2] 7 [0 3] 8 [9 358.122 0 63] 9 2 10 [6 [7 [0 3] [0 28] 0 29] 0 506] 0 2] 0 2] 0 2] 9 2 0 1] 0 1] 506.013.904.830.974.705.962.590.204.844.663.393]]] name='hoon'] next=[%let type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=5] q=%.n]] next=[%let type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=37] q=%.n]] next=[p=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%dec]]] arg=[~ [%atom p=[[%number p=43] q=%.n]]]] q=[p=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=5] q=%.n]] q=[%atom p=[[%number p=37] q=%.n]]]]] q=[p=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%add]]] arg=[~ [p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%b]]]]]] q=[p=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%sub]]] arg=[~ [p=[%atom p=[[%number p=47] q=%.n]] q=[%limb p=~[[%name p=%a]]]]]] q=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%lent]]] arg=[~ [%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=3] q=%.n]] [%atom p=[[%number p=4] q=%.n]] [%atom p=[[%number p=5] q=%.n]] [%atom p=[[%number p=6] q=%.n]] [%atom p=[[%number p=7] q=%.n]] [%atom p=[[%number p=8] q=%.n]] [%atom p=[[%number p=9] q=%.n]] [%atom p=[[%number p=10] q=%.n]] [%atom p=[[%number p=11] q=%.n]] [%atom p=[[%number p=12] q=%.n]] [%atom p=[[%number p=13] q=%.n]] [%atom p=[[%number p=14] q=%.n]] [%atom p=[[%number p=15] q=%.n]] [%atom p=[[%number p=16] q=%.n]] [%atom p=[[%number p=17] q=%.n]] [%atom p=[[%number p=18] q=%.n]] [%atom p=[[%number p=19] q=%.n]] [%atom p=[[%number p=20] q=%.n]] [%atom p=[[%number p=21] q=%.n]] [%atom p=[[%number p=22] q=%.n]] [%atom p=[[%number p=23] q=%.n]] [%atom p=[[%number p=24] q=%.n]] [%atom p=[[%number p=25] q=%.n]] [%atom p=[[%number p=26] q=%.n]] [%atom p=[[%number p=27] q=%.n]] [%atom p=[[%number p=28] q=%.n]] [%atom p=[[%number p=29] q=%.n]] [%atom p=[[%number p=30] q=%.n]] [%atom p=[[%number p=31] q=%.n]] [%atom p=[[%number p=32] q=%.n]] [%atom p=[[%number p=33] q=%.n]] [%atom p=[[%number p=34] q=%.n]] [%atom p=[[%number p=35] q=%.n]] [%atom p=[[%number p=36] q=%.n]] [%atom p=[[%number p=37] q=%.n]] [%atom p=[[%number p=38] q=%.n]] [%atom p=[[%number p=39] q=%.n]] [%atom p=[[%number p=40] q=%.n]] [%atom p=[[%number p=41] q=%.n]] [%atom p=[[%number p=42] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]]]]]]]]]]] + [%import pos=[0 0] name=[p=[%hoon p=[#t/<64.kjn %ab-urbe-condita> q=[[[8 [1 1 1] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 179.060 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 348 0 31] 9 2 10 [6 [0 125] 0 14] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 29] [11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 110 97 103 45 102 97 105 108 0] 9 2 0 1] 0 1] 0 0] 6 [5 [1 0] 0 28] [0 58] 9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 0] 1 1] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 12] [10 [1 0 13] 0 12] 10 [3 9 2 10 [12 0 25] 0 1] 0 12] 0 1] 8 [1 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 7 [0 3] 8 [9 11.190 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 22.378 0 127] 9 23 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[6 [5 [1 0] 0 12] [1 0] 0 0] 8 [0 30] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] [8 [9 358.122 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 9 2 10 [13 8 [9 11.246 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 5 [8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 9 2 10 [6 [8 [9 179.060 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [8 [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 14] 0 2] 6 [8 [7 [0 3] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 8 [9 89.518 0 127] 9 11 10 [6 0 14] 0 2] 0 1] 9 2 10 [6 0 6] 0 2] [0 2] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 0] [1 8 [6 [3 0 6] [[8 [7 [0 7] 9 11.196 0 1] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 9 89.535 0 1] 9 2 10 [6 0 29] 0 2] 8 [7 [0 7] 9 11.196 0 1] 9 2 10 [6 0 14] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] [[8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [0 29] 6 [5 [1 0] 0 29] [1 0] 9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 59] 0 1] 9 2 0 1] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 7 [9 11.190 0 1] 9 2 0 1] 0 2] 9 2 0 1] 7 [0 1] [1 [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 62] [[[0 28] 0 29] 1 0 0] 6 [5 [0 28] 0 248] [6 [5 [0 29] 0 249] [0 62] 10 [2 [0 28] 0 29] 0 62] 6 [8 [9 92 0 63] 9 2 10 [6 [0 60] 0 504] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 1.016] 0 24] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 4.072] 0 4.076] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] [8 [1 0] [1 7 [10 [6 0 6] 0 1] 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 248] [[1 0] 0 249] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 504] 0 2] [9 2 10 [62 0 250] 0 1] 9 2 10 [62 0 251] 0 1] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 6 [8 [9 92 0 31] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [0 120] 0 25] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 13] [1 0] 6 [8 [9 92 0 31] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [0 27] 0 120] [1 1] 1 0] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [6 [5 [0 120] 0 488] [1 1] 1 0] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [6 [5 [0 120] 0 492] [1 1] 1 0] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] [[8 [1 1 1] [1 [8 [9 44.764 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 8 [9 6.014 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [7 [8 [9 5.622 0 1] 9 2 10 [6 7 [0 3] 8 [9 11.190 0 1] 9 2 10 [6 [7 [0 3] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 7 [0 3] 7 [9 5.622 0 1] 9 2 0 1] 0 2] 0 2] 9 2 0 1] [1 [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [9 22.378 0 63] 9 4 10 [6 0 126] 0 2] 9 2 10 [6 [0 60] 7 [0 3] 8 [8 [9 89.518 0 63] 9 4 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 0 2] 0 1] [8 [1 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 28] 0 2] 8 [8 [8 [9 89.518 0 63] 9 10 10 [6 0 6] 0 2] 9 2 10 [6 0 61] 0 2] 6 [5 [1 0] 0 2] [8 [8 [9 22.378 0 127] 9 10 10 [6 0 254] 0 2] 9 2 10 [6 0 124] 0 2] 8 [8 [9 22.378 0 127] 9 4 10 [6 0 254] 0 2] 9 2 10 [6 [0 124] 0 6] 0 2] 0 1] 8 [1 0] [1 8 [8 [8 [9 22.378 0 31] 9 22 10 [6 0 62] 0 2] 9 2 10 [6 0 14] 0 2] 6 [5 [1 0] 0 2] [1 0] 0 5] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 4 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [7 [7 [9 5.622 0 1] 9 2 0 1] 9 2 0 1] [1 [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [[0 14] 1 0 0] 6 [5 [0 14] 0 124] [0 62] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [8 [9 2 10 [62 0 250] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [6 0 2] 0 126] 10 [7 10 [6 0 11] 0 126] 0 2] 0 0] 8 [9 2 10 [62 0 251] 0 1] 6 [3 0 2] [6 [8 [9 190 0 127] 9 2 10 [6 [0 508] 0 12] 0 2] [10 [7 0 2] 0 126] 10 [6 10 [7 0 10] 0 126] 0 2] 0 0] 9 2 0 1] 0 1] [8 [1 0] [1 8 [1 6 [5 [1 0] 0 62] [1 0] 6 [5 [0 14] 0 124] [8 [1 6 [5 [1 0] 0 506] [0 507] 6 [5 [1 0] 0 507] [0 506] 6 [8 [9 190 0 127] 9 2 10 [6 [0 2.036] 0 2.038] 0 2] [10 [7 9 2 10 [506 0 2.027] 0 1] 0 506] 10 [6 9 2 10 [507 0 2.030] 0 1] 0 507] 9 2 0 1] 6 [8 [9 92 0 63] 9 2 10 [6 [0 30] 0 252] 0 2] [10 [6 9 2 10 [62 0 250] 0 1] 0 62] 10 [7 9 2 10 [62 0 251] 0 1] 0 62] 9 2 0 1] 0 1] 7 [8 [[7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] 7 [7 [9 1.374 0 7] 9 2 0 1] 9 2 0 1] [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [9 92 0 31] 9 2 10 [6 [0 124] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [9 92 0 31] 9 2 10 [6 [0 59] 0 124] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 500] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 31] 9 2 10 [6 [0 124] 0 502] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 60] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 7 [10 [6 8 [9 22.395 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 8 [1 0] 8 [1 6 [5 [1 0] 0 30] [0 6] 9 2 10 [30 0 61] 10 [6 [0 60] 0 6] 0 1] 9 2 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 50] 0 54] [1 8 [[8 [0 60] 9 2 10 [6 0 28] 0 2] 8 [0 61] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [[8 [1 1 1] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 105 118 105 100 101 45 98 121 45 122 101 114 111 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 358.123 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 3.061 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 100 101 99 114 101 109 101 110 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 6] [0 0] 8 [1 0] 8 [1 6 [5 [0 30] 4 0 6] [0 6] 9 2 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] [8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 6.014 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [6 [5 [0 12] 0 13] [1 1] 1 0] [6 [8 [1 6 [5 [1 0] 0 28] [1 0] 6 [6 [6 [5 [1 0] 0 29] [1 1] 1 0] [6 [9 2 10 [14 [8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 179.060 0 15] 9 2 10 [6 0 61] 0 2] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] 8 [1 0 0] [1 8 [[6 [6 [3 0 12] [1 1] 1 0] [0 12] 0 0] 6 [6 [3 0 13] [1 1] 1 0] [0 13] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 61] [0 6] 9 2 10 [61 8 [9 11.246 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 8 [7 [0 7] 1 1] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [6 [5 [1 0] 0 61] [1 0] 1 1] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 1] 8 [9 4 0 7] 9 2 10 [6 [7 [0 3] 1 2] 7 [0 3] 9 2 10 [6 8 [9 179.060 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] 8 [1 0] [1 0 6] 0 1] [8 [1 0 [1 1] 0] [1 8 [9 358.122 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 53] 7 [0 3] 8 [9 11.246 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 59] 0 2] 0 2] 0 1] [8 [1 0] [1 8 [1 [6 [6 [3 0 14] [1 1] 1 0] [8 [9 5 0 1] 9 2 10 [6 [7 [0 3] 1 3.405.691.582] [7 [0 3] 1 32.767] 0 30] 0 2] 8 [8 [9 22 0 15] 9 2 10 [6 [7 [0 3] 1 5] [7 [0 3] 9 4 10 [14 0 28] 0 1] 7 [0 3] 9 4 10 [14 0 29] 0 1] 0 2] 8 [9 5 0 3] 9 2 10 [6 [7 [0 3] 1 3.735.928.559] [7 [0 3] 1 65.534] 0 6] 0 2] 8 [1 0 0 0] [1 8 [8 [9 89.534 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 8 [1 0] 8 [1 6 [5 [1 8] 0 6] [0 250] 8 [8 [9 764 0 511] 9 2 10 [6 [0 252] [0 30] 0 507] 0 2] 8 [8 [9 86 0 1.023] 9 2 10 [6 [7 [0 3] 8 [9 11.246 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 7 [0 3] 8 [9 358.122 0 1.023] 9 2 10 [6 [7 [0 3] 1 0 31] 0 6] 0 2] 0 2] 6 [5 [1 0] 0 2] [9 2 10 [124 4 0 508] 10 [6 4 0 30] 0 7] 0 2] 9 2 0 1] 0 1] 9 4 0 1] 0 1] 8 [1 0] [1 8 [6 [6 [3 0 6] [1 1] 1 0] [0 6] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] [8 [1 0 0] [1 8 [1 0 0] 8 [1 6 [6 [5 [1 0] 0 60] [1 0] 6 [5 [1 0] 0 61] [1 0] 1 1] [0 13] 9 2 10 [30 [8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 11.246 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] 10 [6 [4 0 12] 8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 179.035 0 31] 9 2 10 [6 [7 [0 3] [1 0] 0 12] 7 [0 3] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] [1 0] 6 [5 [1 0] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 125] 0 2] [1 0] 1 1] 0 2] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 8 [9 383 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 89.519 0 7] 9 2 10 [6 7 [0 3] 8 [9 1.375 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] [8 [1 0] [1 8 [9 89.534 0 7] 9 2 10 [6 [7 [0 3] 1 0] 0 14] 0 2] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] [8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 58] 0 2] 8 [7 [0 7] 8 [9 5.622 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 59] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 44.764 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 22.394 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 0 0] 8 [[8 [9 44.764 0 7] 9 2 10 [6 [7 [0 3] 8 [9 179.060 0 7] 9 2 10 [6 7 [0 3] 8 [9 2.810 0 7] 9 2 10 [6 0 14] 0 2] 0 2] 7 [0 3] 1 2] 0 2] 1 0] 8 [8 [1 8 [8 [9 348 0 31] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 22.394 0 31] 9 2 10 [6 0 28] 0 2] 0 2] 8 [8 [9 4 0 63] 9 2 10 [6 [0 6] 0 6] 0 2] 6 [5 [0 60] 1 0] [6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [[0 6] 0 2] [0 61] 8 [9 4 0 127] 9 2 10 [6 [0 125] 0 125] 0 2] 6 [8 [9 340 0 127] 9 2 10 [6 [0 6] 0 254] 0 2] [9 2 10 [6 [8 [9 179.060 0 127] 9 2 10 [6 0 124] 0 2] 0 6] 0 7] 9 2 10 [12 8 [9 179.060 0 127] 9 2 10 [6 0 124] 0 2] 0 7] 9 2 0 1] [0 4] 8 [9 3.061 0 31] 9 2 10 [6 [0 62] 0 13] 0 2] 0 1] [8 [1 0 0] [1 [8 [1 6 [5 [1 0] 0 29] [1 0] 8 [9 348 0 15] 9 2 10 [6 [0 244] 7 [0 3] 9 2 10 [29 0 59] 0 1] 0 2] 9 2 0 1] 8 [9 6.015 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 8 [1 0] 8 [1 6 [5 [0 6] 1 2] [8 [9 340 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] 8 [[8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 124] 0 2] 8 [9 358.122 0 31] 9 2 10 [6 [7 [0 3] 1 3] 0 125] 0 2] 6 [5 [0 4] 0 5] [9 2 10 [30 [8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 252] 0 2] 8 [9 11.246 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 253] 0 2] 10 [6 4 0 14] 0 3] 8 [9 358.123 0 63] 9 2 10 [6 [0 12] 0 13] 0 2] 9 2 0 1] 0 1] 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0 0] [1 6 [8 [9 340 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [1 0 0 0] [1 8 [9 348 0 7] 9 2 10 [6 [7 [0 3] 8 [9 179.035 0 7] 9 2 10 [6 [7 [0 3] [0 12] 8 [9 89.534 0 7] 9 2 10 [6 [0 28] 0 58] 0 2] 0 59] 0 2] 0 58] 0 2] 0 1] [[8 [1 0 0] [1 8 [[8 [9 22.398 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 22.398 0 7] 9 2 10 [6 0 29] 0 2] 6 [5 [0 4] 0 5] [8 [9 374 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 358.123 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [1 0] [0 29] 9 2 10 [28 8 [9 179.060 0 15] 9 2 10 [6 0 60] 0 2] 0 1] 9 2 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [6 [3 0 12] [1 1] 1 0] [6 [6 [3 0 13] [1 1] 1 0] [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 1 0] 6 [6 [3 0 13] [1 1] 1 0] [1 1] 6 [5 [0 24] 0 26] [9 2 10 [6 [0 25] 0 27] 0 1] 9 2 10 [6 [0 24] 0 26] 0 1] 0 1] [8 [[8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [9 686 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 698 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 0 1] [8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [[0 26] 7 [8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 0 6] [1 8 [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] [8 [[7 [9 89.983 0 1] 9 2 0 1] 7 [9 89.983 0 1] 9 2 0 1] [1 8 [1 8 [[0 114] 0 118] [1 8 [[8 [0 124] 9 2 10 [6 0 28] 0 2] 8 [0 125] 9 2 10 [6 0 29] 0 2] 8 [5 [0 14] 0 2] 0 6] 0 1] 8 [7 [[[7 [0 28] 9 2 0 1] 7 [0 28] 9 2 0 1] 1 0] 8 [0 2] [1 0 15] 0 1] [1 [1 [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] [7 [0 252] 9 2 0 1] 7 [0 253] 9 2 0 1] [1 6 [5 [1 0] 0 12] [[[0 26] 0 27] 1 0 0] 6 [5 [0 48] 0 26] [10 [5 0 27] 0 12] 6 [8 [0 62] 9 2 10 [6 [0 58] 0 112] 0 2] [8 [9 2 10 [12 0 50] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [6 0 2] 0 28] 10 [7 10 [6 0 11] 0 28] 0 2] 0 0] 8 [9 2 10 [12 0 51] 0 1] 6 [3 0 2] [6 [8 [9 190 0 1.023] 9 2 10 [6 [0 240] 0 24] 0 2] [10 [7 0 2] 0 28] 10 [6 10 [7 0 10] 0 28] 0 2] 0 0] 0 1] [8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 0 12] [1 0] 6 [5 [0 13] 0 48] [[1 0] 0 49] 6 [8 [0 62] 9 2 10 [6 [0 29] 0 112] 0 2] [9 2 10 [12 0 50] 0 1] 9 2 10 [12 0 51] 0 1] 0 1] [8 [1 0] [1 8 [[7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 7 [8 [9 1.374 0 511] 9 2 10 [6 0 2.044] 0 2] 9 2 0 1] 8 [1 6 [5 [1 0] 0 30] [1 0] 6 [6 [5 [1 0] 0 12] [1 0] 8 [0 254] 9 2 10 [6 [0 248] 0 57] 0 2] [6 [6 [5 [1 0] 0 13] [1 0] 8 [0 254] 9 2 10 [6 [0 59] 0 248] 0 2] [6 [6 [5 [1 0] 0 122] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.000] 0 2] [6 [9 2 10 [30 0 122] 10 [12 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [6 [6 [5 [1 0] 0 123] [1 0] 6 [8 [9 190 0 2.047] 9 2 10 [6 [0 248] 0 1.004] 0 2] [6 [9 2 10 [30 0 123] 10 [13 [1 0] 0 120] 0 1] [1 0] 1 1] 1 1] [1 0] 1 1] 1 1] 1 1] 1 1] 9 2 0 1] 0 1] 8 [[7 [8 [9 5.622 0 127] 9 2 10 [6 7 [0 3] 9 2 0 15] 0 2] 9 2 0 1] 7 [0 252] 9 2 0 1] [1 6 [5 [1 0] 8 [9 10 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] 0 1] 0 1] 0 1] [8 [1 1 1] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 3.061 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 4 0 7] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 44.764 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 2] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] 8 [9 348 0 7] 9 2 10 [6 [7 [0 3] 8 [9 358.122 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 117] 0 2] 7 [0 3] 8 [9 179.035 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 7 [0 3] 9 2 10 [13 0 27] 0 1] 0 2] 0 2] 0 1] [8 [1 0 0] [1 6 [8 [9 358.123 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 0 1] [8 [1 0 0] [1 8 [[8 [9 22.398 0 7] 9 2 10 [6 7 [0 3] 8 [9 22.398 0 7] 9 2 10 [6 0 28] 0 2] 0 2] 8 [9 22.398 0 7] 9 2 10 [6 7 [0 3] 8 [9 22.398 0 7] 9 2 10 [6 0 29] 0 2] 0 2] 6 [5 [0 4] 0 5] [8 [9 374 0 15] 9 2 10 [6 [0 60] 0 61] 0 2] 8 [9 358.123 0 15] 9 2 10 [6 [0 12] 0 13] 0 2] 0 1] [[8 [8 [9 3.063 0 1] 10 [6 7 [0 3] 1 5] 0 2] 8 [1 0 0 0] [1 7 [10 [12 8 [9 358.122 0 59] 9 2 10 [6 [7 [0 3] 1 5] 0 28] 0 2] 0 1] 8 [8 [9 3.061 0 59] 9 2 10 [6 [0 58] 7 [0 3] 8 [9 89.534 0 59] 9 2 10 [6 [7 [0 3] 1 3] 0 59] 0 2] 0 2] 8 [8 [9 682 0 123] 9 2 10 [6 [7 [0 3] 8 [9 1.375 0 123] 9 2 10 [6 [7 [0 3] 1 3] 0 123] 0 2] 7 [0 3] 8 [9 186 0 123] 9 2 10 [6 [0 6] 7 [0 3] 1 0] 0 2] 0 2] 8 [8 [9 44.764 0 251] 9 2 10 [6 [0 250] 7 [0 3] 1 4] 0 2] 8 [0 124] 8 [1 3.432.918.353 461.845.907] 8 [8 [9 1.375 0 2.043] 9 2 10 [6 [7 [0 3] 1 5] 0 2.043] 0 2] 8 [0 30] 7 [10 [30 8 [0 30] 8 [1 6 [5 [1 0] 0 14] [0 6] 8 [8 [9 84 0 32.763] 9 2 10 [6 [7 [0 3] 8 [9 3.061 0 32.763] 9 2 10 [6 [0 510] 0 30] 0 2] 0 62] 0 2] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 508] 0 2] 0 2] 0 1] 7 [10 [2 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 6] 0 2] 0 1] 7 [10 [2 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 6] 0 509] 0 2] 0 2] 0 1] 7 [10 [14 8 [9 86 0 65.531] 9 2 10 [6 [0 30] 0 6] 0 2] 0 1] 7 [10 [14 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 13] 0 30] 0 2] 0 1] 7 [10 [14 8 [9 4 0 16.382] 9 2 10 [6 [7 [0 3] 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 30] 7 [0 3] 1 5] 0 2] 0 2] 7 [0 3] 1 3.864.292.196] 0 2] 0 1] 9 2 10 [14 8 [9 179.060 0 65.531] 9 2 10 [6 0 62] 0 2] 0 3] 9 2 0 1] 0 1] 8 [8 [9 11.188 0 8.187] 9 2 10 [6 [7 [0 3] 8 [9 4 0 8.187] 9 2 10 [6 [7 [0 3] 1 4] 0 126] 0 2] 0 254] 0 2] 8 [1 0] 8 [8 [9 350 0 32.763] 9 2 10 [6 [0 32.762] 7 [0 3] 1 3] 0 2] 7 [10 [254 6 [5 [1 3] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 16] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 2] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 2] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 179.035 0 65.531] 9 2 10 [6 [7 [0 3] 1 0 8] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 1] 0 30] 0 2] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 6 [5 [1 1] 0 2] [7 [10 [6 8 [9 86 0 65.531] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 84 0 65.531] 9 2 10 [6 [7 [0 3] 1 0] 0 30] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 508] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 10 0 16.382] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 15] 0 14] 0 2] 0 1] 7 [10 [6 8 [9 11 0 16.382] 9 2 10 [6 7 [0 3] 8 [9 4 0 65.531] 9 2 10 [6 [0 14] 0 509] 0 2] 0 2] 0 1] 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 14] 0 2] 11 [1.936.945.012 1 0] 0 254] 0 1] 7 [10 [254 8 [9 86 0 65.531] 9 2 10 [6 [0 510] 0 65.530] 0 2] 0 1] 8 [1 [8 [9 5 0 1] 9 2 10 [6 0 1.022] 0 2] 8 [1 0] [1 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 2.246.822.507] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 13] 0 14] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 11 0 131.070] 9 2 10 [6 7 [0 3] 8 [9 4 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 1 3.266.489.909] 0 2] 0 2] 0 1] 7 [10 [6 8 [9 86 0 524.283] 9 2 10 [6 [0 14] 7 [0 3] 8 [9 11.246 0 524.283] 9 2 10 [6 [7 [0 3] 1 0 16] 0 14] 0 2] 0 2] 0 1] 0 6] 0 1] 9 4 0 1] 0 1] [[8 [8 [1 0] [1 8 [0 6] 8 [5 [0 14] 0 2] 0 6] 0 1] [1 8 [1 0] [1 8 [6 [3 0 6] [[8 [0 30] 9 2 10 [6 0 28] 0 2] 8 [7 [0 7] 8 [9 3.060 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 29] 0 2] 6 [5 [1 0] 0 6] [1 0] 0 0] 8 [5 [0 14] 0 2] 0 6] 0 1] 0 1] 8 [1 0 0] [1 11 [1.851.876.717 [1 [1 1.717.658.988] 7 [0 1] 8 [1 1 115 117 98 116 114 97 99 116 45 117 110 100 101 114 102 108 111 119 0] 9 2 0 1] 0 1] 6 [5 [1 0] 0 13] [0 12] 9 2 10 [6 [8 [9 179.060 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 179.060 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 13] 1 0] [1 1] 8 [1 6 [5 [0 29] 1 1] [0 28] 8 [9 2 10 [29 8 [9 44.764 0 15] 9 2 10 [6 [0 61] 7 [0 3] 1 2] 0 2] 0 1] 8 [8 [9 4 0 31] 9 2 10 [6 [0 6] 0 6] 0 2] 8 [8 [9 350 0 63] 9 2 10 [6 [0 253] 7 [0 3] 1 1] 0 2] 6 [5 [1 0] 0 2] [0 6] 7 [0 3] 8 [9 4 0 63] 9 2 10 [6 [0 6] 0 252] 0 2] 9 2 0 1] 0 1] 8 [1 0] [1 [8 [1 0 0] [1 8 [9 11 0 7] 9 2 10 [6 7 [0 3] 8 [9 348 0 31] 9 2 10 [6 [0 28] 0 29] 0 2] 0 2] 0 1] [8 [1 0 0 0] [1 8 [8 [9 11 0 7] 9 2 10 [6 0 59] 0 2] 8 [8 [9 22.394 0 63] 9 2 10 [6 7 [0 3] 8 [9 3.061 0 63] 9 2 10 [6 [0 126] 0 60] 0 2] 0 2] 8 [8 [9 6.014 0 127] 9 2 10 [6 [0 250] 0 6] 0 2] 8 [9 11 0 63] 9 2 10 [6 7 [0 3] 8 [9 2.798 0 255] 9 2 10 [6 [7 [0 3] 8 [9 179.035 0 255] 9 2 10 [6 [7 [0 3] [0 124] 0 2] 0 30] 0 2] 7 [0 3] 8 [9 11.246 0 255] 9 2 10 [6 [7 [0 3] [0 124] 8 [9 3.061 0 255] 9 2 10 [6 [0 14] 0 6] 0 2] 0 30] 0 2] 0 2] 0 2] 0 1] 8 [1 0] [1 8 [9 358.122 0 31] 9 2 10 [6 [0 62] 0 14] 0 2] 0 1] 0 1] 8 [1 0 0] [1 8 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [1 0] 8 [1 6 [5 [1 0] 0 125] [1 0] 8 [9 348 0 63] 9 2 10 [6 [7 [0 3] 9 2 10 [125 0 251] 10 [6 4 0 6] 0 1] 7 [0 3] 8 [9 179.035 0 63] 9 2 10 [6 [7 [0 3] [0 28] 8 [9 4 0 63] 9 2 10 [6 [0 61] 0 14] 0 2] 7 [0 3] 8 [9 358.122 0 63] 9 2 10 [6 [7 [0 3] [0 28] 0 29] 0 506] 0 2] 0 2] 0 2] 9 2 0 1] 0 1] 506.013.904.830.974.705.962.590.204.844.663.393]]] name='hoon'] next=[%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=5] q=%.n]] next=[%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=37] q=%.n]] next=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%dec]]] arg=[~ [%atom p=[[%number p=43] q=%.n]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=5] q=%.n]] q=[%atom p=[[%number p=37] q=%.n]]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%add]]] arg=[~ [p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%b]]]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%sub]]] arg=[~ [p=[%atom p=[[%number p=47] q=%.n]] q=[%limb p=~[[%name p=%a]]]]]] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%lent]]] arg=[~ [%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=3] q=%.n]] [%atom p=[[%number p=4] q=%.n]] [%atom p=[[%number p=5] q=%.n]] [%atom p=[[%number p=6] q=%.n]] [%atom p=[[%number p=7] q=%.n]] [%atom p=[[%number p=8] q=%.n]] [%atom p=[[%number p=9] q=%.n]] [%atom p=[[%number p=10] q=%.n]] [%atom p=[[%number p=11] q=%.n]] [%atom p=[[%number p=12] q=%.n]] [%atom p=[[%number p=13] q=%.n]] [%atom p=[[%number p=14] q=%.n]] [%atom p=[[%number p=15] q=%.n]] [%atom p=[[%number p=16] q=%.n]] [%atom p=[[%number p=17] q=%.n]] [%atom p=[[%number p=18] q=%.n]] [%atom p=[[%number p=19] q=%.n]] [%atom p=[[%number p=20] q=%.n]] [%atom p=[[%number p=21] q=%.n]] [%atom p=[[%number p=22] q=%.n]] [%atom p=[[%number p=23] q=%.n]] [%atom p=[[%number p=24] q=%.n]] [%atom p=[[%number p=25] q=%.n]] [%atom p=[[%number p=26] q=%.n]] [%atom p=[[%number p=27] q=%.n]] [%atom p=[[%number p=28] q=%.n]] [%atom p=[[%number p=29] q=%.n]] [%atom p=[[%number p=30] q=%.n]] [%atom p=[[%number p=31] q=%.n]] [%atom p=[[%number p=32] q=%.n]] [%atom p=[[%number p=33] q=%.n]] [%atom p=[[%number p=34] q=%.n]] [%atom p=[[%number p=35] q=%.n]] [%atom p=[[%number p=36] q=%.n]] [%atom p=[[%number p=37] q=%.n]] [%atom p=[[%number p=38] q=%.n]] [%atom p=[[%number p=39] q=%.n]] [%atom p=[[%number p=40] q=%.n]] [%atom p=[[%number p=41] q=%.n]] [%atom p=[[%number p=42] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]]]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/hoon-ffi.hoon b/crates/jockt/hoon/tests/lib/hoon-ffi.hoon index 723ca48..bd643f5 100644 --- a/crates/jockt/hoon/tests/lib/hoon-ffi.hoon +++ b/crates/jockt/hoon/tests/lib/hoon-ffi.hoon @@ -8,13 +8,13 @@ 'let a = 1;\0alet b = 41;\0alet c = 43;\0alet d = 6;\0alet e = 7;\0alet f = 252;\0a\0a(hoon.add(a b)\0a hoon.sub(c a)\0a hoon.mul(d e)\0a hoon.div(f d)\0a)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%literal [[%number p=41] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %'='] [%literal [[%number p=43] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %d] [%punctuator %'='] [%literal [[%number p=6] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %e] [%punctuator %'='] [%literal [[%number p=7] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %f] [%punctuator %'='] [%literal [[%number p=252] q=%.n]] [%punctuator %';'] [%punctuator %'('] [%name %hoon] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%name %a] [%name %b] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %sub] [%punctuator %'(('] [%name %c] [%name %a] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %mul] [%punctuator %'(('] [%name %d] [%name %e] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %div] [%punctuator %'(('] [%name %f] [%name %d] [%punctuator %')'] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%literal [[%number p=41] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %'='] [%literal [[%number p=43] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %d] [%punctuator %'='] [%literal [[%number p=6] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %e] [%punctuator %'='] [%literal [[%number p=7] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %f] [%punctuator %'='] [%literal [[%number p=252] q=%.n]] [%punctuator %';'] [%punctuator %'('] [%name %hoon] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%name %a] [%name %b] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %sub] [%punctuator %'(('] [%name %c] [%name %a] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %mul] [%punctuator %'(('] [%name %d] [%name %e] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %div] [%punctuator %'(('] [%name %f] [%name %d] [%punctuator %')'] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%none p=~] name='a'] val=[%atom p=[[%number p=1] q=%.n]] next=[%let type=[p=[%none p=~] name='b'] val=[%atom p=[[%number p=41] q=%.n]] next=[%let type=[p=[%none p=~] name='c'] val=[%atom p=[[%number p=43] q=%.n]] next=[%let type=[p=[%none p=~] name='d'] val=[%atom p=[[%number p=6] q=%.n]] next=[%let type=[p=[%none p=~] name='e'] val=[%atom p=[[%number p=7] q=%.n]] next=[%let type=[p=[%none p=~] name='f'] val=[%atom p=[[%number p=252] q=%.n]] next=[p=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%add]]] arg=[~ [p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%b]]]]]] q=[p=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%sub]]] arg=[~ [p=[%limb p=~[[%name p=%c]]] q=[%limb p=~[[%name p=%a]]]]]] q=[p=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%mul]]] arg=[~ [p=[%limb p=~[[%name p=%d]]] q=[%limb p=~[[%name p=%e]]]]]] q=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%div]]] arg=[~ [p=[%limb p=~[[%name p=%f]]] q=[%limb p=~[[%name p=%d]]]]]]]]]]]]]]] + [%let pos=[0 0] type=[p=[%none p=~] name='a'] val=[%atom p=[[%number p=1] q=%.n]] next=[%let pos=[0 0] type=[p=[%none p=~] name='b'] val=[%atom p=[[%number p=41] q=%.n]] next=[%let pos=[0 0] type=[p=[%none p=~] name='c'] val=[%atom p=[[%number p=43] q=%.n]] next=[%let pos=[0 0] type=[p=[%none p=~] name='d'] val=[%atom p=[[%number p=6] q=%.n]] next=[%let pos=[0 0] type=[p=[%none p=~] name='e'] val=[%atom p=[[%number p=7] q=%.n]] next=[%let pos=[0 0] type=[p=[%none p=~] name='f'] val=[%atom p=[[%number p=252] q=%.n]] next=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%add]]] arg=[~ [p=[%limb p=~[[%name p=%a]]] q=[%limb p=~[[%name p=%b]]]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%sub]]] arg=[~ [p=[%limb p=~[[%name p=%c]]] q=[%limb p=~[[%name p=%a]]]]]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%mul]]] arg=[~ [p=[%limb p=~[[%name p=%d]]] q=[%limb p=~[[%name p=%e]]]]]] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%div]]] arg=[~ [p=[%limb p=~[[%name p=%f]]] q=[%limb p=~[[%name p=%d]]]]]]]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/if-else.hoon b/crates/jockt/hoon/tests/lib/if-else.hoon index 7957ae5..78de98a 100644 --- a/crates/jockt/hoon/tests/lib/if-else.hoon +++ b/crates/jockt/hoon/tests/lib/if-else.hoon @@ -8,13 +8,13 @@ 'let a: @ = 3;\0a\0aif a == 3 {\0a 42\0a} else {\0a 17\0a}\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %'='] [%literal [[%number p=17] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%keyword %lambda] [%punctuator %'('] [%punctuator %'('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%name %c] [%punctuator %':'] [%punctuator %'&'] [%literal [[%number p=1] q=%.n]] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%keyword %if] [%name %c] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=18] q=%.n]] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%name %b] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %'('] [%literal [[%number p=23] q=%.n]] [%punctuator %'&'] [%literal [[%number p=1] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'&'] [%literal [[%number p=1] q=%.n]]] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %'='] [%literal [[%number p=17] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%keyword %lambda] [%punctuator %'('] [%punctuator %'('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%name %c] [%punctuator %':'] [%punctuator %'&'] [%literal [[%number p=1] q=%.n]] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%keyword %if] [%name %c] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=18] q=%.n]] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%name %b] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %'('] [%literal [[%number p=23] q=%.n]] [%punctuator %'&'] [%literal [[%number p=1] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'&'] [%literal [[%number p=1] q=%.n]]] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%none p=~] name='a'] val=[%atom p=[[%number p=17] q=%.n]] next=[%let type=[p=[%none p=~] name='b'] val=[%call func=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='b'] q=[p=[%limb p=~[[%axis p=1]]] name='c']] name='']] out=[p=[%atom p=%number q=%.n] name='']] body=[%if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%c]]] b=[%atom p=[[%number p=18] q=%.n]]] then=[%increment val=[%limb p=~[[%name p=%b]]]] after=[%else then=[%limb p=~[[%name p=%b]]]]] context=~]] arg=[~ [p=[%atom p=[[%number p=23] q=%.n]] q=[%limb p=~[[%axis p=1]]]]]] next=[%limb p=~[[%axis p=1]]]]] + [%let pos=[0 0] type=[p=[%none p=~] name='a'] val=[%atom p=[[%number p=17] q=%.n]] next=[%let pos=[0 0] type=[p=[%none p=~] name='b'] val=[%call pos=[0 0] func=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='b'] q=[p=[%limb p=~[[%axis p=1]]] name='c']] name='']] out=[p=[%atom p=%number q=%.n] name='']] body=[%if pos=[0 0] cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%c]]] b=[%atom p=[[%number p=18] q=%.n]]] then=[%increment val=[%limb p=~[[%name p=%b]]]] after=[%else then=[%limb p=~[[%name p=%b]]]]] context=~]] arg=[~ [p=[%atom p=[[%number p=23] q=%.n]] q=[%limb p=~[[%axis p=1]]]]]] next=[%limb p=~[[%axis p=1]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/if-elseif-else.hoon b/crates/jockt/hoon/tests/lib/if-elseif-else.hoon index e3944ff..c96ed6b 100644 --- a/crates/jockt/hoon/tests/lib/if-elseif-else.hoon +++ b/crates/jockt/hoon/tests/lib/if-elseif-else.hoon @@ -8,13 +8,13 @@ 'let a: @ = 3;\0a\0aif a == 3 {\0a 42\0a} else if a == 5 {\0a 17\0a} else {\0a 15\0a}\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %'{'] [%literal [[%number p=42] q=%.n]] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%literal [[%number p=17] q=%.n]] [%punctuator %'}']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %'{'] [%literal [[%number p=42] q=%.n]] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%literal [[%number p=17] q=%.n]] [%punctuator %'}']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=3] q=%.n]] next=[%if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=3] q=%.n]]] then=[%atom p=[[%number p=42] q=%.n]] after=[%else then=[%atom p=[[%number p=17] q=%.n]]]]] + [%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=3] q=%.n]] next=[%if pos=[0 0] cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%atom p=[[%number p=3] q=%.n]]] then=[%atom p=[[%number p=42] q=%.n]] after=[%else then=[%atom p=[[%number p=17] q=%.n]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/in-subj-call.hoon b/crates/jockt/hoon/tests/lib/in-subj-call.hoon index 7742d87..cff9fa2 100644 --- a/crates/jockt/hoon/tests/lib/in-subj-call.hoon +++ b/crates/jockt/hoon/tests/lib/in-subj-call.hoon @@ -8,13 +8,13 @@ 'let a = 17;\0a\0alet b = lambda ((b:@ c:&1)) -> @ {\0a if c == 18 {\0a +(b)\0a } else {\0a b\0a }\0a}(23 &1);\0a\0a&1\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %lambda] [%punctuator %'('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'('] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %lambda] [%punctuator %'('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'('] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%call func=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%b]]]] context=~]] arg=~] + [%call pos=[0 0] func=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%b]]]] context=~]] arg=~] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/infix-arithmetic.hoon b/crates/jockt/hoon/tests/lib/infix-arithmetic.hoon index f0acdb2..30a72a0 100644 --- a/crates/jockt/hoon/tests/lib/infix-arithmetic.hoon +++ b/crates/jockt/hoon/tests/lib/infix-arithmetic.hoon @@ -8,8 +8,8 @@ '[ (41 + 5) - 4\0a (126 * 2) / 6\0a ((6 ** 2) + 6) % 100\0a (2 ** 5) + 10\0a 1 + 2 + 39\0a (50 - 9) + 1\0a]\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%punctuator %'['] [%punctuator %'('] [%literal [[%number p=41] q=%.n]] [%punctuator %'+'] [%literal [[%number p=5] q=%.n]] [%punctuator %')'] [%punctuator %'-'] [%literal [[%number p=4] q=%.n]] [%punctuator %'('] [%literal [[%number p=126] q=%.n]] [%punctuator %'*'] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'/'] [%literal [[%number p=6] q=%.n]] [%punctuator %'('] [%punctuator %'('] [%literal [[%number p=6] q=%.n]] [%punctuator %'*'] [%punctuator %'*'] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'+'] [%literal [[%number p=6] q=%.n]] [%punctuator %')'] [%punctuator %'%'] [%literal [[%number p=100] q=%.n]] [%punctuator %'('] [%literal [[%number p=2] q=%.n]] [%punctuator %'*'] [%punctuator %'*'] [%literal [[%number p=5] q=%.n]] [%punctuator %')'] [%punctuator %'+'] [%literal [[%number p=10] q=%.n]] [%literal [[%number p=1] q=%.n]] [%punctuator %'+'] [%literal [[%number p=2] q=%.n]] [%punctuator %'+'] [%literal [[%number p=39] q=%.n]] [%punctuator %'('] [%literal [[%number p=50] q=%.n]] [%punctuator %'-'] [%literal [[%number p=9] q=%.n]] [%punctuator %')'] [%punctuator %'+'] [%literal [[%number p=1] q=%.n]] [%punctuator %']']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%punctuator %'['] [%punctuator %'('] [%literal [[%number p=41] q=%.n]] [%punctuator %'+'] [%literal [[%number p=5] q=%.n]] [%punctuator %')'] [%punctuator %'-'] [%literal [[%number p=4] q=%.n]] [%punctuator %'('] [%literal [[%number p=126] q=%.n]] [%punctuator %'*'] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'/'] [%literal [[%number p=6] q=%.n]] [%punctuator %'('] [%punctuator %'('] [%literal [[%number p=6] q=%.n]] [%punctuator %'*'] [%punctuator %'*'] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'+'] [%literal [[%number p=6] q=%.n]] [%punctuator %')'] [%punctuator %'%'] [%literal [[%number p=100] q=%.n]] [%punctuator %'('] [%literal [[%number p=2] q=%.n]] [%punctuator %'*'] [%punctuator %'*'] [%literal [[%number p=5] q=%.n]] [%punctuator %')'] [%punctuator %'+'] [%literal [[%number p=10] q=%.n]] [%literal [[%number p=1] q=%.n]] [%punctuator %'+'] [%literal [[%number p=2] q=%.n]] [%punctuator %'+'] [%literal [[%number p=39] q=%.n]] [%punctuator %'('] [%literal [[%number p=50] q=%.n]] [%punctuator %'-'] [%literal [[%number p=9] q=%.n]] [%punctuator %')'] [%punctuator %'+'] [%literal [[%number p=1] q=%.n]] [%punctuator %']']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test diff --git a/crates/jockt/hoon/tests/lib/infix-comparator.hoon b/crates/jockt/hoon/tests/lib/infix-comparator.hoon index 14e8d36..7761260 100644 --- a/crates/jockt/hoon/tests/lib/infix-comparator.hoon +++ b/crates/jockt/hoon/tests/lib/infix-comparator.hoon @@ -8,8 +8,8 @@ '(\0a 1 < 0\0a 0 <= 1\0a 0 == 1\0a 1 > 0\0a 0 >= 0\0a 1 != 1\0a)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%punctuator %'<'] [%literal [[%number p=0] q=%.n]] [%literal [[%number p=0] q=%.n]] [%punctuator %'<'] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=0] q=%.n]] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=1] q=%.n]] [%punctuator %'>'] [%literal [[%number p=0] q=%.n]] [%literal [[%number p=0] q=%.n]] [%punctuator %'>'] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%literal [[%number p=1] q=%.n]] [%punctuator %'!'] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%punctuator %'<'] [%literal [[%number p=0] q=%.n]] [%literal [[%number p=0] q=%.n]] [%punctuator %'<'] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=0] q=%.n]] [%punctuator %'='] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=1] q=%.n]] [%punctuator %'>'] [%literal [[%number p=0] q=%.n]] [%literal [[%number p=0] q=%.n]] [%punctuator %'>'] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%literal [[%number p=1] q=%.n]] [%punctuator %'!'] [%punctuator %'='] [%literal [[%number p=1] q=%.n]] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test diff --git a/crates/jockt/hoon/tests/lib/inline-lambda-call.hoon b/crates/jockt/hoon/tests/lib/inline-lambda-call.hoon index 622e9b4..2f9b794 100644 --- a/crates/jockt/hoon/tests/lib/inline-lambda-call.hoon +++ b/crates/jockt/hoon/tests/lib/inline-lambda-call.hoon @@ -8,13 +8,13 @@ 'lambda (b:@) -> @ {\0a +(b)\0a}(41)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %lambda] [%punctuator %'('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'('] [%literal [[%number p=41] q=%.n]] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %lambda] [%punctuator %'('] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'('] [%literal [[%number p=41] q=%.n]] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%call func=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%b]]]] context=~]] arg=[~ [%atom p=[[%number p=41] q=%.n]]]] + [%call pos=[0 0] func=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='b']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%b]]]] context=~]] arg=[~ [%atom p=[[%number p=41] q=%.n]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/inline-lambda-no-arg.hoon b/crates/jockt/hoon/tests/lib/inline-lambda-no-arg.hoon index dbe7a56..93ce88b 100644 --- a/crates/jockt/hoon/tests/lib/inline-lambda-no-arg.hoon +++ b/crates/jockt/hoon/tests/lib/inline-lambda-no-arg.hoon @@ -8,13 +8,13 @@ 'lambda (b:@) -> @ {\0a +(b)\0a}()\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%keyword %loop] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'{'] [%name %b] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %';'] [%punctuator %'$'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=5] q=%.n]] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%keyword %loop] [%punctuator %';'] [%keyword %if] [%name %a] [%punctuator %'='] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'{'] [%name %b] [%punctuator %'}'] [%keyword %else] [%punctuator %'{'] [%name %b] [%punctuator %'='] [%punctuator %'+'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %';'] [%punctuator %'$'] [%punctuator %'('] [%name %b] [%punctuator %')'] [%punctuator %'}']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=5] q=%.n]] next=[%let type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=0] q=%.n]] next=[%loop next=[%if cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%increment val=[%limb p=~[[%name p=%b]]]]] then=[%limb p=~[[%name p=%b]]] after=[%else then=[%edit limb=~[[%name p=%b]] val=[%increment val=[%limb p=~[[%name p=%b]]]] next=[%call func=[%limb p=~[[%axis p=0]]] arg=[~ [%limb p=~[[%name p=%b]]]]]]]]]]] + [%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='a'] val=[%atom p=[[%number p=5] q=%.n]] next=[%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=0] q=%.n]] next=[%loop next=[%if pos=[0 0] cond=[%compare comp=%'==' a=[%limb p=~[[%name p=%a]]] b=[%increment val=[%limb p=~[[%name p=%b]]]]] then=[%limb p=~[[%name p=%b]]] after=[%else then=[%edit limb=~[[%name p=%b]] val=[%increment val=[%limb p=~[[%name p=%b]]]] next=[%call pos=[0 0] func=[%limb p=~[[%axis p=0]]] arg=[~ [%limb p=~[[%name p=%b]]]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/inline-point.hoon b/crates/jockt/hoon/tests/lib/inline-point.hoon index 20b2be1..8850b44 100644 --- a/crates/jockt/hoon/tests/lib/inline-point.hoon +++ b/crates/jockt/hoon/tests/lib/inline-point.hoon @@ -8,13 +8,13 @@ 'let a: @ = 5;\0alet b: @ = 0;\0aloop;\0aif a == +(b) {\0a b\0a} else {\0a b = +(b);\0a $(b)\0a}\0a\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %func] [%name %a] [%punctuator %'(('] [%name %c] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %c] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%name %b] [%punctuator %'='] [%name %a] [%punctuator %'(('] [%literal [[%number p=23] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name %b]] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %func] [%name %a] [%punctuator %'(('] [%name %c] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %c] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%name %b] [%punctuator %'='] [%name %a] [%punctuator %'(('] [%literal [[%number p=23] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name %b]] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%func type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='c']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='a'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='c']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%c]]]] context=~]] next=[%let type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=42] q=%.n]] next=[%edit limb=~[[%name p=%b]] val=[%call func=[%limb p=~[[%name p=%a]]] arg=[~ [%atom p=[[%number p=23] q=%.n]]]] next=[%limb p=~[[%name p=%b]]]]]] + [%func pos=[0 0] type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='c']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='a'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='c']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%c]]]] context=~]] next=[%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='b'] val=[%atom p=[[%number p=42] q=%.n]] next=[%edit limb=~[[%name p=%b]] val=[%call pos=[0 0] func=[%limb p=~[[%name p=%a]]] arg=[~ [%atom p=[[%number p=23] q=%.n]]]] next=[%limb p=~[[%name p=%b]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/let-edit.hoon b/crates/jockt/hoon/tests/lib/let-edit.hoon index d4de134..90cd4f1 100644 --- a/crates/jockt/hoon/tests/lib/let-edit.hoon +++ b/crates/jockt/hoon/tests/lib/let-edit.hoon @@ -8,13 +8,13 @@ 'let a: ? = true;\0a\0aa = false;\0a\0aa\0a\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'?'] [%punctuator %'='] [%literal [[%loobean p=%.y] q=%.n]] [%punctuator %';'] [%name %a] [%punctuator %'='] [%literal [[%loobean p=%.n] q=%.n]] [%punctuator %';'] [%name %a]] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'?'] [%punctuator %'='] [%literal [[%loobean p=%.y] q=%.n]] [%punctuator %';'] [%name %a] [%punctuator %'='] [%literal [[%loobean p=%.n] q=%.n]] [%punctuator %';'] [%name %a]] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%atom p=%loobean q=%.n] name='a'] val=[%atom p=[[%loobean p=%.y] q=%.n]] next=[%edit limb=~[[%name p=%a]] val=[%atom p=[[%loobean p=%.n] q=%.n]] next=[%limb p=~[[%name p=%a]]]]] + [%let pos=[0 0] type=[p=[%atom p=%loobean q=%.n] name='a'] val=[%atom p=[[%loobean p=%.y] q=%.n]] next=[%edit limb=~[[%name p=%a]] val=[%atom p=[[%loobean p=%.n] q=%.n]] next=[%limb p=~[[%name p=%a]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/let-inner-exp.hoon b/crates/jockt/hoon/tests/lib/let-inner-exp.hoon index ced6f10..4d577f7 100644 --- a/crates/jockt/hoon/tests/lib/let-inner-exp.hoon +++ b/crates/jockt/hoon/tests/lib/let-inner-exp.hoon @@ -8,13 +8,13 @@ 'let a = 42;\0a\0aa\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %'='] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%name %a]] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %'='] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%name %a]] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%none p=~] name='a'] val=[%atom p=[[%number p=42] q=%.n]] next=[%limb p=~[[%name p=%a]]]] + [%let pos=[0 0] type=[p=[%none p=~] name='a'] val=[%atom p=[[%number p=42] q=%.n]] next=[%limb p=~[[%name p=%a]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/lists-indexing.hoon b/crates/jockt/hoon/tests/lib/lists-indexing.hoon index d08a298..48b3cc5 100644 --- a/crates/jockt/hoon/tests/lib/lists-indexing.hoon +++ b/crates/jockt/hoon/tests/lib/lists-indexing.hoon @@ -8,13 +8,13 @@ 'let a = [100 200 300 400 500];\0alet b:List(@ @) = [(10 20) (30 40) (50 60)];\0a\0a(hoon.snag(0 a) hoon.snag(2 b))\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=100] q=%.n]] [%literal [[%number p=200] q=%.n]] [%literal [[%number p=300] q=%.n]] [%literal [[%number p=400] q=%.n]] [%literal [[%number p=500] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%punctuator %'('] [%literal [[%number p=10] q=%.n]] [%literal [[%number p=20] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=40] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=50] q=%.n]] [%literal [[%number p=60] q=%.n]] [%punctuator %')'] [%punctuator %']'] [%punctuator %';'] [%punctuator %'('] [%name %hoon] [%punctuator %'.'] [%name %snag] [%punctuator %'(('] [%literal [[%number p=0] q=%.n]] [%name %a] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %snag] [%punctuator %'(('] [%literal [[%number p=2] q=%.n]] [%name %b] [%punctuator %')'] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=100] q=%.n]] [%literal [[%number p=200] q=%.n]] [%literal [[%number p=300] q=%.n]] [%literal [[%number p=400] q=%.n]] [%literal [[%number p=500] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%punctuator %'('] [%literal [[%number p=10] q=%.n]] [%literal [[%number p=20] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=40] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=50] q=%.n]] [%literal [[%number p=60] q=%.n]] [%punctuator %')'] [%punctuator %']'] [%punctuator %';'] [%punctuator %'('] [%name %hoon] [%punctuator %'.'] [%name %snag] [%punctuator %'(('] [%literal [[%number p=0] q=%.n]] [%name %a] [%punctuator %')'] [%name %hoon] [%punctuator %'.'] [%name %snag] [%punctuator %'(('] [%literal [[%number p=2] q=%.n]] [%name %b] [%punctuator %')'] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%none p=~] name='a'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=100] q=%.n]] [%atom p=[[%number p=200] q=%.n]] [%atom p=[[%number p=300] q=%.n]] [%atom p=[[%number p=400] q=%.n]] [%atom p=[[%number p=500] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let type=[p=[%list type=[[p=[p=[%atom p=%number q=%.n] name=''] q=[p=[%atom p=%number q=%.n] name='']] name='']] name='b'] val=[%list type=[%none p=~] val=~[[p=[%atom p=[[%number p=10] q=%.n]] q=[%atom p=[[%number p=20] q=%.n]]] [p=[%atom p=[[%number p=30] q=%.n]] q=[%atom p=[[%number p=40] q=%.n]]] [p=[%atom p=[[%number p=50] q=%.n]] q=[%atom p=[[%number p=60] q=%.n]]] [%atom p=[[%number p=0] q=%.n]]]] next=[p=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%snag]]] arg=[~ [p=[%atom p=[[%number p=0] q=%.n]] q=[%limb p=~[[%name p=%a]]]]]] q=[%call func=[%limb p=~[[%name p=%hoon] [%name p=%snag]]] arg=[~ [p=[%atom p=[[%number p=2] q=%.n]] q=[%limb p=~[[%name p=%b]]]]]]]]] + [%let pos=[0 0] type=[p=[%none p=~] name='a'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=100] q=%.n]] [%atom p=[[%number p=200] q=%.n]] [%atom p=[[%number p=300] q=%.n]] [%atom p=[[%number p=400] q=%.n]] [%atom p=[[%number p=500] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%list type=[[p=[p=[%atom p=%number q=%.n] name=''] q=[p=[%atom p=%number q=%.n] name='']] name='']] name='b'] val=[%list type=[%none p=~] val=~[[p=[%atom p=[[%number p=10] q=%.n]] q=[%atom p=[[%number p=20] q=%.n]]] [p=[%atom p=[[%number p=30] q=%.n]] q=[%atom p=[[%number p=40] q=%.n]]] [p=[%atom p=[[%number p=50] q=%.n]] q=[%atom p=[[%number p=60] q=%.n]]] [%atom p=[[%number p=0] q=%.n]]]] next=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%snag]]] arg=[~ [p=[%atom p=[[%number p=0] q=%.n]] q=[%limb p=~[[%name p=%a]]]]]] q=[%call pos=[0 0] func=[%limb p=~[[%name p=%hoon] [%name p=%snag]]] arg=[~ [p=[%atom p=[[%number p=2] q=%.n]] q=[%limb p=~[[%name p=%b]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/lists-nested.hoon b/crates/jockt/hoon/tests/lib/lists-nested.hoon index 0f24d24..642be69 100644 --- a/crates/jockt/hoon/tests/lib/lists-nested.hoon +++ b/crates/jockt/hoon/tests/lib/lists-nested.hoon @@ -8,13 +8,13 @@ 'let a:List(@) = [1];\0a\0alet b:List(@) = [1 2];\0a\0alet c:List(@) = [1 2 3];\0a\0alet d:List((@ @)) = [(1 2) (3 4)];\0a\0alet e:List((@ List(@))) = [(1 [2]) (3 [4 5])];\0a\0a(a b c d e)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=3] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %d] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'('] [%punctuator %'@'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=4] q=%.n]] [%punctuator %')'] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %e] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'('] [%punctuator %'@'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%punctuator %'['] [%literal [[%number p=2] q=%.n]] [%punctuator %']'] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=3] q=%.n]] [%punctuator %'['] [%literal [[%number p=4] q=%.n]] [%literal [[%number p=5] q=%.n]] [%punctuator %']'] [%punctuator %')'] [%punctuator %']'] [%punctuator %';'] [%punctuator %'('] [%name %a] [%name %b] [%name %c] [%name %d] [%name %e] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=3] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %d] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'('] [%punctuator %'@'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=4] q=%.n]] [%punctuator %')'] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %e] [%punctuator %':'] [%type 'List'] [%punctuator %'(('] [%punctuator %'('] [%punctuator %'@'] [%type 'List'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'['] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%punctuator %'['] [%literal [[%number p=2] q=%.n]] [%punctuator %']'] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=3] q=%.n]] [%punctuator %'['] [%literal [[%number p=4] q=%.n]] [%literal [[%number p=5] q=%.n]] [%punctuator %']'] [%punctuator %')'] [%punctuator %']'] [%punctuator %';'] [%punctuator %'('] [%name %a] [%name %b] [%name %c] [%name %d] [%name %e] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%list type=[p=[%atom p=%number q=%.n] name='']] name='a'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let type=[p=[%list type=[p=[%atom p=%number q=%.n] name='']] name='b'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let type=[p=[%list type=[p=[%atom p=%number q=%.n] name='']] name='c'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=3] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let type=[p=[%list type=[[p=[p=[%atom p=%number q=%.n] name=''] q=[p=[%atom p=%number q=%.n] name='']] name='']] name='d'] val=[%list type=[%none p=~] val=~[[p=[%atom p=[[%number p=1] q=%.n]] q=[%atom p=[[%number p=2] q=%.n]]] [p=[%atom p=[[%number p=3] q=%.n]] q=[%atom p=[[%number p=4] q=%.n]]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let type=[p=[%list type=[[p=[p=[%atom p=%number q=%.n] name=''] q=[p=[%list type=[p=[%atom p=%number q=%.n] name='']] name='List']] name='']] name='e'] val=[%list type=[%none p=~] val=~[[p=[%atom p=[[%number p=1] q=%.n]] q=[%list type=[%none p=~] val=~[[%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]]] [p=[%atom p=[[%number p=3] q=%.n]] q=[%list type=[%none p=~] val=~[[%atom p=[[%number p=4] q=%.n]] [%atom p=[[%number p=5] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]]] [%atom p=[[%number p=0] q=%.n]]]] next=[p=[%limb p=~[[%name p=%a]]] q=[p=[%limb p=~[[%name p=%b]]] q=[p=[%limb p=~[[%name p=%c]]] q=[p=[%limb p=~[[%name p=%d]]] q=[%limb p=~[[%name p=%e]]]]]]]]]]]] + [%let pos=[0 0] type=[p=[%list type=[p=[%atom p=%number q=%.n] name='']] name='a'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%list type=[p=[%atom p=%number q=%.n] name='']] name='b'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%list type=[p=[%atom p=%number q=%.n] name='']] name='c'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=3] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%list type=[[p=[p=[%atom p=%number q=%.n] name=''] q=[p=[%atom p=%number q=%.n] name='']] name='']] name='d'] val=[%list type=[%none p=~] val=~[[p=[%atom p=[[%number p=1] q=%.n]] q=[%atom p=[[%number p=2] q=%.n]]] [p=[%atom p=[[%number p=3] q=%.n]] q=[%atom p=[[%number p=4] q=%.n]]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%list type=[[p=[p=[%atom p=%number q=%.n] name=''] q=[p=[%list type=[p=[%atom p=%number q=%.n] name='']] name='List']] name='']] name='e'] val=[%list type=[%none p=~] val=~[[p=[%atom p=[[%number p=1] q=%.n]] q=[%list type=[%none p=~] val=~[[%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]]] [p=[%atom p=[[%number p=3] q=%.n]] q=[%list type=[%none p=~] val=~[[%atom p=[[%number p=4] q=%.n]] [%atom p=[[%number p=5] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]]] [%atom p=[[%number p=0] q=%.n]]]] next=[p=[%limb p=~[[%name p=%a]]] q=[p=[%limb p=~[[%name p=%b]]] q=[p=[%limb p=~[[%name p=%c]]] q=[p=[%limb p=~[[%name p=%d]]] q=[%limb p=~[[%name p=%e]]]]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/lists.hoon b/crates/jockt/hoon/tests/lib/lists.hoon index e2ff0ab..eca502e 100644 --- a/crates/jockt/hoon/tests/lib/lists.hoon +++ b/crates/jockt/hoon/tests/lib/lists.hoon @@ -8,13 +8,13 @@ 'let d = [11];\0a\0alet c = [9 10];\0a\0alet b = [6 7 8];\0a\0alet a = [1 2 3 4 5];\0a\0a\0a[a b c d]' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %d] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=11] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=9] q=%.n]] [%literal [[%number p=10] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=6] q=%.n]] [%literal [[%number p=7] q=%.n]] [%literal [[%number p=8] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %a] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=4] q=%.n]] [%literal [[%number p=5] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%punctuator %'['] [%name %a] [%name %b] [%name %c] [%name %d] [%punctuator %']']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %d] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=11] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=9] q=%.n]] [%literal [[%number p=10] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=6] q=%.n]] [%literal [[%number p=7] q=%.n]] [%literal [[%number p=8] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%keyword %let] [%name %a] [%punctuator %'='] [%punctuator %'['] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=4] q=%.n]] [%literal [[%number p=5] q=%.n]] [%punctuator %']'] [%punctuator %';'] [%punctuator %'['] [%name %a] [%name %b] [%name %c] [%name %d] [%punctuator %']']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[p=[%none p=~] name='d'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=11] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let type=[p=[%none p=~] name='c'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=9] q=%.n]] [%atom p=[[%number p=10] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let type=[p=[%none p=~] name='b'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=6] q=%.n]] [%atom p=[[%number p=7] q=%.n]] [%atom p=[[%number p=8] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let type=[p=[%none p=~] name='a'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=3] q=%.n]] [%atom p=[[%number p=4] q=%.n]] [%atom p=[[%number p=5] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%list type=[%none p=~] val=~[[%limb p=~[[%name p=%a]]] [%limb p=~[[%name p=%b]]] [%limb p=~[[%name p=%c]]] [%limb p=~[[%name p=%d]]] [%atom p=[[%number p=0] q=%.n]]]]]]]] + [%let pos=[0 0] type=[p=[%none p=~] name='d'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=11] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='c'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=9] q=%.n]] [%atom p=[[%number p=10] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='b'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=6] q=%.n]] [%atom p=[[%number p=7] q=%.n]] [%atom p=[[%number p=8] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='a'] val=[%list type=[%none p=~] val=~[[%atom p=[[%number p=1] q=%.n]] [%atom p=[[%number p=2] q=%.n]] [%atom p=[[%number p=3] q=%.n]] [%atom p=[[%number p=4] q=%.n]] [%atom p=[[%number p=5] q=%.n]] [%atom p=[[%number p=0] q=%.n]]]] next=[%list type=[%none p=~] val=~[[%limb p=~[[%name p=%a]]] [%limb p=~[[%name p=%b]]] [%limb p=~[[%name p=%c]]] [%limb p=~[[%name p=%d]]] [%atom p=[[%number p=0] q=%.n]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/match-case.hoon b/crates/jockt/hoon/tests/lib/match-case.hoon index de37084..a993e9c 100644 --- a/crates/jockt/hoon/tests/lib/match-case.hoon +++ b/crates/jockt/hoon/tests/lib/match-case.hoon @@ -8,8 +8,8 @@ 'let a: @ = 3;\0a\0aswitch a {\0a 1 -> 0;\0a 2 -> 21;\0a 3 -> 42;\0a 4 -> 63;\0a _ -> 84;\0a}\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %';'] [%keyword %switch] [%name %a] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%literal [[%number p=2] q=%.n]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=21] q=%.n]] [%punctuator %';'] [%literal [[%number p=3] q=%.n]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%literal [[%number p=4] q=%.n]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=63] q=%.n]] [%punctuator %';'] [%punctuator %'_'] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=84] q=%.n]] [%punctuator %';'] [%punctuator %'}']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %';'] [%keyword %switch] [%name %a] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%literal [[%number p=2] q=%.n]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=21] q=%.n]] [%punctuator %';'] [%literal [[%number p=3] q=%.n]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%literal [[%number p=4] q=%.n]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=63] q=%.n]] [%punctuator %';'] [%punctuator %'_'] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=84] q=%.n]] [%punctuator %';'] [%punctuator %'}']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test diff --git a/crates/jockt/hoon/tests/lib/match-type.hoon b/crates/jockt/hoon/tests/lib/match-type.hoon index 5affb0e..86c0e89 100644 --- a/crates/jockt/hoon/tests/lib/match-type.hoon +++ b/crates/jockt/hoon/tests/lib/match-type.hoon @@ -8,8 +8,8 @@ 'let a: @ = 3;\0a\0amatch a {\0a %1 -> 0;\0a %2 -> 21;\0a %3 -> 42;\0a %4 -> 63;\0a _ -> 84;\0a}\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %';'] [%keyword %match] [%name %a] [%punctuator %'{'] [%literal [[%number p=1] q=%.y]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%literal [[%number p=2] q=%.y]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=21] q=%.n]] [%punctuator %';'] [%literal [[%number p=3] q=%.y]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%literal [[%number p=4] q=%.y]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=63] q=%.n]] [%punctuator %';'] [%punctuator %'_'] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=84] q=%.n]] [%punctuator %';'] [%punctuator %'}']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=3] q=%.n]] [%punctuator %';'] [%keyword %match] [%name %a] [%punctuator %'{'] [%literal [[%number p=1] q=%.y]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=0] q=%.n]] [%punctuator %';'] [%literal [[%number p=2] q=%.y]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=21] q=%.n]] [%punctuator %';'] [%literal [[%number p=3] q=%.y]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=42] q=%.n]] [%punctuator %';'] [%literal [[%number p=4] q=%.y]] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=63] q=%.n]] [%punctuator %';'] [%punctuator %'_'] [%punctuator %'-'] [%punctuator %'>'] [%literal [[%number p=84] q=%.n]] [%punctuator %';'] [%punctuator %'}']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test diff --git a/crates/jockt/hoon/tests/lib/multi-limb.hoon b/crates/jockt/hoon/tests/lib/multi-limb.hoon index e6aa9ba..332113b 100644 --- a/crates/jockt/hoon/tests/lib/multi-limb.hoon +++ b/crates/jockt/hoon/tests/lib/multi-limb.hoon @@ -8,13 +8,13 @@ 'let a: (p:@ q:(k:@ v:@)) = (52 30 42);\0a\0a(a.q.v) // reduces to a.q.v, so also testing tuple-of-one\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'('] [%name %p] [%punctuator %':'] [%punctuator %'@'] [%name %q] [%punctuator %':'] [%punctuator %'('] [%name %k] [%punctuator %':'] [%punctuator %'@'] [%name %v] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'('] [%literal [[%number p=52] q=%.n]] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=42] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%name %a] [%punctuator %'.'] [%name %q] [%punctuator %'.'] [%name %v] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%punctuator %'('] [%name %p] [%punctuator %':'] [%punctuator %'@'] [%name %q] [%punctuator %':'] [%punctuator %'('] [%name %k] [%punctuator %':'] [%punctuator %'@'] [%name %v] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'('] [%literal [[%number p=52] q=%.n]] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=42] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%name %a] [%punctuator %'.'] [%name %q] [%punctuator %'.'] [%name %v] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%let type=[[p=[p=[%atom p=%number q=%.n] name='p'] q=[[p=[p=[%atom p=%number q=%.n] name='k'] q=[p=[%atom p=%number q=%.n] name='v']] name='q']] name='a'] val=[p=[%atom p=[[%number p=52] q=%.n]] q=[p=[%atom p=[[%number p=30] q=%.n]] q=[%atom p=[[%number p=42] q=%.n]]]] next=[%limb p=~[[%name p=%a] [%name p=%q] [%name p=%v]]]] + [%let pos=[0 0] type=[[p=[p=[%atom p=%number q=%.n] name='p'] q=[[p=[p=[%atom p=%number q=%.n] name='k'] q=[p=[%atom p=%number q=%.n] name='v']] name='q']] name='a'] val=[p=[%atom p=[[%number p=52] q=%.n]] q=[p=[%atom p=[[%number p=30] q=%.n]] q=[%atom p=[[%number p=42] q=%.n]]]] next=[%limb p=~[[%name p=%a] [%name p=%q] [%name p=%v]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/sets.hoon b/crates/jockt/hoon/tests/lib/sets.hoon index b6c3b49..2705a79 100644 --- a/crates/jockt/hoon/tests/lib/sets.hoon +++ b/crates/jockt/hoon/tests/lib/sets.hoon @@ -8,8 +8,8 @@ 'let a:Set(@) = {1};\0a\0alet b:Set(@) = {1 2};\0a\0alet c:Set(@) = {1 2 3 2 1};\0a\0alet d:Set((@ @)) = {(1 2) (3 4) (1 2)};\0a\0alet e:Set((@ Set(@))) = {(1 {2}) (3 {4 5})};\0a\0a(a b c d e)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %let] [%name %a] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=1] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %d] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'('] [%punctuator %'@'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=4] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %e] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'('] [%punctuator %'@'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%punctuator %'{'] [%literal [[%number p=2] q=%.n]] [%punctuator %'}'] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=3] q=%.n]] [%punctuator %'{'] [%literal [[%number p=4] q=%.n]] [%literal [[%number p=5] q=%.n]] [%punctuator %'}'] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%punctuator %'('] [%name %a] [%name %b] [%name %c] [%name %d] [%name %e] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %let] [%name %a] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=1] q=%.n]] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %d] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'('] [%punctuator %'@'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=3] q=%.n]] [%literal [[%number p=4] q=%.n]] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%literal [[%number p=2] q=%.n]] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %e] [%punctuator %':'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'('] [%punctuator %'@'] [%type 'Set'] [%punctuator %'(('] [%punctuator %'@'] [%punctuator %')'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'='] [%punctuator %'{'] [%punctuator %'('] [%literal [[%number p=1] q=%.n]] [%punctuator %'{'] [%literal [[%number p=2] q=%.n]] [%punctuator %'}'] [%punctuator %')'] [%punctuator %'('] [%literal [[%number p=3] q=%.n]] [%punctuator %'{'] [%literal [[%number p=4] q=%.n]] [%literal [[%number p=5] q=%.n]] [%punctuator %'}'] [%punctuator %')'] [%punctuator %'}'] [%punctuator %';'] [%punctuator %'('] [%name %a] [%name %b] [%name %c] [%name %d] [%name %e] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test diff --git a/crates/jockt/hoon/tests/lib/type-point-2.hoon b/crates/jockt/hoon/tests/lib/type-point-2.hoon index cdf7ab0..ccf5d93 100644 --- a/crates/jockt/hoon/tests/lib/type-point-2.hoon +++ b/crates/jockt/hoon/tests/lib/type-point-2.hoon @@ -8,13 +8,13 @@ 'compose\0a class Point(x:Uint y:Uint) {\0a add(p:(x:Uint y:Uint)) -> Point {\0a (x + p.x\0a y + p.y)\0a }\0a sub(p:(x:Uint y:Uint)) -> Point {\0a (x - p.x\0a y - p.y)\0a }\0a }\0a;\0a\0alet point_1 = Point(104 124);\0apoint_1 = point_1.add(38 38);\0alet point_2 = Point(30 40);\0a//&2\0apoint_2 = point_2.add(212 302);\0a//&1\0apoint_1 = point_1.sub(100 20);\0a//&1\0a( (point_1.x() point_1.y())\0a (point_2.x() point_2.y())\0a)/**/\0a\0a/*\0a:: Hoon equivalent program\0a!=\0a=> mini=mini\0a=>\0a ^= door\0a |_ [x=@ y=@]\0a ++ add\0a |= p=[x=@ y=@]\0a ~(. +> [(add:mini x x.p) (add:mini y y.p)])\0a ++ sub\0a |= p=[x=@ y=@]\0a ~(. +> [(sub:mini x x.p) (sub:mini y y.p)])\0a --\0a=/ point_1\0a ~(. door [104 124])\0a=. point_1 (add:point_1 [38 38])\0a=/ point_2\0a ~(. door [30 40])\0a=. point_1 (sub:point_1 [100 20])\0a=. point_2 (add:point_2 [212 302])\0a[[+12 +13]:point_1 [+12 +13]:point_2]\0a\0aJock:\0a[7 [0 2]\0a 7 [8 [[1 0] 1 0]\0a [1 [8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1]\0a 8 [[1 0] 1 0] [1 [8 [9 3.061 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 3.061 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] 0 1]\0a 8 [8 [0 1] 10 [6 7 [0 3] [1 104] 1 124] 0 2]\0a 7 [10 [2 8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 38] 1 38] 0 2] 0 1]\0a 8 [8 [0 3] 10 [6 7 [0 3] [1 30] 1 40] 0 2]\0a 7 [10 [2 8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 212] 1 302] 0 2] 0 1]\0a 7 [10 [6 8 [7 [0 6] 9 5 0 1] 9 2 10 [6 7 [0 3] [1 100] 1 20] 0 2] 0 1]\0a [[7 [0 6] 7 [0 6] 0 2] 7 [0 6] 7 [0 6] 0 3]\0a [7 [0 2] 7 [0 6] 0 2] 7 [0 2] 7 [0 6] 0 3]\0a\0aHoon:\0a[ 7 [0 4]\0a 7 [8 [1 0 0]\0a [1 [8 [1 0 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 124] 0 28] 0 2] 8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 125] 0 29] 0 2] 0 2] 0 1]\0a 8 [1 0 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [7 [0 31] 9 3.061 0 1] 9 2 10 [6 [0 124] 0 28] 0 2] 8 [7 [0 31] 9 3.061 0 1] 9 2 10 [6 [0 125] 0 29] 0 2] 0 2] 0 1] 0 1]\0a 8 [8 [0 1] 10 [6 7 [0 3] 1 104 124] 0 2]\0a 7 [10 [2 8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] 1 38 38] 0 2] 0 1]\0a* 8 [8 [0 3] 10 [6 7 [0 3] 1 30 40] 0 2]\0a 7 [10 [2 8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] 1 212 302] 0 2] 0 1]\0a 7 [10 [6 8 [7 [0 6] 9 5 0 1] 9 2 10 [6 7 [0 3] 1 100 20] 0 2] 0 1]\0a [7 [0 6] [0 12] 0 13]\0a 7 [0 2] [0 12] 0 13]\0a*/\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %compose] [%keyword %class] [%type 'Point'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %'{'] [%name %add] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Point'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%name %sub] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Point'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'-'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'-'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name 'point_1'] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=104] q=%.n]] [%literal [[%number p=124] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name 'point_1'] [%punctuator %'='] [%name 'point_1'] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=38] q=%.n]] [%literal [[%number p=38] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name 'point_2'] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=40] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name 'point_2'] [%punctuator %'='] [%name 'point_2'] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=212] q=%.n]] [%literal [[%number p=302] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name 'point_1'] [%punctuator %'='] [%name 'point_1'] [%punctuator %'.'] [%name %sub] [%punctuator %'(('] [%literal [[%number p=100] q=%.n]] [%literal [[%number p=20] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%punctuator %'('] [%name 'point_1'] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name 'point_1'] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')'] [%punctuator %'('] [%name 'point_2'] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name 'point_2'] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')'] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %compose] [%keyword %class] [%type 'Point'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %'{'] [%name %add] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Point'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%name %sub] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Point'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'-'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'-'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name 'point_1'] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=104] q=%.n]] [%literal [[%number p=124] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name 'point_1'] [%punctuator %'='] [%name 'point_1'] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=38] q=%.n]] [%literal [[%number p=38] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name 'point_2'] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=40] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name 'point_2'] [%punctuator %'='] [%name 'point_2'] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=212] q=%.n]] [%literal [[%number p=302] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%name 'point_1'] [%punctuator %'='] [%name 'point_1'] [%punctuator %'.'] [%name %sub] [%punctuator %'(('] [%literal [[%number p=100] q=%.n]] [%literal [[%number p=20] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%punctuator %'('] [%name 'point_1'] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name 'point_1'] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')'] [%punctuator %'('] [%name 'point_2'] [%punctuator %'.'] [%name %x] [%punctuator %'(('] [%punctuator %')'] [%name 'point_2'] [%punctuator %'.'] [%name %y] [%punctuator %'(('] [%punctuator %')'] [%punctuator %')'] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%compose p=[%class state=[p=[%state p=[[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='']] name='Point'] arms=[n=[p=%add q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']]] q=~] name='add'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']] body=[p=[%operator op=%'+' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'+' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=~ r=[n=[p=%sub q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']]] q=~] name='sub'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']] body=[p=[%operator op=%'-' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'-' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=~ r=~]]] q=[%let type=[p=[%none p=~] name='point_1'] val=[%call func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=104] q=%.n]] q=[%atom p=[[%number p=124] q=%.n]]]]] next=[%edit limb=~[[%name p='point_1']] val=[%call func=[%limb p=~[[%name p='point_1'] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=38] q=%.n]] q=[%atom p=[[%number p=38] q=%.n]]]]] next=[%let type=[p=[%none p=~] name='point_2'] val=[%call func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=30] q=%.n]] q=[%atom p=[[%number p=40] q=%.n]]]]] next=[%edit limb=~[[%name p='point_2']] val=[%call func=[%limb p=~[[%name p='point_2'] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=212] q=%.n]] q=[%atom p=[[%number p=302] q=%.n]]]]] next=[%edit limb=~[[%name p='point_1']] val=[%call func=[%limb p=~[[%name p='point_1'] [%name p=%sub]]] arg=[~ [p=[%atom p=[[%number p=100] q=%.n]] q=[%atom p=[[%number p=20] q=%.n]]]]] next=[p=[p=[%call func=[%limb p=~[[%name p='point_1'] [%name p=%x]]] arg=~] q=[%call func=[%limb p=~[[%name p='point_1'] [%name p=%y]]] arg=~]] q=[p=[%call func=[%limb p=~[[%name p='point_2'] [%name p=%x]]] arg=~] q=[%call func=[%limb p=~[[%name p='point_2'] [%name p=%y]]] arg=~]]]]]]]]] + [%compose pos=[0 0] p=[%class state=[p=[%state p=[[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='']] name='Point'] arms=[n=[p=%add q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']]] q=~] name='add'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']] body=[p=[%operator op=%'+' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'+' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=~ r=[n=[p=%sub q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']]] q=~] name='sub'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']] body=[p=[%operator op=%'-' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'-' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=~ r=~]]] q=[%let pos=[0 0] type=[p=[%none p=~] name='point_1'] val=[%call pos=[0 0] func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=104] q=%.n]] q=[%atom p=[[%number p=124] q=%.n]]]]] next=[%edit limb=~[[%name p='point_1']] val=[%call pos=[0 0] func=[%limb p=~[[%name p='point_1'] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=38] q=%.n]] q=[%atom p=[[%number p=38] q=%.n]]]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='point_2'] val=[%call pos=[0 0] func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=30] q=%.n]] q=[%atom p=[[%number p=40] q=%.n]]]]] next=[%edit limb=~[[%name p='point_2']] val=[%call pos=[0 0] func=[%limb p=~[[%name p='point_2'] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=212] q=%.n]] q=[%atom p=[[%number p=302] q=%.n]]]]] next=[%edit limb=~[[%name p='point_1']] val=[%call pos=[0 0] func=[%limb p=~[[%name p='point_1'] [%name p=%sub]]] arg=[~ [p=[%atom p=[[%number p=100] q=%.n]] q=[%atom p=[[%number p=20] q=%.n]]]]] next=[p=[p=[%call pos=[0 0] func=[%limb p=~[[%name p='point_1'] [%name p=%x]]] arg=~] q=[%call pos=[0 0] func=[%limb p=~[[%name p='point_1'] [%name p=%y]]] arg=~]] q=[p=[%call pos=[0 0] func=[%limb p=~[[%name p='point_2'] [%name p=%x]]] arg=~] q=[%call pos=[0 0] func=[%limb p=~[[%name p='point_2'] [%name p=%y]]] arg=~]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/type-point-3.hoon b/crates/jockt/hoon/tests/lib/type-point-3.hoon.skip similarity index 53% rename from crates/jockt/hoon/tests/lib/type-point-3.hoon rename to crates/jockt/hoon/tests/lib/type-point-3.hoon.skip index ea13c0b..56a8c73 100644 --- a/crates/jockt/hoon/tests/lib/type-point-3.hoon +++ b/crates/jockt/hoon/tests/lib/type-point-3.hoon.skip @@ -8,13 +8,13 @@ 'compose\0a class Point(x:Uint y:Uint) {\0a add(p:(x:Uint y:Uint)) -> Point {\0a (x + p.x\0a y + p.y)\0a }\0a add_cell(p:(x:Uint y:Uint)) -> (Uint Uint) {\0a (x + p.x\0a y + p.y)\0a }\0a inc(q:Uint) -> @ {\0a +(q)\0a }\0a }\0a;\0a\0alet one = Point(2 13);\0alet two = one.add(30 19);\0alet three = one.inc(41);\0a(two.add_cell(10 10) three)\0a\0a/*\0a:: Hoon equivalent program\0a!=\0a=> mini=mini\0a=>\0a ^= door\0a |_ [x=@ y=@]\0a ++ add\0a |= p=[x=@ y=@]\0a ~(. +> [(add:mini x x.p) (add:mini y y.p)])\0a ++ add_cell\0a |= p=[x=@ y=@]\0a [(add:mini x x.p) (add:mini y y.p)]\0a ++ inc\0a |= q=@\0a +(q)\0a --\0a=/ one\0a ~(. door [2 13])\0a=/ two (add:one [30 19])\0a=/ three (inc:one 41)\0a[(add_cell:two [10 10]) three]\0a\0a<<<<<<< HEAD\0aJock:\0a[7 [8 [[1 0] 1 0] [1 [8 [[1 0] 1 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 2] 0 1] [8 [1 0] [1 4 0 6] 0 1] 8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] 0 1] 8 [8 [0 1] 10 [6 7 [0 3] [1 2] 1 13] 0 2] 8 [8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 30] 1 19] 0 2] 8 [8 [7 [0 6] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2] [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] [1 10] 1 10] 0 2] 0 2]\0a\0aHoon:\0a=======\0aH:\0a>>>>>>> sigilante/itll-cost-you-an-arm-and-a-leg\0a[ 7\0a [0 2]\0a 7\0a [ 8\0a [1 0 0]\0a [ 1\0a [8 [1 0 0] [1 [8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 124] 0 28] 0 2] 8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 125] 0 29] 0 2] 0 1]\0a [8 [1 0 0] [1 8 [0 7] 10 [6 7 [0 3] [8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 124] 0 28] 0 2] 8 [7 [0 31] 9 348 0 1] 9 2 10 [6 [0 125] 0 29] 0 2] 0 2] 0 1]\0a 8 [1 0] [1 4 0 6] 0 1]\0a<<<<<<< HEAD\0a 0 1]\0a 8 [8 [0 1] 10 [6 7 [0 3] 1 2 13] 0 2] 8\0a [8 [7 [0 2] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 30 19] 0 2]\0a 8 [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2]\0a [8 [7 [0 6] 9 4 0 1] 9 2 10 [6 7 [0 3] 1 10 10] 0 2] 0 2]\0a=======\0a 0 1]\0a 8 [8 [0 1] 10 [6 7 [0 3] 1 2 13] 0 2]\0a 8 [8 [7 [0 2] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 30 19] 0 2]\0a 8 [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2]\0a [8 [7 [0 6] 9 4 0 1] 9 2 10 [6 7 [0 3] 1 10 10] 0 2] 0 2]\0a\0aJ:\0a[7\0a [8 [[1 0] 1 0]\0a [1 [8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1]\0a [8 [1 0] [1 4 0 6] 0 1]\0a 8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1]\0a 0 1]\0a 8 [8 [0 1] 10 [6 7 [0 3] [1 2] 1 13] 0 2]\0a 8 [8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 30] 1 19] 0 2]\0a 8 [8 [7 [0 6] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2]\0a [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] [1 10] 1 10] 0 2] 0 2]\0a\0a7 [8 [[1 0] 1 0] [1 [8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] [8 [1 0] [1 4 0 6] 0 1] 8 [[1 0] 1 0] [1 [8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 60] 0 12] 0 2] 8 [9 348 0 62] 9 2 10 [6 7 [0 3] [0 61] 0 13] 0 2] 0 1] 0 1] 8 [8 [0 1] 10 [6 7 [0 3] [1 2] 1 13] 0 2] 8 [8 [7 [0 2] 9 4 0 1] 9 2 10 [6 7 [0 3] [1 30] 1 19] 0 2] 8 [8 [7 [0 6] 9 10 0 1] 9 2 10 [6 7 [0 3] 1 41] 0 2] [8 [7 [0 6] 9 11 0 1] 9 2 10 [6 7 [0 3] [1 10] 1 10] 0 2] 0 2]]\0a>>>>>>> sigilante/itll-cost-you-an-arm-and-a-leg\0a*/\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %compose] [%keyword %class] [%type 'Point'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %'{'] [%name %add] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Point'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%name %add_cell] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'('] [%type 'Uint'] [%type 'Uint'] [%punctuator %')'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%name %inc] [%punctuator %'(('] [%name %q] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %q] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %one] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=13] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %two] [%punctuator %'='] [%name %one] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=19] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %three] [%punctuator %'='] [%name %one] [%punctuator %'.'] [%name %inc] [%punctuator %'(('] [%literal [[%number p=41] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%name %two] [%punctuator %'.'] [%name %add_cell] [%punctuator %'(('] [%literal [[%number p=10] q=%.n]] [%literal [[%number p=10] q=%.n]] [%punctuator %')'] [%name %three] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %compose] [%keyword %class] [%type 'Point'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %'{'] [%name %add] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Point'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%name %add_cell] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'('] [%name %x] [%punctuator %':'] [%type 'Uint'] [%name %y] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'('] [%type 'Uint'] [%type 'Uint'] [%punctuator %')'] [%punctuator %'{'] [%punctuator %'('] [%name %x] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %x] [%name %y] [%punctuator %'+'] [%name %p] [%punctuator %'.'] [%name %y] [%punctuator %')'] [%punctuator %'}'] [%name %inc] [%punctuator %'(('] [%name %q] [%punctuator %':'] [%type 'Uint'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%punctuator %'@'] [%punctuator %'{'] [%punctuator %'+'] [%punctuator %'('] [%name %q] [%punctuator %')'] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %one] [%punctuator %'='] [%type 'Point'] [%punctuator %'(('] [%literal [[%number p=2] q=%.n]] [%literal [[%number p=13] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %two] [%punctuator %'='] [%name %one] [%punctuator %'.'] [%name %add] [%punctuator %'(('] [%literal [[%number p=30] q=%.n]] [%literal [[%number p=19] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %three] [%punctuator %'='] [%name %one] [%punctuator %'.'] [%name %inc] [%punctuator %'(('] [%literal [[%number p=41] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%punctuator %'('] [%name %two] [%punctuator %'.'] [%name %add_cell] [%punctuator %'(('] [%literal [[%number p=10] q=%.n]] [%literal [[%number p=10] q=%.n]] [%punctuator %')'] [%name %three] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%compose p=[%class state=[p=[%state p=[[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='']] name='Point'] arms=[n=[p=%add_cell q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[[p=[p=[%atom p=%number q=%.n] name='Uint'] q=[p=[%atom p=%number q=%.n] name='Uint']] name='']]] q=~] name='add_cell'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[[p=[p=[%atom p=%number q=%.n] name='Uint'] q=[p=[%atom p=%number q=%.n] name='Uint']] name='']] body=[p=[%operator op=%'+' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'+' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=[n=[p=%add q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']]] q=~] name='add'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']] body=[p=[%operator op=%'+' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'+' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=~ r={[p=%inc q=[%method type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='q']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='inc'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='q']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%q]]]] context=~]]]]}] r=~]] q=[%let type=[p=[%none p=~] name='one'] val=[%call func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=2] q=%.n]] q=[%atom p=[[%number p=13] q=%.n]]]]] next=[%let type=[p=[%none p=~] name='two'] val=[%call func=[%limb p=~[[%name p=%one] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=30] q=%.n]] q=[%atom p=[[%number p=19] q=%.n]]]]] next=[%let type=[p=[%none p=~] name='three'] val=[%call func=[%limb p=~[[%name p=%one] [%name p=%inc]]] arg=[~ [%atom p=[[%number p=41] q=%.n]]]] next=[p=[%call func=[%limb p=~[[%name p=%two] [%name p=%add_cell]]] arg=[~ [p=[%atom p=[[%number p=10] q=%.n]] q=[%atom p=[[%number p=10] q=%.n]]]]] q=[%limb p=~[[%name p=%three]]]]]]]] + [%compose pos=[0 0] p=[%class state=[p=[%state p=[[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='']] name='Point'] arms=[n=[p=%add_cell q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[[p=[p=[%atom p=%number q=%.n] name='Uint'] q=[p=[%atom p=%number q=%.n] name='Uint']] name='']]] q=~] name='add_cell'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[[p=[p=[%atom p=%number q=%.n] name='Uint'] q=[p=[%atom p=%number q=%.n] name='Uint']] name='']] body=[p=[%operator op=%'+' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'+' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=[n=[p=%add q=[%method type=[p=[%core p=[%.y p=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']]] q=~] name='add'] body=[%lambda p=[arg=[inp=[~ [[p=[p=[%atom p=%number q=%.n] name='x'] q=[p=[%atom p=%number q=%.n] name='y']] name='p']] out=[p=[%limb p=~[[%type p='Point']]] name='Point']] body=[p=[%operator op=%'+' a=[%limb p=~[[%name p=%x]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%x]]]]] q=[%operator op=%'+' a=[%limb p=~[[%name p=%y]]] b=[~ [%limb p=~[[%name p=%p] [%name p=%y]]]]]] context=~]]]] l=~ r={[p=%inc q=[%method type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='q']] out=[p=[%atom p=%number q=%.n] name='']]] q=~] name='inc'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='q']] out=[p=[%atom p=%number q=%.n] name='']] body=[%increment val=[%limb p=~[[%name p=%q]]]] context=~]]]]}] r=~]] q=[%let pos=[0 0] type=[p=[%none p=~] name='one'] val=[%call pos=[0 0] func=[%limb p=~[[%type p='Point']]] arg=[~ [p=[%atom p=[[%number p=2] q=%.n]] q=[%atom p=[[%number p=13] q=%.n]]]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='two'] val=[%call pos=[0 0] func=[%limb p=~[[%name p=%one] [%name p=%add]]] arg=[~ [p=[%atom p=[[%number p=30] q=%.n]] q=[%atom p=[[%number p=19] q=%.n]]]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='three'] val=[%call pos=[0 0] func=[%limb p=~[[%name p=%one] [%name p=%inc]]] arg=[~ [%atom p=[[%number p=41] q=%.n]]]] next=[p=[%call pos=[0 0] func=[%limb p=~[[%name p=%two] [%name p=%add_cell]]] arg=[~ [p=[%atom p=[[%number p=10] q=%.n]] q=[%atom p=[[%number p=10] q=%.n]]]]] q=[%limb p=~[[%name p=%three]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/crates/jockt/hoon/tests/lib/type-point.hoon b/crates/jockt/hoon/tests/lib/type-point.hoon index b357526..9ceb3b4 100644 --- a/crates/jockt/hoon/tests/lib/type-point.hoon +++ b/crates/jockt/hoon/tests/lib/type-point.hoon @@ -8,13 +8,13 @@ '/* A class is broadly equivalent to a Hoon door. It has a top-level\0a sample which represents its state, along with methods that have\0a each their own samples.\0a\0a A class must be composed into the subject to be accessible.\0a*/\0acompose\0a class Foo(x:@) {\0a bar(p:@) -> Foo {\0a p\0a }\0a }\0a; // end compose\0a\0a// let name:Type = value;\0alet a:Foo = Foo(41);\0a// let name = Type(value);\0alet b = Foo(42);\0a// let name:type = value;\0alet c:@ = 43;\0a\0a(Foo(40) a b c)\0a' ++ test-tokenize %+ expect-eq:test - !> ~[[%keyword %compose] [%keyword %class] [%type 'Foo'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'{'] [%name %bar] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Foo'] [%punctuator %'{'] [%name %p] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %a] [%punctuator %':'] [%type 'Foo'] [%punctuator %'='] [%type 'Foo'] [%punctuator %'(('] [%literal [[%number p=41] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%type 'Foo'] [%punctuator %'(('] [%literal [[%number p=42] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=43] q=%.n]] [%punctuator %';'] [%punctuator %'('] [%type 'Foo'] [%punctuator %'(('] [%literal [[%number p=40] q=%.n]] [%punctuator %')'] [%name %a] [%name %b] [%name %c] [%punctuator %')']] - !> (rash text parse-tokens:jock) + !> ^- (list token-body:jock) ~[[%keyword %compose] [%keyword %class] [%type 'Foo'] [%punctuator %'(('] [%name %x] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'{'] [%name %bar] [%punctuator %'(('] [%name %p] [%punctuator %':'] [%punctuator %'@'] [%punctuator %')'] [%punctuator %'-'] [%punctuator %'>'] [%type 'Foo'] [%punctuator %'{'] [%name %p] [%punctuator %'}'] [%punctuator %'}'] [%punctuator %';'] [%keyword %let] [%name %a] [%punctuator %':'] [%type 'Foo'] [%punctuator %'='] [%type 'Foo'] [%punctuator %'(('] [%literal [[%number p=41] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %b] [%punctuator %'='] [%type 'Foo'] [%punctuator %'(('] [%literal [[%number p=42] q=%.n]] [%punctuator %')'] [%punctuator %';'] [%keyword %let] [%name %c] [%punctuator %':'] [%punctuator %'@'] [%punctuator %'='] [%literal [[%number p=43] q=%.n]] [%punctuator %';'] [%punctuator %'('] [%type 'Foo'] [%punctuator %'(('] [%literal [[%number p=40] q=%.n]] [%punctuator %')'] [%name %a] [%name %b] [%name %c] [%punctuator %')']] + !> `(list token-body:jock)`(turn (rash text parse-tokens:jock) |=(=token:jock +.token)) :: ++ test-jeam %+ expect-eq:test !> ^- jock:jock - [%compose p=[%class state=[p=[%state p=[p=[%atom p=%number q=%.n] name='x']] name='Foo'] arms=[n=[p=%bar q=[%method type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='p']] out=[p=[%limb p=~[[%type p='Foo']]] name='Foo']]] q=~] name='bar'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='p']] out=[p=[%limb p=~[[%type p='Foo']]] name='Foo']] body=[%limb p=~[[%name p=%p]]] context=~]]]] l=~ r=~]] q=[%let type=[p=[%limb p=~[[%type p='Foo']]] name='a'] val=[%call func=[%limb p=~[[%type p='Foo']]] arg=[~ [%atom p=[[%number p=41] q=%.n]]]] next=[%let type=[p=[%none p=~] name='b'] val=[%call func=[%limb p=~[[%type p='Foo']]] arg=[~ [%atom p=[[%number p=42] q=%.n]]]] next=[%let type=[p=[%atom p=%number q=%.n] name='c'] val=[%atom p=[[%number p=43] q=%.n]] next=[p=[%call func=[%limb p=~[[%type p='Foo']]] arg=[~ [%atom p=[[%number p=40] q=%.n]]]] q=[p=[%limb p=~[[%name p=%a]]] q=[p=[%limb p=~[[%name p=%b]]] q=[%limb p=~[[%name p=%c]]]]]]]]]] + [%compose pos=[0 0] p=[%class state=[p=[%state p=[p=[%atom p=%number q=%.n] name='x']] name='Foo'] arms=[n=[p=%bar q=[%method type=[p=[%core p=[%.y p=[inp=[~ [p=[%atom p=%number q=%.n] name='p']] out=[p=[%limb p=~[[%type p='Foo']]] name='Foo']]] q=~] name='bar'] body=[%lambda p=[arg=[inp=[~ [p=[%atom p=%number q=%.n] name='p']] out=[p=[%limb p=~[[%type p='Foo']]] name='Foo']] body=[%limb p=~[[%name p=%p]]] context=~]]]] l=~ r=~]] q=[%let pos=[0 0] type=[p=[%limb p=~[[%type p='Foo']]] name='a'] val=[%call pos=[0 0] func=[%limb p=~[[%type p='Foo']]] arg=[~ [%atom p=[[%number p=41] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%none p=~] name='b'] val=[%call pos=[0 0] func=[%limb p=~[[%type p='Foo']]] arg=[~ [%atom p=[[%number p=42] q=%.n]]]] next=[%let pos=[0 0] type=[p=[%atom p=%number q=%.n] name='c'] val=[%atom p=[[%number p=43] q=%.n]] next=[p=[%call pos=[0 0] func=[%limb p=~[[%type p='Foo']]] arg=[~ [%atom p=[[%number p=40] q=%.n]]]] q=[p=[%limb p=~[[%name p=%a]]] q=[p=[%limb p=~[[%name p=%b]]] q=[%limb p=~[[%name p=%c]]]]]]]]]] !> (jeam:jock text) :: ++ test-mint diff --git a/docs/JOCK_COMPLETION_SPEC.md b/docs/JOCK_COMPLETION_SPEC.md new file mode 100644 index 0000000..3eeb6f9 --- /dev/null +++ b/docs/JOCK_COMPLETION_SPEC.md @@ -0,0 +1,894 @@ +# Jock Language Completion Specification +## Mission: Make Nock Programming Accessible & Production-Ready + +**Status:** Alpha → Beta → Production +**Target:** NockApp kernels, Urbit Gall agents, Nockchain applications +**Repository:** github.com/zorp-corp/jock-lang (fork: github.com/sigilante/jock-lang) + +--- + +## Executive Summary + +Jock is a subject-oriented, statically-typed functional language targeting Nock ISA. Current state: functional alpha with ad hoc type system. Goal: production-ready language with rigorous type system, full NockApp/Gall compatibility, and developer-friendly tooling. + +**Critical Path:** +1. Type system overhaul (Beta spec → implementation) +2. NockApp kernel interface completion +3. Gall agent primitives +4. Compiler optimization (sKa, jet matching) +5. Developer tooling (LSP, debugger, package manager) + +--- + +## Current State Assessment + +### What Works (Alpha) +- Basic compiler pipeline: Jock → AST → Nock +- Core language features: functions, objects, control flow +- Hoon FFI (limited) +- Basic types: atoms, cells, lists, sets +- NockApp integration (via hoonc) +- Test framework (jockt) + +### What's Broken/Missing +- **Type system**: ad hoc, no traits, weak inference +- **Standard library**: minimal, no Path/Wire native support +- **NockApp interface**: incomplete kernel primitives +- **Gall integration**: no agent support +- **Tooling**: no LSP, limited debugging, no package manager +- **Documentation**: incomplete, no design rationale docs +- **Performance**: naive compilation, no sKa optimization + +--- + +## Phase 1: Type System Overhaul (Beta → Implementation) + +### 1.1 Core Type System Components + +#### Structs +```jock +// Product types with named fields +struct Point { + x: Real + y: Real +} + +// Single-field newtypes (nominal wrappers) +struct UserId(Atom) // opaque, requires explicit cast + +// Transparent aliases +alias Path = List // no cast needed +``` + +**Implementation Requirements:** +- Parse struct definitions into AST nodes +- Generate Nock core with appropriate battery/sample layout +- Track field names and types in compilation environment +- Support structural equality checking +- Compile-time name resolution for fields + +**Nock Compilation Strategy:** +- Struct → Door (core with sample) +- Fields → Sample slots at computed axes +- Methods → Battery arms +- Constructor → Gate that produces core instance + +#### Traits +```jock +trait Arithmetic { + add(self, other: Self) -> Self + neg(self) -> Self +} + +impl Arithmetic for Vec2 { + add(self, other: Self) -> Self { + Vec2(self.x + other.x, self.y + other.y) + } + neg(self) -> Self { + Vec2(-self.x, -self.y) + } +} +``` + +**Implementation Requirements:** +- Trait definition parsing and validation +- Impl block compilation to Nock cores +- Method resolution via subject tree walking +- Trait bounds checking at compile time +- Monomorphization (no dynamic dispatch) + +**Critical Design Decision:** +Use `class` keyword instead of `impl` to manage subject scope: +```jock +class Point(List) { + head(self) -> ?Chars { /* ... */ } + tail(self) -> Path { /* ... */ } + + // Nested impl for specific traits + concat impl List { + /* ... */ + } +} +``` + +**Subject-Oriented Method Resolution:** +1. Walk subject tree (axis-by-axis) +2. Find arm named `method` where target type = `T` +3. Emit Nock: slot access + slam +4. Name collisions: compile error (v1), later add `^` skip syntax + +#### Unions (Sum Types) +```jock +union Result { + case ok(value: Atom) + case err(code: Atom, msg: Chars) +} +``` + +**Implementation Requirements:** +- Head-tagged cells: `[%ok value]`, `[%err code msg]` +- Pattern matching via `switch`/`match` (following `?+` pattern) +- Exhaustiveness checking +- No generics on unions for v1 + +#### Generics +```jock +func first(xs: List) -> ?T { + switch xs { + [] -> ~ + [head, ..tail] -> [~ head] + } +} + +let x = first([1 2 3]) // T = Atom inferred +let y = first([] as List) // T = Atom explicit +``` + +**Implementation Requirements:** +- Type parameter binding at call site +- Monomorphization (generate separate Nock for each concrete type) +- Empty collection annotation requirement +- Forward inference in function bodies +- No runtime polymorphism + +### 1.2 Advanced Type Features + +#### Option Chaining +```jock +e: T → e.f: U +e: ?T → e?.f: ?U +e: ??T → e?.f: ???U // no flattening +e: ?T, d:T → e ?? d: T // default +e: ?T → e!: T // unwrap-or-crash +``` + +**Implementation Strategy:** +- Compile-time tracking of option depth +- Nock compilation: test for `~`, branch accordingly +- `!` operator: crash if null (Nock `[0 0]`) +- `??` operator: test left, return left if non-null, else right + +#### Casting +| Syntax | Compile-time | Runtime | Use | +|--------|-------------|---------|-----| +| `as` | structural check | no | same-shape nominal conversion | +| `as?` | target known | mold check | returns `?T`, safe narrowing | +| `as!` | target known | mold check | returns `T`, crash on fail | + +**Implementation Requirements:** +- Structural cast: ignore field names, check shape +- `as?`: runtime mold check (Hoon `;;` semantics), wrap in unit +- `as!`: runtime mold check, crash if fail +- All casts compile to Nock with appropriate type assertions + +### 1.3 Type Inference Rules +| Context | Inference | +|---------|-----------| +| Function params | Explicit required | +| Function return | Explicit required | +| Lambda params | Explicit required | +| Lambda return | Explicit required | +| `let` binding | Inferred from RHS, or explicit | +| Generic type params | Inferred from arguments at call site | +| Empty collections | Explicit annotation required | +| Mixed numeric literals | Unify to supertype | +| Binary ops across types | Determined by operator's trait impl | + +**Implementation Strategy:** +- Hindley-Milner-style inference for `let` bindings +- Explicit annotations everywhere else (pragmatic approach) +- Type errors: clear messages with suggested fixes + +--- + +## Phase 2: NockApp Kernel Interface + +### 2.1 Kernel Structure Requirements + +**Standard Kernel Arms (Fixed Axes):** +- `+4` / `+load`: Load/upgrade kernel state +- `+10` / `+wish`: Evaluate Hoon expressions (optional) +- `+22` / `+peek`: Read-only state access (scry) +- `+23` / `+poke`: State-altering requests + +**Jock Implementation:** +```jock +class Kernel(state: AppState) { + // +load: upgrade handler + load(old: Noun) -> AppState { + // migration logic + old as! AppState + } + + // +wish: Hoon eval (can crash if not needed) + wish(expr: Noun) -> Noun { + crash("wish not implemented") + } + + // +peek: read-only queries + peek(path: Path) -> ?(?(Noun)) { + switch path { + /state/version -> [~ ~ version] + /state/data -> [~ ~ state.data] + _ -> [~ ~] // not found + } + } + + // +poke: state mutations + poke(cause: Noun) -> (List, AppState) { + let (effects, new_state) = process_cause(state, cause); + (effects, new_state) + } +} +``` + +**Compilation Strategy:** +- Generate door with sample = state +- Battery arms at correct axes (use Hoon `++set` ordering) +- Compile each arm to Nock formula +- Ensure type-correct returns + +### 2.2 Essential NockApp Types + +From Beta spec, implement these natively: +```jock +alias Tang = List +alias Term = Chars + +struct Goof { + mote: Term + tang: Tang +} + +alias Wire = Path + +struct Input { + eny: Uint // entropy + our: Hex // ship identity + now: Date // current time + cause: Noun // arbitrary cause data +} + +struct Ovum { + wire: Wire + input: Input +} + +struct Crud { + goof: Goof + input: Input +} +``` + +**Path Native Syntax (Already Implemented in Beta):** +```jock +let p = /foo/bar/(segment)/baz +let q = / +let r = /users/(user-id as Chars)/profile +``` + +**Implementation Requirements:** +- Parser support for `/foo/bar` syntax → `List` +- Compile to standard Hoon path representation +- Interpolation support: `/(variable)` embeds value +- Type checking: ensure interpolated values are `Chars`-compatible + +--- + +## Phase 3: Urbit Gall Integration + +### 3.1 Gall Agent Primitives + +**Agent Arms (Beyond Kernel):** +```jock +class GallAgent(state: AgentState) { + // Kernel interface + load(old: Noun) -> AgentState { /* ... */ } + peek(path: Path) -> ?(?(Noun)) { /* ... */ } + poke(cause: Noun) -> (List, AgentState) { /* ... */ } + + // Gall-specific + on_init() -> (List, AgentState) { + // agent initialization + ([/* cards */], initial_state) + } + + on_watch(path: Path) -> (List, AgentState) { + // subscription handling + ([/* initial facts */], state) + } + + on_leave(path: Path) -> (List, AgentState) { + // unsubscription handling + ([], state) + } + + on_agent(wire: Wire, sign: Sign) -> (List, AgentState) { + // agent communication + match sign { + poke_ack -> ([], state) + watch_ack -> ([], state) + kick -> ([], state) + fact -> { + // process fact + ([], new_state) + } + } + } + + on_arvo(wire: Wire, sign: ArvoSign) -> (List, AgentState) { + // Arvo vane interaction + ([], state) + } + + on_fail(term: Term, tang: Tang) -> (List, AgentState) { + // error handling + ([], state) + } +} +``` + +### 3.2 Effect/Card System + +**Basic Card Types:** +```jock +union Card { + case poke(ship: Ship, agent: Term, mark: Mark, noun: Noun) + case watch(ship: Ship, agent: Term, path: Path) + case leave(ship: Ship, agent: Term) + case give(path: Path, mark: Mark, noun: Noun) + case pass(wire: Wire, note: Note) +} + +union Note { + case behn(BehnNote) // timer + case eyre(EyreNote) // HTTP + case gall(GallNote) // agent + case clay(ClayNote) // filesystem +} +``` + +**Implementation Strategy:** +- Cards compile to standard Urbit card format +- Type checking ensures correct structure +- Helper functions for common patterns + +--- + +## Phase 4: Compiler Optimization + +### 4.1 Subject Knowledge Analysis (sKa) + +**Problem:** Naive compilation produces verbose Nock with excessive cell allocation. + +**Solution:** Track known subject structure to optimize slot access. + +**Implementation:** +1. Build subject type during compilation +2. Compute axes statically whenever possible +3. Eliminate redundant subject operations +4. Fold constant expressions + +**Example Optimization:** +```jock +let x = 42; +let y = x + 1; +y * 2 +``` + +Naive: +```nock +[8 [1 42] 8 [7 [0 2] 4 0 1] 7 [0 2] [4 4 0 1]] +``` + +Optimized (with sKa): +```nock +[1 86] // constant fold: (42 + 1) * 2 = 86 +``` + +### 4.2 Jet Matching + +**Problem:** Arithmetic operations beyond increment are slow in Nock. + +**Solution:** Emit Nock patterns that match standard jets. + +**Standard Jets to Target:** +- `add`, `sub`, `mul`, `div`, `mod` (arithmetic) +- `lent`, `snag`, `weld` (lists) +- `turn`, `roll`, `fold` (higher-order) +- String operations + +**Implementation Strategy:** +1. Maintain jet hint database +2. Recognize common patterns in AST +3. Emit Nock with jet hints (opcode 11) +4. Fallback to pure Nock if jet unavailable + +--- + +## Phase 5: Developer Tooling + +### 5.1 Language Server Protocol (LSP) + +**Essential Features:** +- Syntax highlighting +- Error diagnostics (inline) +- Go-to-definition +- Auto-completion (context-aware) +- Hover documentation +- Rename refactoring + +**Implementation Strategy:** +- Separate LSP server binary +- Reuse parser/type checker from jockc +- Incremental compilation for responsiveness +- VSCode extension as reference implementation + +### 5.2 Debugger + +**Features:** +- Breakpoints in Jock code +- Step through execution +- Inspect subject structure +- View Nock trace +- Time-travel debugging (replay) + +**Implementation Strategy:** +- Instrument compiled Nock with debug hints +- Build debugger on top of NockVM +- Interactive REPL with inspection +- Integration with jockc + +### 5.3 Package Manager + +**Goals:** +- Distribute Jock libraries +- Dependency management +- Version resolution +- Integration with Urbit %yard desks + +**Design:** +``` +jock.toml: + [package] + name = "my-app" + version = "0.1.0" + + [dependencies] + stdlib = "1.0" + json = "0.5" + +Command: + jock build + jock install + jock publish +``` + +--- + +## Phase 6: Standard Library + +### 6.1 Core Modules + +**collections:** +- `List`: standard list operations +- `Set`: ordered sets +- `Dict`: maps/dictionaries +- `Vector`: contiguous arrays (Lagoon ndray) + +**string:** +- `Chars` operations: concat, split, trim +- `String` operations: convert to/from list +- Unicode support +- Parsing helpers + +**math:** +- Arithmetic traits implementation +- Trig functions (via jets) +- Random number generation (from entropy) + +**time:** +- `Date` operations +- `Span` (duration) arithmetic +- Formatting/parsing + +**io:** +- HTTP client/server helpers +- File system access (via Clay) +- JSON serialization + +**crypto:** +- Hashing (SHA, Blake) +- Signing/verification +- Encryption (AES, ChaCha) + +### 6.2 Gall Helpers + +**agent-utils:** +- Standard agent template +- Card builders +- Subscription management +- State persistence patterns + +**scry:** +- Type-safe scry interface +- Common scry patterns +- Cache management + +--- + +## Phase 7: Testing & Documentation + +### 7.1 Test Framework Expansion + +**Unit Testing:** +```jock +test "arithmetic" { + assert 1 + 1 == 2 + assert 5 - 3 == 2 + assert 4 * 3 == 12 +} + +test "list operations" { + let xs = [1, 2, 3]; + assert xs.length() == 3 + assert xs.first() == [~ 1] +} +``` + +**Property Testing:** +```jock +property "addition commutative" { + forall (a: Atom, b: Atom) { + a + b == b + a + } +} +``` + +**Integration Testing:** +- Full NockApp kernel tests +- Gall agent lifecycle tests +- Network interaction tests + +### 7.2 Documentation + +**Required Docs:** +- Language reference (complete) +- Standard library API docs +- NockApp guide +- Gall agent tutorial +- Compiler internals (design docs) +- Nock compilation strategy +- Migration guide (Hoon → Jock) + +**Doc Generation:** +- Extract from source comments +- Generate markdown/HTML +- Host on docs.jock.org +- Searchable with examples + +--- + +## Implementation Priorities + +### P0 (Critical Path - 3 months) +1. Type system overhaul (structs, traits, unions, generics) +2. Path syntax completion +3. NockApp kernel interface +4. Basic standard library (collections, string, math) + +### P1 (Production Ready - 3 months) +5. Gall agent primitives +6. Compiler optimization (sKa, basic jet matching) +7. LSP server (basic features) +8. Comprehensive test suite + +### P2 (Developer Experience - 3 months) +9. Debugger +10. Package manager +11. Full standard library +12. Complete documentation + +### P3 (Nice to Have - 6 months) +13. Advanced optimizations +14. Property testing framework +15. Formal verification tools +16. Visual debugging tools + +--- + +## Technical Constraints & Design Decisions + +### Hard Constraints +1. **Subject-oriented compilation:** Every operation must work with Nock's subject model +2. **Binary tree addressing:** All data access via axis notation +3. **Functional purity:** No mutable state at Nock level +4. **Homoiconicity:** Code and data unified as nouns + +### Design Principles +1. **Pragmatism over elegance:** Choose solutions that work in production +2. **Explicit over implicit:** Require type annotations where inference is complex +3. **Safety with escape hatches:** Type system enforced, but allow `Noun` escape +4. **Hoon compatibility:** FFI should be seamless and bidirectional +5. **Performance awareness:** Naive compilation acceptable, but provide optimization path + +### Known Trade-offs +1. **Monomorphization vs. code size:** Accept code duplication for performance +2. **Explicit typing vs. ergonomics:** Reduce bugs at cost of verbosity +3. **Nock fidelity vs. abstractions:** Stay close to metal, add sugar carefully +4. **Innovation vs. stability:** Beta breaking changes acceptable, then stabilize + +--- + +## Success Criteria + +### Beta Release (6 months) +- [ ] Type system complete (structs, traits, unions, generics) +- [ ] NockApp kernel interface working +- [ ] Path syntax implemented +- [ ] Basic standard library +- [ ] 100+ passing tests +- [ ] Documentation 80% complete + +### 1.0 Release (12 months) +- [ ] Gall agent support +- [ ] Compiler optimization (sKa) +- [ ] LSP server (basic) +- [ ] Full standard library +- [ ] 500+ passing tests +- [ ] Production apps deployed + +### 2.0 Release (18 months) +- [ ] Debugger +- [ ] Package manager +- [ ] Advanced optimizations +- [ ] Property testing +- [ ] Enterprise adoption + +--- + +## Migration Strategy (Hoon → Jock) + +### Automated Translation +**Feasible:** +- Basic arithmetic, logic +- Function definitions +- Struct/core definitions +- Simple control flow + +**Requires Manual Work:** +- Irregular Hoon syntax (`?:`, `?@`, etc.) +- Complex macros (`=<`, `=^`, etc.) +- Type system edge cases +- Idiomatic patterns + +### Translation Tool +```bash +hoon2jock input.hoon > output.jock +``` + +**Strategy:** +1. Parse Hoon AST (using Hoon parser) +2. Map to Jock AST (semantic translation) +3. Generate Jock source +4. Manual review + cleanup + +--- + +## Risk Mitigation + +### Technical Risks +1. **Type system complexity:** Mitigate with staged rollout, extensive testing +2. **Compiler bugs:** Mitigate with property testing, fuzzing, formal methods +3. **Performance issues:** Mitigate with benchmarking, profiling, jet matching +4. **NockApp incompatibility:** Mitigate with integration tests, real-world apps + +### Adoption Risks +1. **Learning curve:** Mitigate with tutorials, examples, migration guide +2. **Hoon ecosystem lock-in:** Mitigate with excellent FFI, gradual migration +3. **Tooling gaps:** Mitigate with LSP early, prioritize developer experience +4. **Documentation debt:** Mitigate with docs-first approach, examples in tests + +--- + +## Appendix A: Nock Compilation Patterns + +### Function Calls +```jock +func add(a: Atom, b: Atom) -> Atom { + a + b +} +add(3, 5) +``` + +Compiles to: +```nock +// Gate construction +[8 [1 0] [1 [4 4 0 1] 0 1] 0 1] +// Slam: [[3 5] gate] -> 8 +[9 2 10 [6 7 [0 3] 1 3 5] 0 1] +``` + +### Recursion +```jock +func factorial(n: Atom) -> Atom { + if n == 0 { + 1 + } else { + n * $(n - 1) + } +} +``` + +Compiles to: +```nock +// Use $ as recursion point (Nock 9 with axis 2) +[8 [1 n] + 6 [5 [0 2] 1 0] + [1 1] + [4 4 [0 2] [9 2 10 [6 [4 0 6] 0 2] 0 1]] + 0 1] +``` + +### Loop Constructs +```jock +let a = 43; +let b = 0; +loop; +if a == +(b) { + b +} else { + b = +(b); + recur +} +``` + +Compiles to: +```nock +[8 [1 43] + 8 [1 0] + 8 [1 0] + 6 [5 [0 6] [4 0 14]] + [0 14] + [7 [10 [14 1] 0 1] 9 2 10 [6 1 0] 0 1] + 0 1] +``` + +--- + +## Appendix B: Subject Layout Examples + +### Simple Function Subject +```jock +let x = 5; +let y = 10; +func add_xy(z: Atom) -> Atom { + x + y + z +} +``` + +Subject structure: +``` +[battery payload] + battery: [[add_xy-formula] context] + payload: [z [y [x prior-subject]]] + +Axes: + +2: battery + +3: payload (entire) + +6: z + +7: [y [x prior-subject]] + +14: y + +15: [x prior-subject] + +30: x +``` + +### Class Subject +```jock +class Counter(value: Atom) { + increment(self) -> Counter { + Counter(self.value + 1) + } + + get(self) -> Atom { + self.value + } +} +``` + +Subject structure: +``` +[battery sample] + battery: [[increment get] ...] + sample: value (Atom) + +Method resolution: + - Walk to find arm by name + - Slam with sample +``` + +--- + +## Appendix C: Recommended Reading + +### Nock & Urbit Fundamentals +- [Nock Definition](https://docs.urbit.org/language/nock/reference/definition) +- [~timluc-miptev: Nock for Everyday Coders](https://blog.timlucmiptev.space/part1.html) +- [Hoon School](https://docs.urbit.org/courses/hoon-school) + +### Type Systems +- *Types and Programming Languages* (Pierce) +- *Advanced Topics in Types and Programming Languages* (Pierce) +- Rust documentation (trait system reference) +- Swift documentation (protocol-oriented programming) + +### Compiler Design +- *Compilers: Principles, Techniques, and Tools* (Dragon Book) +- *Engineering a Compiler* (Cooper & Torczon) +- LLVM documentation (optimization passes) + +### Language Design +- *Structure and Interpretation of Computer Programs* (Abelson & Sussman) +- *Practical Foundations for Programming Languages* (Harper) +- *The Implementation of Functional Programming Languages* (Peyton Jones) + +--- + +## Appendix D: Community & Resources + +### Communication Channels +- GitHub Issues: Bug reports, feature requests +- Urbit Groups: Developer discussions +- Twitter/X: @JockNockISA +- Discord: Nockchain community + +### Contributing Guidelines +1. Read PHILOSOPHY.md and ROADMAP.md +2. Check existing issues/PRs +3. Small PRs preferred +4. Tests required for new features +5. Documentation required for new syntax + +### Code Review Standards +- Compiles without warnings +- Passes all tests +- Maintains type safety +- Follows naming conventions +- Includes documentation +- Performance considerations noted + +--- + +## Conclusion + +This spec provides a comprehensive roadmap for completing Jock. The type system overhaul is the critical path, followed by NockApp/Gall integration. With focused effort, Jock can become the practical, production-ready language for Nock development within 12-18 months. + +The cypherpunk vision: deterministic computation, formally verifiable code, sovereign infrastructure. Jock is a key enabler. + +Let's build something that survives contact with reality. + +--- + +**Document Status:** Living specification, last updated 2025-01-22 +**Next Review:** After Beta type system implementation +**Maintainer:** Senior engineering team, community input welcome diff --git a/docs/JOCK_IMPLEMENTATION_ROADMAP.md b/docs/JOCK_IMPLEMENTATION_ROADMAP.md new file mode 100644 index 0000000..7a825d6 --- /dev/null +++ b/docs/JOCK_IMPLEMENTATION_ROADMAP.md @@ -0,0 +1,763 @@ +# Jock Implementation Roadmap: Immediate Next Steps +## For Claude Code Execution + +**Repository:** github.com/zorp-corp/jock-lang (main) / github.com/sigilante/jock-lang (development fork) +**Current Branch:** `sigilante/jype-refactor` +**Target:** Production-ready type system + NockApp compatibility +**Last Updated:** 2026-02-03 + +--- + +## Sprint 1: Type System Foundation ✅ COMPLETE + +### Task 1.1: Struct Implementation ✅ +**Location:** `/common/hoon/lib/jock.hoon` + +**Completed:** +- [x] Parser recognizes `struct` keyword and named field definitions +- [x] AST node: `[%struct name=cord fields=(list [name=term type=jype])]` +- [x] Struct literal construction: `Point { x: 42, y: 7 }` +- [x] Field access via `.` operator compiles to axis lookup through `struct-to-jype` +- [x] Field update via `=` operator (uses Nock 10 edit) +- [x] Struct bunt (default values) via `type-to-default` +- [x] Struct as function parameter type (eager `%limb` resolution in lambda mint) +- [x] Struct as function return type (stripped return type name in `call-core`) +- [x] Nested structs — field types resolved eagerly at definition time +- [x] Multiple struct definitions coexist (Nock 8 push-onto-subject) + +**Nock Compilation (actual):** +- Struct definition: `compose struct Point { x: Real, y: Real };` → Nock 8 pushes bunt `[0 0]` onto subject +- Struct literal: `Point { x: 1, y: 2 }` → compiles field values in definition order +- Field access: `p.x` → `struct-to-jype` maps fields to axes, `axis-at-name` resolves + +**Tests:** +- `struct-basic.jock`: Define + reference struct type +- `struct-field-access.jock`: `p.x` → 42 +- `struct-func-param.jock`: `func getx(p: Point) -> Real { p.x }` → 42 +- `struct-func-simple.jock`: `func identity(p: Point) -> Point { p }` → [42 7] +- `struct-nested-basic.jock`: `r.origin.x` through Rect→Point → 1 +- `struct-nested-shallow.jock`: `r.origin` → [1 2] + +### Task 1.2: Newtype Wrappers +**Status:** Not started. Deferred — struct implementation covers the core use case. + +### Task 1.3: Type Aliases ✅ +**Completed:** +- [x] `alias` keyword parsed +- [x] Aliases resolve to target type at definition time +- [x] No runtime distinction — transparent substitution +- Generic aliases not yet supported (requires generics, Sprint 4) + +--- + +## Sprint 2: Impl Blocks & Traits ✅ COMPLETE + +### Design Direction + +Structs + impl blocks use the **class-with-struct-state** pattern. The underlying Hoon model is the **door** (a core with a sample): +- **Struct** = the sample type (data layout) +- **Class with impl** = the battery (methods operating on that data) + trait validation +- Together they form a door: `[battery sample]` + +### Task 2.1: Class with Struct State + Methods ✅ + +**Completed:** +- [x] `class Name(StructType) { ... }` parses and compiles +- [x] Methods stored as `(map term jock)` in AST +- [x] Methods compile to battery arms of a Nock core (door) +- [x] `self` parameter binds to the struct instance (door sample at axis +6) +- [x] Method calls resolve via subject walk + core invocation +- [x] `Self` type resolves to the implementing struct type in method signatures +- [x] Constructor syntax: `Point { x: 42, y: 7 }` creates struct instance + +**Actual Syntax:** +```jock +compose struct PointState { x: Real, y: Real }; +compose + class Point(PointState) { + add(self: Self, p: Self) -> Self { ( self.x + p.x self.y + p.y ) } + neg(self: Self) -> Real { self.y } + } +; +let p = Point { x: 101, y: 105 }; +let q = Point { x: 42, y: 7 }; +p.add(q) +``` + +**Tests:** +- `class-basic.jock`: Basic class with struct state and method call +- `class-define.jock`: Class definition and construction +- `class-3d.jock`: 3D point class with methods + +### Task 2.2: Trait Definition & Validation ✅ + +**Completed:** +- [x] `trait Name { method1; method2; }` parses +- [x] Trait signatures stored in compilation environment +- [x] `impl Trait` clause on class validates method presence against trait +- [x] Multiple traits: `class C(S) impl Trait1, Trait2 { ... }` +- [x] `Self` type parameter resolves to implementing struct type +- [x] Missing methods produce compile error + +**Actual Syntax:** +```jock +compose trait Arithmetic { add; neg; }; +compose trait Subtraction { sub; }; +compose + class Point(PointState) impl Arithmetic, Subtraction { + add(self: Self, p: Self) -> Self { ( self.x + p.x self.y + p.y ) } + neg(self: Self) -> Real { self.y } + sub(self: Self, p: Self) -> Self { ( self.x - p.x self.y - p.y ) } + } +; +``` + +**Tests:** +- `trait-basic.jock`: Trait definition + class impl validation +- `trait-self.jock`: `Self` type in method signatures +- `trait-multiple.jock`: Class implementing multiple traits + +### Task 2.3: Operator Overloading ✅ + +**Completed:** +- [x] Traits can bind to operators: `trait Add(+) { add; }` and `trait Neg(unary -) { neg; }` +- [x] Binary operator overloading: `p + q` dispatches to `add` method +- [x] Unary operator overloading: `-w` dispatches to `neg` method +- [x] Arbitrary Unicode operators: `trait Neg(unary ⊖) { neg; }` → `⊖w` +- [x] Operator whitelist system for custom operators + +**Tests:** +- `op-overload.jock`: Binary `+` and `-` overloads +- `unary-parens.jock`: Unary `-` with parenthesized syntax +- `unary-unicode.jock`: Unicode operator `⊖` +- `unary-tuple-2.jock`, `unary-tuple-3.jock`: Unary ops on tuples +- `unary-sint.jock`: Unary negation on signed integers + +### Task 2.4: Index Notation ✅ + +**Completed:** +- [x] `expr[idx]` syntax parsed into `%index` AST node +- [x] Tuple indexing: compile-time axis resolution via `tuple-axis` / `get-index-number` +- [x] List indexing: generates `hoon.snag` call nock directly (no `%call` re-entry) +- [x] Nested indexing: `b[1][0]` chains correctly +- [x] Path-basic test for path noun syntax + +**Tests:** +- `indexing-tuple.jock`: `t[0]`, `t[1]`, `t[2]` on tuple → `(100 200 300)` +- `indexing-list.jock`: `a[0]` on list → `100` +- `indexing-nested.jock`: `b[1][0]` on nested list → `30` +- `path-basic.jock`: Path noun syntax + +--- + +## Sprint 3: Unions & Pattern Matching (2 weeks) + +### Task 3.1: Union Definition +**Location:** Parser + type system + +**Requirements:** +- Head-tagged cells for variants +- Support multiple fields per variant +- Type-safe construction + +**Example:** +```jock +union Result { + case ok(value: Atom) + case err(code: Atom, msg: Chars) +} + +let success = Result::ok(42); +let failure = Result::err(404, "Not found"); +``` + +**Nock Representation:** +- `ok(42)` → `[%ok 42]` +- `err(404, "Not found")` → `[%err 404 "Not found"]` + +**Acceptance Criteria:** +- [ ] Union definitions parse +- [ ] Variant construction works +- [ ] Head tags generated correctly +- [ ] Type checker validates usage + +### Task 3.2: Pattern Matching +**Location:** Compiler control flow + +**Requirements:** +- `match` or `switch` keyword +- Exhaustiveness checking +- Binding variables from patterns + +**Example:** +```jock +match result { + ok(val) -> val * 2 + err(code, msg) -> { + print("Error " + code + ": " + msg); + 0 + } +} +``` + +**Implementation:** +- Compile to nested Nock 6 (if-then-else) +- Test head tag with Nock 5 (equality) +- Extract fields with Nock 0 (slot) + +**Acceptance Criteria:** +- [ ] Pattern matching syntax parses +- [ ] Exhaustiveness checker works +- [ ] Variable binding works +- [ ] Compiles to correct Nock +- [ ] Type checker validates patterns + +--- + +## Sprint 4: Generics & Monomorphization (2 weeks) + +### Task 4.1: Generic Function Syntax +**Location:** Parser + type system + +**Requirements:** +- Type parameters in angle brackets +- Type parameter binding at call site +- Explicit type annotations on parameters + +**Example:** +```jock +func first(xs: List) -> ?T { + match xs { + [] -> ~ + [head, ..tail] -> [~ head] + } +} + +let x = first([1, 2, 3]); // T = Atom inferred +``` + +**Acceptance Criteria:** +- [ ] Generic syntax parses +- [ ] Type parameters tracked in environment +- [ ] Call site type inference works +- [ ] Empty collection annotation required + +### Task 4.2: Monomorphization Pass +**Location:** Compiler backend + +**Requirements:** +- Generate separate Nock for each concrete type +- Maintain mapping: (function, type args) → compiled Nock +- No runtime polymorphism + +**Implementation Strategy:** +1. During compilation, track generic function calls +2. For each unique type instantiation, generate specialized Nock +3. Replace generic calls with specialized versions + +**Acceptance Criteria:** +- [ ] Monomorphization generates correct Nock +- [ ] Each type instantiation compiled separately +- [ ] Performance is good (no overhead) +- [ ] Test with multiple type instantiations + +--- + +## Sprint 5: NockApp Kernel Interface (1 week) + +### Task 5.1: Kernel Type Definitions +**Location:** `/common/hoon/jib/kernel.jock` (new file) + +**Create Standard Types:** +```jock +alias Tang = List +alias Term = Chars + +struct Goof { + mote: Term + tang: Tang +} + +alias Wire = Path + +struct Input { + eny: Uint + our: Hex + now: Date + cause: Noun +} + +struct Ovum { + wire: Wire + input: Input +} + +struct Crud { + goof: Goof + input: Input +} +``` + +**Acceptance Criteria:** +- [ ] Types defined in standard library +- [ ] Compile correctly to Nock +- [ ] Compatible with Hoon equivalents + +### Task 5.2: Kernel Class Template +**Location:** `/common/hoon/jib/kernel-template.jock` (new file) + +**Create:** +```jock +class Kernel(state: S) { + load(old: Noun) -> S { + // Override in subclass + old as! S + } + + wish(expr: Noun) -> Noun { + crash("wish not implemented") + } + + peek(path: Path) -> ?(?(Noun)) { + // Override in subclass + ~ + } + + poke(cause: Noun) -> (List, S) { + // Override in subclass + ([], state) + } +} +``` + +**Acceptance Criteria:** +- [ ] Template compiles +- [ ] Arms at correct axes (+4, +10, +22, +23) +- [ ] Can be extended by user code +- [ ] Test with simple kernel + +### Task 5.3: Integration Test +**Location:** `/common/hoon/try/simple-kernel.jock` (new file) + +**Write Simple Kernel:** +```jock +struct CounterState { + count: Atom +} + +class CounterKernel extends Kernel { + peek(path: Path) -> ?(?(Noun)) { + match path { + /count -> [~ ~ state.count] + _ -> [~ ~] + } + } + + poke(cause: Noun) -> (List, CounterState) { + match cause { + [%increment, n] -> { + let new_state = CounterState(state.count + n); + ([], new_state) + } + _ -> ([], state) + } + } +} +``` + +**Test Via:** +```bash +./jockc ./common/hoon/try/simple-kernel --import-dir ./common/hoon/jib +# Should build and run successfully +``` + +**Acceptance Criteria:** +- [ ] Kernel compiles to valid Nock +- [ ] Arms at correct axes +- [ ] Can be invoked via NockApp runtime +- [ ] State persists across pokes + +--- + +## Sprint 6: Path Syntax & Standard Library (1 week) + +### Task 6.1: Path Parser +**Location:** Parser in `/crates/jockc/hoon/lib/jock.hoon` + +**Requirements:** +- Recognize `/foo/bar/baz` syntax +- Support interpolation: `/(variable)` +- Compile to `List` + +**Example:** +```jock +let segment = "users"; +let user_id = "123"; +let path = /(segment)/(user_id)/profile; +// Compiles to: ["users" "123" "profile"] +``` + +**Acceptance Criteria:** +- [ ] Path syntax parses +- [ ] Interpolation works +- [ ] Compiles to correct Nock +- [ ] Type checking validates interpolated values + +### Task 6.2: Basic Standard Library +**Location:** `/common/hoon/jib/*.jock` (new files) + +**Create:** +- `list.jock`: length, first, last, append, concat, reverse +- `string.jock`: concat, split, trim, to_chars, from_chars +- `math.jock`: basic arithmetic, min, max, abs +- `option.jock`: map, flat_map, unwrap_or, is_some + +**Example (`list.jock`):** +```jock +func length(xs: List) -> Atom { + match xs { + [] -> 0 + [_, ..tail] -> 1 + length(tail) + } +} + +func first(xs: List) -> ?T { + match xs { + [] -> ~ + [head, ..] -> [~ head] + } +} +``` + +**Acceptance Criteria:** +- [ ] Standard library modules compile +- [ ] Can be imported in user code +- [ ] Functions work correctly +- [ ] Well-documented with examples + +--- + +## Sprint 7: Optimization & Polish (1 week) + +### Task 7.1: Basic Subject Knowledge Analysis +**Location:** Compiler optimizer + +**Requirements:** +- Track known subject structure during compilation +- Compute axes statically +- Fold constants where possible + +**Example Optimization:** +```jock +let x = 5; +let y = x + 3; +y * 2 +``` + +**Before:** +```nock +[8 [1 5] 8 [7 [0 2] 4 4 4 0 1] 7 [0 2] 4 4 4 4 0 1] 0 1] +``` + +**After:** +```nock +[1 16] // (5 + 3) * 2 = 16 +``` + +**Acceptance Criteria:** +- [ ] Constant folding works +- [ ] Static axis computation works +- [ ] Benchmark shows improvement +- [ ] No correctness regressions + +### Task 7.2: Error Messages +**Location:** All compiler phases + +**Requirements:** +- Clear, actionable error messages +- Show source location +- Suggest fixes where possible + +**Example:** +``` +Error: Type mismatch at line 10, column 5 + Expected: Atom + Found: List + + let x: Atom = [1, 2, 3]; + ^^^^^^^^^ + +Suggestion: Did you mean to use List as the type? +``` + +**Acceptance Criteria:** +- [ ] All compiler errors include source location +- [ ] Type errors show expected vs. actual +- [ ] Suggestions provided where applicable +- [ ] Format is consistent across errors + +### Task 7.3: Documentation +**Location:** `/docs/*.md` (new directory) + +**Create:** +- `LANGUAGE_REFERENCE.md`: Complete syntax guide +- `TYPE_SYSTEM.md`: Types, traits, generics +- `NOCKAPP_GUIDE.md`: Building kernels +- `STDLIB_API.md`: Standard library reference +- `EXAMPLES.md`: Practical examples + +**Acceptance Criteria:** +- [ ] Documentation is comprehensive +- [ ] Examples compile and run +- [ ] Clear explanations with rationale +- [ ] Searchable and well-organized + +--- + +## Testing Strategy + +### Unit Tests +**Location:** `/crates/jockc/hoon/lib/test-jock.hoon` + +**Add Tests For:** +- [ ] Struct creation and field access +- [ ] Newtype wrapping and unwrapping +- [ ] Type aliases +- [ ] Trait definitions +- [ ] Impl blocks and method calls +- [ ] Union construction and matching +- [ ] Generic functions +- [ ] Path syntax +- [ ] Standard library functions + +### Integration Tests +**Location:** `/common/hoon/try/*-test.jock` + +**Add Tests For:** +- [ ] Simple NockApp kernel +- [ ] Stateful kernel with multiple pokes +- [ ] Kernel with working peek +- [ ] Complex type composition +- [ ] Real-world-ish applications + +### Performance Benchmarks +**Location:** `/benchmarks/*.jock` + +**Benchmark:** +- [ ] Fibonacci (recursive) +- [ ] List operations (map, filter, fold) +- [ ] Struct field access +- [ ] Method dispatch overhead +- [ ] Pattern matching cost + +--- + +## Continuous Integration + +### Build Checks +- [ ] All code compiles without warnings +- [ ] All tests pass +- [ ] No regressions in existing functionality +- [ ] Documentation builds + +### Code Quality +- [ ] Consistent naming conventions +- [ ] Comments explain non-obvious code +- [ ] No dead code +- [ ] Hoon code follows style guide + +--- + +## Definition of Done + +### Feature Complete When: +1. Implementation matches specification +2. Unit tests pass (100% coverage for new code) +3. Integration tests pass +4. Documentation written +5. Examples work +6. Code reviewed +7. Performance acceptable (no worse than 2x naive) +8. No known bugs + +### Beta Release When: +- [ ] All Sprint 1-6 tasks complete +- [ ] 100+ tests passing +- [ ] Documentation 80% complete +- [ ] At least 3 example applications work +- [ ] Type system validates all examples +- [ ] NockApp kernel interface tested + +--- + +## Tools & Environment + +### Required Tools +- Rust toolchain (1.70+) +- Hoon compiler (from nockchain) +- NockVM (from nockchain) +- Git +- Make + +### Build Commands +```bash +# Build jockc compiler +make jockc + +# Build jockt test runner +make jockt + +# Run specific test +./jockt exec --import-dir ./common/hoon/jib + +# Run all tests +./jockt test-all --import-dir ./common/hoon/jib + +# Run example +./jockc ./common/hoon/try/.jock --import-dir ./common/hoon/jib +``` + +### Development Workflow +1. Edit Hoon code in `/crates/jockc/hoon/lib/jock.hoon` +2. Edit Rust wrapper in `/crates/jockc/main.rs` (if needed) +3. Run `make jockc` to rebuild +4. Test with `./jockt` or `./jockc` +5. Commit with clear message + +--- + +## Immediate Next Actions (This Week) + +### Priority 1: Sprint 3 — Unions & Pattern Matching +1. Design union/sum type AST representation +2. Implement `union` keyword parser +3. Implement variant construction with head tags +4. Implement `match` with exhaustiveness checking +5. Build Result/Option types as union examples + +### Priority 2: Stabilize Indexing +1. Verify list indexing end-to-end (blocked on cold Hoon compile time after cache clear) +2. Verify nested list indexing +3. Add error messages for out-of-bounds or wrong-type index targets + +### Priority 3: Improve Error Messages +1. Add source locations to type errors +2. Improve trait validation error messages (which method is missing) +3. Add suggestions for common mistakes + +--- + +## Questions to Answer During Implementation + +### Type System +- [ ] How do we handle recursive types? +- [ ] What's the scoping rule for type parameters? +- [ ] How do we handle trait coherence? +- [ ] What's the story for type inference limits? + +### Compilation +- [ ] What's the exact Nock pattern for method dispatch? +- [ ] How do we ensure jet matching works? +- [ ] What's the memory layout for complex nested types? +- [ ] How do we handle stack overflow in recursion? + +### Interop +- [ ] How do we call Jock from Hoon? +- [ ] How do we handle Hoon irregular syntax in FFI? +- [ ] What's the ABI for Jock/Hoon function boundaries? +- [ ] How do we share types between Jock and Hoon? + +--- + +## Success Metrics + +### Week 1-2 (Sprint 1) ✅ +- Structs parse and compile +- Can create struct, access fields, update fields +- Type aliases work +- Nested structs work +- 10+ struct/alias tests passing + +### Week 3-4 (Sprint 2) ✅ +- Traits defined, stored, and validated +- Classes with struct state compile to doors +- Method calls work with `Self` type +- Operator overloading (binary + unary, including Unicode) +- Index notation for tuples (compile-time) and lists (runtime via snag) +- 25+ tests passing (traits, classes, operators, indexing) + +### Week 5-6 (Sprint 3) +- Unions work with pattern matching +- Exhaustiveness checking +- Can build simple Result/Option types +- 40+ tests passing + +### Week 7-8 (Sprint 4) +- Generics compile with monomorphization +- Type inference works +- Standard generic functions (first, map, etc.) +- 60+ tests passing + +### Week 9 (Sprint 5) +- NockApp kernel template works +- Simple counter kernel compiles and runs +- Arms at correct axes +- 70+ tests passing + +### Week 10 (Sprint 6) +- Path syntax works +- Basic standard library available +- Can build small applications +- 85+ tests passing + +### Week 11 (Sprint 7) +- Optimizations showing improvement +- Error messages are clear +- Documentation complete +- 100+ tests passing + +--- + +## Communication Plan + +### Daily Standup (Async) +- What did I complete yesterday? +- What am I working on today? +- Any blockers? + +### Weekly Review +- Progress against sprint goals +- Demos of working features +- Adjust priorities if needed + +### Monthly Retrospective +- What went well? +- What could improve? +- Update roadmap based on learning + +--- + +## Getting Help + +### When Stuck +1. Read existing code for patterns +2. Consult Nock documentation +3. Check Hoon implementation +4. Ask in Urbit developer groups +5. Create GitHub issue with minimal reproduction + +### Resources +- Jock docs: https://docs.jock.org +- Nock spec: https://docs.urbit.org/language/nock +- Hoon docs: https://docs.urbit.org/language/hoon +- NockApp: https://github.com/zorp-corp/nockchain + +--- + +This roadmap is aggressive but achievable with focused effort. Each sprint builds on the previous, with clear acceptance criteria and tests. The result will be a production-ready type system and NockApp compatibility, enabling real applications in Jock. + +Let's make Nock programming accessible without compromising on rigor or performance. The future is deterministic computation, and Jock is the practical path to get there. + +**Status:** Sprints 1-2 complete, Sprint 3 next +**Last Updated:** 2026-02-03 +**Owner:** Claude Code + Senior Engineering Team diff --git a/docs/JOCK_NOCK_QUICK_REFERENCE.md b/docs/JOCK_NOCK_QUICK_REFERENCE.md new file mode 100644 index 0000000..4958608 --- /dev/null +++ b/docs/JOCK_NOCK_QUICK_REFERENCE.md @@ -0,0 +1,635 @@ +# Jock-to-Nock Compilation Quick Reference +## Patterns, Idioms, and Translation Strategies + +--- + +## Fundamental Nock Opcodes + +| Op | Name | Form | Meaning | +|----|------|------|---------| +| 0 | Slot | `[0 b]` | Tree address `b` of subject | +| 1 | Constant | `[1 b]` | Literal value `b` | +| 2 | Eval | `[2 b c]` | `*[*[a b] *[a c]]` | +| 3 | Cell? | `[3 b]` | 0 if `*[a b]` is cell, else 1 | +| 4 | Increment | `[4 b]` | `+(*[a b])` | +| 5 | Equal | `[5 b c]` | 0 if `*[a b]` = `*[a c]`, else 1 | +| 6 | If | `[6 b c d]` | `*[a c]` if `*[a b]` is 0, else `*[a d]` | +| 7 | Compose | `[7 b c]` | `*[*[a b] c]` | +| 8 | Push | `[8 b c]` | `*[[*[a b] a] c]` | +| 9 | Call | `[9 b c]` | `*[*[a c] [2 [0 1] [0 b]]]` | +| 10 | Edit | `[10 [b c] d]` | Replace axis `b` with `*[a c]` in `*[a d]` | +| 11 | Hint | `[11 b c]` | Jet hint, compute `*[a c]` | +| 12 | Scry | `[12 b c]` | Mock/scry (not used in JockApps) | + +--- + +## Subject Structure & Axes + +``` +Tree: [a b] +Subject: [battery payload] + +Axes: + 1 = entire subject + 2 = head (battery) + 3 = tail (payload) + + 4 = head of head + 5 = tail of head + 6 = head of tail + 7 = tail of tail + + 2^n = nth left (head) + 2^n + 1 = nth right (tail) +``` + +**Computing Axes:** +- Left: `2 * axis` +- Right: `2 * axis + 1` +- Parent: `axis / 2` (integer division) + +**Example Subject:** +``` +[battery [arg1 [arg2 [arg3 prior-subject]]]] + ++1: entire subject ++2: battery ++3: payload = [arg1 [arg2 [arg3 prior-subject]]] ++6: arg1 ++7: [arg2 [arg3 prior-subject]] ++14: arg2 ++15: [arg3 prior-subject]] ++30: arg3 ++31: prior-subject +``` + +--- + +## Variable Binding (Nock 8) + +### Simple Let +```jock +let x = 42; +x +``` + +Compiles to: +```nock +[8 [1 42] [0 2] 0 1] +// [8 b c] = *[[*[a b] a] c] +// b = [1 42] = constant 42 +// c = [0 2] = slot 2 (head of extended subject) +// Subject becomes: [42 original-subject] +// +2 = x, +3 = original +``` + +### Multiple Let Bindings +```jock +let x = 5; +let y = 10; +x + y +``` + +Compiles to: +```nock +[8 [1 5] + [8 [1 10] + [4 4 [0 4] [0 2]] // add(+4, +2) = add(x, y) + 0 1] +0 1] +// Subject: [10 [5 original]] +// +2 = y, +4 = x +``` + +--- + +## Function Definitions (Gates) + +### Basic Function +```jock +func add(x: Atom, y: Atom) -> Atom { + x + y +} +``` + +Compiles to gate (door with one arm): +```nock +[8 + [1 0] // Default sample [0 0] + [1 + [6 // Battery: [add-formula context] + [5 [0 30] 0 31] // if sample == [0 0] crash + [0 0] // then crash + [4 4 [0 6] [0 7]] // else add(+6, +7) = add(x, y) + ] + 0 + ] + 0 1 +] + +// Gate structure: [battery sample] +// +2 = battery +// +3 = sample = [x y] +// +6 = x +// +7 = y +``` + +### Function Call (Slam) +```jock +add(3, 5) +``` + +Compiles to: +```nock +[9 2 // Call arm at axis +2 (first arm) + [0 1] // of subject (the gate) + [7 [0 3] [1 3 5]] // with sample replaced by [3 5] +] + +// Full expansion: +[9 2 + 10 [6 [1 3 5] 0 1] // Edit axis +6 (sample) to [3 5] + 0 1 // In subject (the gate) +] +``` + +--- + +## Recursion ($ buc) + +### Recursive Function +```jock +func factorial(n: Atom) -> Atom { + if n == 0 { + 1 + } else { + n * $(n - 1) + } +} +``` + +Compiles to: +```nock +[8 [1 0] // Default sample + [1 + [6 // if-then-else + [5 [0 6] [1 0]] // n == 0 + [1 1] // then 1 + [4 4 // else n * + [0 6] // n + [9 2 // recurse: call self + 10 [6 // with sample replaced + [4 0 6] // n - 1 + 0 1 + ] + 0 1 + ] + ] + ] + 0 + ] + 0 1 +] + +// $ = "call myself at axis +2" +// Replace sample with new args +// Subject unchanged (gate structure maintained) +``` + +--- + +## Control Flow + +### If-Then-Else +```jock +if condition { + then_branch +} else { + else_branch +} +``` + +Compiles to: +```nock +[6 + [/* condition */] // Test + [/* then_branch */] // True path + [/* else_branch */] // False path +] +``` + +### Loop +```jock +let i = 0; +loop; +if i == 10 { + i +} else { + i = i + 1; + recur +} +``` + +Compiles to: +```nock +[8 [1 0] // i = 0 + [8 [1 0] // Loop marker (trap) + [6 // if-then-else + [5 [0 6] [1 10]] // i == 10 + [0 6] // then i + [7 // else + [10 [6 [4 0 6] 0 1] 0 1] // i = i + 1 + [9 2 0 1] // recur (call trap at +2) + ] + ] + 0 1 + ] + 0 1 +] +``` + +--- + +## Data Structures + +### Lists +```jock +[1, 2, 3] +``` + +Compiles to right-nested cells with `~` (null) terminator: +```nock +[1 [2 [3 0]]] // [1 [2 [3 ~]]] +// 0 represents ~ (null) +``` + +### List Operations +```jock +// Length +func length(xs: List) -> Atom { + match xs { + [] -> 0 + [_, ..tail] -> 1 + length(tail) + } +} +``` + +Compiles to: +```nock +[8 [1 0] // Default sample + [1 + [6 // Pattern match = if-cell + [3 [0 6]] // is cell? + [1 0] // empty -> 0 + [4 // else 1 + + [9 2 // recurse + 10 [6 [0 7] 0 1] // with tail + 0 1 + ] + ] + ] + 0 + ] + 0 1 +] +``` + +### Tuples/Cells +```jock +(1, 2, 3) +``` + +Compiles to left-nested cells: +```nock +[[1 2] 3] // or [1 [2 3]], depends on association +``` + +### Structs +```jock +struct Point { x: Atom, y: Atom } +Point(3, 5) +``` + +Compiles to door instance: +```nock +[battery [3 5]] +// battery = [constructor field-getters ...] +// sample = [x y] = [3 5] +``` + +--- + +## Type System Compilation + +### Newtype Wrapper +```jock +struct UserId(Atom) +let id = UserId(42); +``` + +Compiles to: +```nock +// Same as: [constructor-battery 42] +// Type distinction maintained at compile-time only +// Runtime: just the value in a door +``` + +### Trait Implementation +```jock +trait Show { + show(self) -> Chars +} + +impl Show for Point { + show(self) -> Chars { + "(" + self.x + ", " + self.y + ")" + } +} +``` + +Compiles to: +```nock +// Add show arm to Point battery +// Subject structure: +[battery sample] + battery = [[show-formula] [other-methods]] + sample = [x y] + +// Method call: p.show() +[9 axis-of-show // Call show arm + [0 axis-of-p] // On p instance +] +``` + +--- + +## Pattern Matching (Unions) + +### Union Definition +```jock +union Option { + case none + case some(value: T) +} +``` + +Compiles to tagged cells: +```nock +// none: [%none ~] = [0x656e6f6e 0] +// some(x): [%some x] = [0x656d6f73 x] +``` + +### Pattern Match +```jock +match opt { + none -> 0 + some(x) -> x +} +``` + +Compiles to: +```nock +[6 // if-then-else + [5 // equality test + [0 12] // head of opt (tag) + [1 %none] // %none tag + ] + [1 0] // then 0 + [0 13] // else tail of opt (value) +] +``` + +--- + +## Standard Library Patterns + +### Option Chaining +```jock +e?.field +``` + +Compiles to: +```nock +[6 // if-then-else + [3 [0 /* e-axis */]] // is e a cell? (not ~) + [0 /* field-axis */] // then access field + [1 ~] // else ~ +] +``` + +### Default Value +```jock +e ?? default +``` + +Compiles to: +```nock +[6 // if-then-else + [3 [0 /* e-axis */]] // is e a cell? + [0 /* e-axis */] // then e + [0 /* default-axis */] // else default +] +``` + +--- + +## Optimization Patterns + +### Constant Folding +```jock +5 + 3 +``` + +**Naive:** +```nock +[4 4 4 4 4 [1 5] [1 3]] // Multiple increments +``` + +**Optimized:** +```nock +[1 8] // Compile-time evaluation +``` + +### Subject Knowledge Analysis (sKa) +Track known subject structure to compute axes statically: + +```jock +let x = 42; +let y = x; +y +``` + +**Naive:** +```nock +[8 [1 42] + [8 [0 2] // y = x (dynamic lookup) + [0 2] // return y + 0 1] +0 1] +``` + +**Optimized (with sKa):** +```nock +[1 42] // Fold to constant, eliminate bindings +``` + +### Jet Hints (Nock 11) +```jock +x + y // Should use addition jet +``` + +Compiles to: +```nock +[11 // Hint + [1 %add] // Jet hint: use add jet + [4 4 [0 6] [0 7]] // Fallback: increment-based add +] +``` + +--- + +## NockApp Kernel Patterns + +### Kernel Structure +```jock +class Kernel(state: State) { + load(old: Noun) -> State { /* ... */ } // +4 + wish(expr: Noun) -> Noun { /* ... */ } // +10 + peek(path: Path) -> ?(?(Noun)) { /* ... */ } // +22 + poke(cause: Noun) -> (List, State) { /* ... */ } // +23 +} +``` + +Compiles to door with arms at specific axes: +```nock +[battery sample] + battery: + +2: all arms nested + +4: load + +10: wish + +22: peek + +23: poke + sample: state +``` + +### Peek Implementation +```jock +peek(path: Path) -> ?(?(Noun)) { + match path { + /version -> [~ ~ version] + /count -> [~ ~ state.count] + _ -> [~ ~] // not found + } +} +``` + +Returns: +- `~` = block (not ready) +- `[~ ~]` = permanently not available +- `[~ ~ value]` = success + +--- + +## Common Pitfalls & Solutions + +### Pitfall: Incorrect Axis Calculation +**Problem:** Off-by-one in axis arithmetic +**Solution:** Draw subject tree, compute manually, verify + +### Pitfall: Subject Loss After Push +**Problem:** After Nock 8, original subject at +3, not +1 +**Solution:** Track subject changes carefully + +### Pitfall: Recursion Without Sample Update +**Problem:** Infinite loop, same args passed +**Solution:** Use Nock 10 to replace sample before Nock 9 + +### Pitfall: Missing Crash on Invalid Input +**Problem:** Function continues with bad data +**Solution:** Add `[6 [5 sample default] [0 0] formula]` pattern + +### Pitfall: Name Shadowing Confusion +**Problem:** Variable name reused, wrong axis accessed +**Solution:** Use unique names or track scopes explicitly + +--- + +## Debugging Strategies + +### 1. Inspect Compiled Nock +Print intermediate Nock before optimization: +```bash +./jockc --debug file.jock +``` + +### 2. Trace Execution +Use NockVM trace mode: +```bash +NOCK_TRACE=1 ./jockc file.jock +``` + +### 3. Verify Subject Structure +Add debug print statements that output subject: +```jock +print(this); // Print entire subject +``` + +### 4. Test Small Pieces +Compile and test functions in isolation: +```jock +// test-function.jock +func add(x: Atom, y: Atom) -> Atom { + x + y +} +add(3, 5) +``` + +### 5. Compare with Hoon +Compile equivalent Hoon, compare Nock: +```hoon +|= [x=@ y=@] +(add x y) +``` + +--- + +## Reference Resources + +### Nock Specification +- Official: https://docs.urbit.org/language/nock/reference/definition +- Tutorial: https://blog.timlucmiptev.space/part1.html + +### Hoon Reference +- Docs: https://docs.urbit.org/language/hoon +- Guide: https://docs.urbit.org/courses/hoon-school + +### Jock Specifics +- Docs: https://docs.jock.org +- Repo: https://github.com/zorp-corp/jock-lang +- Beta spec: See uploaded jock-beta.md + +### Tools +- NockVM: https://github.com/zorp-corp/nockchain +- jockc: Jock compiler (build from repo) +- jockt: Test framework (build from repo) + +--- + +## Quick Tips + +1. **Always draw the subject tree** before computing axes +2. **Use Nock 8 sparingly** - each push adds complexity +3. **Fold constants aggressively** - don't emit `[1 x]` then `[4 [0 2]]` +4. **Match Hoon patterns** for jet compatibility +5. **Test edge cases**: 0, ~, single-element lists +6. **Read compiled Nock** - it teaches correct patterns +7. **Start simple** - get basic case working, then optimize +8. **Use type checker** - catch errors at compile time +9. **Profile before optimizing** - measure, don't guess +10. **When stuck, consult Hoon** - it's the reference implementation + +--- + +**This is a living document. Update as patterns emerge.** + +Last updated: 2025-01-22 diff --git a/docs/JOCK_STATE_ASSESSMENT.md b/docs/JOCK_STATE_ASSESSMENT.md new file mode 100644 index 0000000..fa3f219 --- /dev/null +++ b/docs/JOCK_STATE_ASSESSMENT.md @@ -0,0 +1,276 @@ +# Jock Language State Assessment + +**Date:** 2026-02-03 +**Branch Reviewed:** `sigilante/jype-refactor` +**Status:** Alpha (Developer Preview → 0.1.0-alpha) + +--- + +## Executive Summary + +Jock is a **functional alpha-stage language** targeting the Nock instruction set architecture. It has a working compiler pipeline, a test framework, and basic language features. The codebase is well-organized with clear documentation outlining an ambitious roadmap toward production readiness. + +**Current Capability:** Can compile and run programs with functions, classes, structs, traits, operator overloading, control flow, lists, index notation, and Hoon FFI. + +**Gap to Production:** Missing unions/sum types, generics, NockApp kernel interface, Gall agent support, optimization passes, and developer tooling. + +--- + +## 1. What Works (Implemented) + +### Core Compiler Pipeline +- **Tokenizer:** Text → tokens (complete) +- **Parser (jeam):** Tokens → AST (complete) +- **Type Inference (jype):** Basic type tracking (partial) +- **Code Generation (mint):** AST → Nock (complete for basic features) + +### Language Features +| Feature | Status | Notes | +|---------|--------|-------| +| Variables (`let`) | Working | `let x = 42;` | +| Functions (`func`) | Working | `func add(a:@ b:@) -> @ { a + b }` | +| Structs | Working | `struct Point { x: Real, y: Real }` with field access, update, nesting | +| Type Aliases | Working | `alias Name = Type;` with chaining | +| Classes | Working | `class Point(PointState) { ... }` with struct state | +| Traits | Working | `trait Arithmetic { add; neg; }` with `impl` validation | +| Operator Overloading | Working | `trait Add(+) { add; }` — binary, unary, Unicode operators | +| Self Type | Working | `Self` resolves to implementing struct in methods | +| Index Notation | Working | Tuple: compile-time axis; List: runtime snag | +| Lambdas | Working | Inline anonymous functions | +| Control Flow | Working | `if/else`, `if/else if/else` | +| Recursion | Working | `$` for self-reference | +| Loops | Working | `loop/recur` pattern | +| Pattern Matching | Partial | `match` with type/case matching | +| Lists | Working | `[1 2 3]`, basic operations, indexing | +| Sets | Working | Via Hoon FFI | +| Arithmetic | Working | `+`, `-`, `*`, `/`, `%`, `**` | +| Comparison | Working | `==`, `!=`, `<`, `>`, `<=`, `>=` | +| Logical Operators | Working | `&&`, `\|\|`, `!` | +| Hoon FFI | Working | `hoon.add`, `hoon.mul`, etc. | +| Comments | Working | `//` line, `/* */` block | +| Print | Partial | Works for literals, variables incomplete | + +### Infrastructure +- **`jockc`:** Compiler CLI (180 lines Rust + Hoon wrappers) +- **`jockt`:** Test framework CLI (181 lines Rust + test definitions) +- **45+ test files:** Covering core language features +- **Build system:** Makefile with `build`, `test`, `exec` targets +- **Documentation:** README, PHILOSOPHY, ROADMAP, detailed specs in `/docs` + +### Example Programs +The `/common/hoon/try/` directory contains working examples: +- `hello-world.jock` - Basic output +- `fib.jock` - Recursive Fibonacci +- `calculator.jock` - Arithmetic expressions +- `point.jock` - Class with methods + +--- + +## 2. What's Missing or Broken + +### Type System (Critical Path) +| Feature | Status | Priority | +|---------|--------|----------| +| Structs (named fields) | ✅ Implemented | Done | +| Newtypes (`struct UserId(Atom)`) | Not implemented | P1 | +| Type aliases (`alias`) | ✅ Implemented | Done | +| Traits | ✅ Implemented | Done | +| Impl blocks (via class) | ✅ Implemented | Done | +| Operator overloading | ✅ Implemented | Done | +| Index notation | ✅ Implemented | Done | +| Unions (sum types) | Not implemented | P0 | +| Generics | Not implemented | P0 | +| Exhaustive pattern matching | Not implemented | P0 | +| Option type (`?T`) | Not native | P1 | +| Option chaining (`?.`, `??`, `!`) | Not implemented | P1 | +| Cast operators (`as`, `as?`, `as!`) | Not implemented | P1 | + +### NockApp/Gall Integration +| Feature | Status | Priority | +|---------|--------|----------| +| Kernel interface (`+load`, `+peek`, `+poke`) | Not implemented | P0 | +| Path syntax (`/foo/bar`) | Not implemented | P0 | +| Wire type | Not implemented | P1 | +| Gall agent primitives | Not implemented | P1 | +| Effect/Card system | Not implemented | P1 | + +### Standard Library +| Module | Status | Priority | +|--------|--------|----------| +| List operations (native) | Via FFI only | P1 | +| String operations (native) | Via FFI only | P1 | +| Math functions | Via FFI only | P2 | +| Option/Result utilities | Not implemented | P1 | +| Collection types (Dict, Vector) | Not implemented | P2 | + +### Compiler Quality +| Feature | Status | Priority | +|---------|--------|----------| +| Subject Knowledge Analysis (sKa) | Not implemented | P1 | +| Constant folding | Not implemented | P1 | +| Jet matching/hints | Not implemented | P2 | +| Clear error messages | Partial | P1 | +| Source location tracking | Partial | P1 | + +### Tooling +| Tool | Status | Priority | +|------|--------|----------| +| LSP server | Not implemented | P2 | +| Debugger | Not implemented | P2 | +| Package manager | Not implemented | P3 | +| REPL | Proof-of-concept only (jojo) | P2 | + +--- + +## 3. Code Architecture + +### Repository Structure +``` +jock-lang/ +├── crates/ +│ ├── jockc/ # Compiler binary +│ │ ├── main.rs # CLI driver (180 lines) +│ │ └── hoon/ # Hoon compiler code +│ └── jockt/ # Test framework binary +│ ├── main.rs # CLI driver (181 lines) +│ └── hoon/ # Test framework code +├── common/ +│ └── hoon/ +│ ├── lib/ +│ │ ├── jock.hoon # MAIN COMPILER (2,913 lines) +│ │ └── hoon.hoon # Hoon FFI bindings +│ ├── try/ # Example programs +│ └── jib/ # Import directory +├── docs/ # Specifications +└── assets/ # Compiled JAM files +``` + +### Compiler Core (`jock.hoon`) +The main compiler is a single 2,913-line Hoon file implementing: +- **Tokenizer:** Character-level lexing +- **Parser:** Recursive descent → AST +- **Type checker:** Basic inference +- **Code generator:** AST → Nock formulas +- **FFI bridge:** Hoon builtin integration + +### Test Framework (`jockt`) +- 45+ test files covering language features +- `sequent.hoon` (1,918 lines) - Logic-based testing library +- `test-jock.hoon` (443 lines) - Test definitions + +--- + +## 4. Technical Assessment + +### Strengths +1. **Clean design:** Clear separation between tokenizer, parser, type checker, and code generator +2. **Hoon integration:** Good FFI allows leveraging existing Hoon standard library +3. **Test coverage:** Comprehensive tests for implemented features +4. **Documentation:** Detailed specs provide clear direction +5. **Philosophy:** "Legibility above all" leads to readable code +6. **Build system:** Works, easy to use + +### Weaknesses +1. **Single-file compiler:** 2,913 lines in one file is hard to maintain +2. **Ad hoc type system:** No formal foundation, will be hard to extend +3. **No source maps:** Error messages lack precise locations +4. **Naive compilation:** No optimizations, verbose Nock output +5. **FFI dependency:** Many features require Hoon FFI rather than native implementations + +### Technical Debt +1. Library map uses `term` keys (should be `path` for versioning) +2. Variable printing incomplete (PR #53 in progress) +3. String operations require FFI (PR #59 in progress) +4. No caching of noun builds (expensive rebuilds) +5. Left-to-right associativity not yet implemented + +--- + +## 5. Roadmap Assessment + +The `/docs/JOCK_IMPLEMENTATION_ROADMAP.md` defines 7 sprints: + +| Sprint | Focus | Status | +|--------|-------|--------| +| 1 | Structs, newtypes, aliases | ✅ Complete | +| 2 | Traits, impl blocks, operators, indexing | ✅ Complete | +| 3 | Unions, pattern matching | Next | +| 4 | Generics, monomorphization | Upcoming | +| 5 | NockApp kernel interface | Upcoming | +| 6 | Path syntax, stdlib | Upcoming | +| 7 | Optimization, polish | Ongoing | + +**Critical Path:** Unions + generics (Sprints 3-4) are the remaining type system gating factors. + +**Risk Assessment:** +- Type system complexity may require iteration +- Compiler architecture may need refactoring to support advanced features +- Jet matching requires deep Nock/Hoon knowledge + +--- + +## 6. Recommendations + +### Immediate Priorities +1. **Refactor compiler into modules** - Split `jock.hoon` into separate files for tokenizer, parser, type checker, code generator +2. **Implement structs** - Foundation for all other type features +3. **Add source location tracking** - Critical for debugging +4. **Implement path syntax** - Required for NockApp integration + +### Medium-term +1. **Build trait system incrementally** - Start with simple traits, add complexity gradually +2. **Create standard library in Jock** - Reduce FFI dependency +3. **Add constant folding** - Low-hanging optimization fruit +4. **Improve error messages** - Developer experience critical for adoption + +### Long-term +1. **LSP server** - Essential for IDE support +2. **Package manager** - Required for ecosystem growth +3. **Formal type system spec** - Prevent ad hoc decisions + +--- + +## 7. Comparison: Spec vs. Reality + +| Spec Feature | Implemented? | Gap | +|--------------|--------------|-----| +| Basic types (atoms, cells, lists) | Yes | - | +| Functions with explicit types | Yes | - | +| Classes with methods | Yes | - | +| Control flow | Yes | - | +| Recursion | Yes | - | +| Structs with named fields | Yes | - | +| Type aliases | Yes | - | +| Traits and impls | Yes | - | +| Operator overloading | Yes | - | +| Index notation (tuple + list) | Yes | - | +| Self type in methods | Yes | - | +| Unions (sum types) | No | Major | +| Generics | No | Major | +| NockApp kernel | No | Major | +| Path syntax | No | Major | +| Option type native | No | Moderate | +| Compiler optimizations | No | Moderate | +| LSP/tooling | No | Expected | + +--- + +## 8. Conclusion + +Jock is a **promising alpha-stage language** with a working compiler, good test coverage, and clear vision. The type system foundation (structs, traits, operator overloading, indexing) is now in place. The remaining gap to production is unions/generics, NockApp integration, and tooling. + +**What's Needed:** +1. Unions, pattern matching, and generics (remaining type system work) +2. NockApp integration (kernel interface, path syntax) +3. Standard library expansion (ongoing) +4. Developer tooling (LSP, debugger) + +**Realistic Timeline to Beta:** 6-9 months with dedicated effort +**Realistic Timeline to 1.0:** 12-18 months + +The foundation is solid. The specifications are thorough. Success depends on sustained execution of the roadmap, particularly the type system work which gates everything else. + +--- + +**Assessment Author:** Claude (automated analysis) +**Review Status:** Initial assessment, pending team review