diff --git a/.github/workflows/norm-reference.yml b/.github/workflows/norm-reference.yml new file mode 100644 index 0000000..00f42a8 --- /dev/null +++ b/.github/workflows/norm-reference.yml @@ -0,0 +1,31 @@ +name: Regenerate Nock reference table + +on: + push: + paths: + - 'norm/tests.json' + - 'norm/generate.py' + +permissions: + contents: write + +jobs: + regenerate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Regenerate REFERENCE.md + run: python3 norm/generate.py + + - name: Commit if changed + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add norm/REFERENCE.md + git diff --cached --quiet || git commit -m "norm: regenerate REFERENCE.md" + git push diff --git a/README.md b/README.md index 9003669..e3c41e6 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,12 @@ Benchmark code evaluations for comparing Nock evaluation performance. Benchmarks include: -- `.nock` files containing cells of `[subject formula]` +- `.hoon` source files for the Nock code. +- `.nock` files containing cells of `[subject formula]`. - `.noun` jamfiles of the Nock code. -- `.hoon` source files for the Nock code (optional). +- `tests.json` with expected results for verification. -Generally speaking, benchmarks should be self-contained; they should not call out to additional libraries or include dependencies on even `/sys/hoon`. However, we do supply `tiny.nock` as a compiled version of `/lib/tiny` from Hoon 139K. This may be preferred for cases (like `ackermann`) which would otherwise require included more than six arms. +All benchmarks are self-contained; they do not call out to additional libraries or include dependencies on `/sys/hoon`. Each `.hoon` file inlines all required arms using the `|^` core pattern (see `ackermann.hoon` as the gold standard). ## Benchmarks @@ -25,15 +26,20 @@ Generally speaking, benchmarks should be self-contained; they should not call ou - [Fibonacci sequence (recursive generating function)](https://en.wikipedia.org/wiki/Fibonacci_sequence#Generating_function), `fibonacci` - Factorial (tail-recursive), `factorial` +- [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication), `mmul` +- [SHA-512 hash](https://en.wikipedia.org/wiki/SHA-2), `sha512` + ### Desired - [Fibonacci sequence (Binet's formula)](https://en.wikipedia.org/wiki/Fibonacci_sequence#Relation_to_the_golden_ratio), `fibformula` (requires FP core) - [Mandelbrot set](https://en.wikipedia.org/wiki/Mandelbrot_set), `mandelbrot` (easier with FP core) -- [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication), `mmul` - [MD5 hash](https://en.wikipedia.org/wiki/MD5), `md5` -- [SHA-512 hash](https://en.wikipedia.org/wiki/SHA-2), `sha512` -## Reporting +## Nock Reference Tests + +The `norm/` directory contains a comprehensive test suite of Nock 4K opcodes (0–11 plus autocons). See [`norm/README.md`](norm/README.md) and [`norm/REFERENCE.md`](norm/REFERENCE.md) for details. + +## Running Nock benchmarks supply the subject and the formula as a cell; no arguments are externally specified. In the Urbit Dojo, a benchmark may be run directly as: @@ -44,6 +50,8 @@ Nock benchmarks supply the subject and the formula as a cell; no arguments are e For cases for which a computation may run unreasonably long, the `%jinx` hint may be used to time-limit the computation: `~> %jinx.[~s100]`. +## Reporting + A benchmark report should include the following data: 1. Hardware (CPU chipset): `cat /proc/cpuinfo`, then report `model name` and number of cores (`siblings`) diff --git a/desk/bar/ackermann.nock b/desk/bar/ackermann.nock index fe46ac0..4dbd3a6 100644 --- a/desk/bar/ackermann.nock +++ b/desk/bar/ackermann.nock @@ -1 +1 @@ -[[3 6] 8 [1 [6 [5 [1 0] 0 6] [4 0 7] 6 [5 [1 0] 0 7] [9 4 10 [3 [8 [9 5 0 1] 9 2 10 [6 0 14] 0 2] 1 1] 0 1] 9 4 10 [3 [8 [9 5 0 1] 9 2 10 [6 0 14] 0 2] 9 4 10 [7 8 [9 5 0 1] 9 2 10 [6 0 15] 0 2] 0 1] 0 1] 8 [1 0] [1 6 [5 [0 6] 1 0] [0 0] 8 [1 0] 8 [1 6 [5 [4 0 6] 0 30] [0 6] 9 2 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] 9 4 0 1] \ No newline at end of file +[[3 6] 8 [1 [6 [5 [1 0] 0 6] [4 0 7] 6 [5 [1 0] 0 7] [9 4 10 [3 [8 [9 5 0 1] 9 2 10 [6 0 14] 0 2] 1 1] 0 1] 9 4 10 [3 [8 [9 5 0 1] 9 2 10 [6 0 14] 0 2] 9 4 10 [7 8 [9 5 0 1] 9 2 10 [6 0 15] 0 2] 0 1] 0 1] 8 [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] 9 4 0 1] diff --git a/desk/bar/ackermann.noun b/desk/bar/ackermann.noun index 5b8cf21..801723b 100644 --- a/desk/bar/ackermann.noun +++ b/desk/bar/ackermann.noun @@ -1 +1 @@ -Ņ]&va&~؅۸p\\ 3 X 79H OdC0h:HD ?6y D ;!?! .ƕ ظ0]9Lo\$CJ!d!a \ No newline at end of file +Ņ]&va&~؅۸p\\ 3 X 79H OdC0h:HD ?6y D ;!?! n. `q؅[|ƕA2d-,?H  \ No newline at end of file diff --git a/desk/bar/add.nock b/desk/bar/add.nock new file mode 100644 index 0000000..be9384f --- /dev/null +++ b/desk/bar/add.nock @@ -0,0 +1 @@ +[[1.000 2.000] 8 [1 [8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 9 2 10 [6 [8 [9 10 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [8 [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 [9 4 0 1] 9 2 10 [6 [0 14] 0 15] 0 2] 9 11 0 1] diff --git a/desk/bar/add.noun b/desk/bar/add.noun new file mode 100644 index 0000000..41aba8e --- /dev/null +++ b/desk/bar/add.noun @@ -0,0 +1,2 @@ + +}p8-6!\B:H ],H!ha''2!,[l_v6OƯA~,pKs =H =Ԕ !;L X sA2d- a ;L\ \ No newline at end of file diff --git a/desk/bar/atomcat.hoon b/desk/bar/atomcat.hoon index 522f25a..41ec625 100644 --- a/desk/bar/atomcat.hoon +++ b/desk/bar/atomcat.hoon @@ -1,10 +1,7 @@ -/+ tiny -:: -=> tiny -:: -:- . +=> m=@ +:- 0 != -^- ^ +|^ ^- ^ =+ [m=(dec (bex 16)) n=(bex 15)] :* (add m n) (sub m n) @@ -12,3 +9,63 @@ (div m n) (mod m n) == +:: +++ dec + |= a=@ + ?< =(0 a) + =+ b=0 + |- ^- @ + ?: =(a +(b)) b + $(b +(b)) +:: +++ add + |= [a=@ b=@] + ^- @ + ?: =(0 a) b + $(a (dec a), b +(b)) +:: +++ sub + |= [a=@ b=@] + ^- @ + ?: =(0 b) a + $(a (dec a), b (dec b)) +:: +++ mul + |= [a=@ b=@] + ^- @ + =+ c=0 + |- + ?: =(0 a) c + $(a (dec a), c (add b c)) +:: +++ div + |= [a=@ b=@] + ^- @ + ?< =(0 b) + =+ c=0 + |- + ?: (lth a b) c + $(a (sub a b), c +(c)) +:: +++ mod + |= [a=@ b=@] + ^- @ + ?< =(0 b) + (sub a (mul b (div a b))) +:: +++ bex + |= a=@ + ^- @ + ?: =(0 a) 1 + (mul 2 $(a (dec a))) +:: +++ lth + |= [a=@ b=@] + ^- ? + ?& !=(a b) + |- + ?: =(0 a) & + ?: =(0 b) | + $(a (dec a), b (dec b)) + == +-- diff --git a/desk/bar/atomcat.nock b/desk/bar/atomcat.nock new file mode 100644 index 0000000..8026d51 --- /dev/null +++ b/desk/bar/atomcat.nock @@ -0,0 +1 @@ +[0 8 [1 [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 174 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 20 0 31] 9 2 10 [6 [0 125] 0 14] 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 174 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 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 174 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 175 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 47 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 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 6 [6 [5 [0 12] 0 13] [1 1] 1 0] [6 [8 [1 6 [5 [1 0] 0 28] [1 0] 6 [5 [1 0] 0 29] [1 1] 9 2 10 [14 [8 [9 174 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 174 0 15] 9 2 10 [6 0 61] 0 2] 0 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] [8 [[8 [9 174 0 1] 9 2 10 [6 7 [0 3] 8 [9 42 0 1] 9 2 10 [6 7 [0 3] 1 16] 0 2] 0 2] 8 [9 42 0 1] 9 2 10 [6 7 [0 3] 1 15] 0 2] [8 [9 20 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [9 47 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [9 4 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [9 86 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] 8 [9 46 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 47 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 86 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] [0 12] 9 2 10 [6 [8 [9 174 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 174 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] 9 22 0 1] diff --git a/desk/bar/atomcat.noun b/desk/bar/atomcat.noun new file mode 100644 index 0000000..2b5f182 --- /dev/null +++ b/desk/bar/atomcat.noun @@ -0,0 +1,2 @@ +kvqZb]v6L(_bɐA| pM!ha' Z.H, !ha~B|A2P b5Q8m<.!$C®@&~ D ;a|aUP bn tiny -:: -:- . +=> m=@ +:- 0 != -^- ^ +|^ ^- ^ =+ [m=(dec (bex 32)) n=(bex 31)] :* (add m n) (sub m n) @@ -12,3 +9,63 @@ (div m n) (mod m n) == +:: +++ dec + |= a=@ + ?< =(0 a) + =+ b=0 + |- ^- @ + ?: =(a +(b)) b + $(b +(b)) +:: +++ add + |= [a=@ b=@] + ^- @ + ?: =(0 a) b + $(a (dec a), b +(b)) +:: +++ sub + |= [a=@ b=@] + ^- @ + ?: =(0 b) a + $(a (dec a), b (dec b)) +:: +++ mul + |= [a=@ b=@] + ^- @ + =+ c=0 + |- + ?: =(0 a) c + $(a (dec a), c (add b c)) +:: +++ div + |= [a=@ b=@] + ^- @ + ?< =(0 b) + =+ c=0 + |- + ?: (lth a b) c + $(a (sub a b), c +(c)) +:: +++ mod + |= [a=@ b=@] + ^- @ + ?< =(0 b) + (sub a (mul b (div a b))) +:: +++ bex + |= a=@ + ^- @ + ?: =(0 a) 1 + (mul 2 $(a (dec a))) +:: +++ lth + |= [a=@ b=@] + ^- ? + ?& !=(a b) + |- + ?: =(0 a) & + ?: =(0 b) | + $(a (dec a), b (dec b)) + == +-- diff --git a/desk/bar/atomdog.nock b/desk/bar/atomdog.nock new file mode 100644 index 0000000..04bd647 --- /dev/null +++ b/desk/bar/atomdog.nock @@ -0,0 +1 @@ +[0 8 [1 [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 174 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 20 0 31] 9 2 10 [6 [0 125] 0 14] 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 174 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 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 174 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 175 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 47 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 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 6 [6 [5 [0 12] 0 13] [1 1] 1 0] [6 [8 [1 6 [5 [1 0] 0 28] [1 0] 6 [5 [1 0] 0 29] [1 1] 9 2 10 [14 [8 [9 174 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 174 0 15] 9 2 10 [6 0 61] 0 2] 0 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] [8 [[8 [9 174 0 1] 9 2 10 [6 7 [0 3] 8 [9 42 0 1] 9 2 10 [6 7 [0 3] 1 32] 0 2] 0 2] 8 [9 42 0 1] 9 2 10 [6 7 [0 3] 1 31] 0 2] [8 [9 20 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [9 47 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [9 4 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [9 86 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] 8 [9 46 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 47 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 86 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] [0 12] 9 2 10 [6 [8 [9 174 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 174 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] 9 22 0 1] diff --git a/desk/bar/atomdog.noun b/desk/bar/atomdog.noun new file mode 100644 index 0000000..6752261 --- /dev/null +++ b/desk/bar/atomdog.noun @@ -0,0 +1,3 @@ +kvqZb]v6L(_bɐA| pM!ha' Z.H, !ha~B|A2P b5Q8m<.!$C®@&~ D ;a|aUP bn tiny -:: -:- . +=> m=@ +:- 0 != -^- ^ -=+ [m=(dec (bex 128)) n=(bex 128)] +|^ ^- ^ +=+ [m=(dec (bex 128)) n=(bex 127)] :* (add m n) (sub m n) (mul m n) (div m n) (mod m n) == +:: +++ dec + |= a=@ + ?< =(0 a) + =+ b=0 + |- ^- @ + ?: =(a +(b)) b + $(b +(b)) +:: +++ add + |= [a=@ b=@] + ^- @ + ?: =(0 a) b + $(a (dec a), b +(b)) +:: +++ sub + |= [a=@ b=@] + ^- @ + ?: =(0 b) a + $(a (dec a), b (dec b)) +:: +++ mul + |= [a=@ b=@] + ^- @ + =+ c=0 + |- + ?: =(0 a) c + $(a (dec a), c (add b c)) +:: +++ div + |= [a=@ b=@] + ^- @ + ?< =(0 b) + =+ c=0 + |- + ?: (lth a b) c + $(a (sub a b), c +(c)) +:: +++ mod + |= [a=@ b=@] + ^- @ + ?< =(0 b) + (sub a (mul b (div a b))) +:: +++ bex + |= a=@ + ^- @ + ?: =(0 a) 1 + (mul 2 $(a (dec a))) +:: +++ lth + |= [a=@ b=@] + ^- ? + ?& !=(a b) + |- + ?: =(0 a) & + ?: =(0 b) | + $(a (dec a), b (dec b)) + == +-- diff --git a/desk/bar/atomgmp.nock b/desk/bar/atomgmp.nock new file mode 100644 index 0000000..f7c0d38 --- /dev/null +++ b/desk/bar/atomgmp.nock @@ -0,0 +1 @@ +[0 8 [1 [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 174 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 20 0 31] 9 2 10 [6 [0 125] 0 14] 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 174 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 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 174 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 175 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 47 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 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 6 [6 [5 [0 12] 0 13] [1 1] 1 0] [6 [8 [1 6 [5 [1 0] 0 28] [1 0] 6 [5 [1 0] 0 29] [1 1] 9 2 10 [14 [8 [9 174 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 174 0 15] 9 2 10 [6 0 61] 0 2] 0 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] [8 [[8 [9 174 0 1] 9 2 10 [6 7 [0 3] 8 [9 42 0 1] 9 2 10 [6 7 [0 3] 1 128] 0 2] 0 2] 8 [9 42 0 1] 9 2 10 [6 7 [0 3] 1 127] 0 2] [8 [9 20 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [9 47 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [9 4 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [9 86 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] 8 [9 46 0 3] 9 2 10 [6 [0 12] 0 13] 0 2] [8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 47 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 86 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] [0 12] 9 2 10 [6 [8 [9 174 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 174 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] 9 22 0 1] diff --git a/desk/bar/atomgmp.noun b/desk/bar/atomgmp.noun new file mode 100644 index 0000000..189caeb --- /dev/null +++ b/desk/bar/atomgmp.noun @@ -0,0 +1,2 @@ +kvqZb]v6L(_bɐA| pM!ha' Z.H, !ha~B|A2P b5Q8m<.!$C®@&~ D ;a|aUP bn tiny -:: -:- . +=> m=@ +:- 0 != -^- ^ +|^ ^- ^ &100:(reap 100 ~) +:: +++ reap + |= [a=@ b=*] + |- ^- * + ?: =(0 a) ~ + [b $(a (dec a))] +:: +++ dec + |= a=@ + ?< =(0 a) + =+ b=0 + |- ^- @ + ?: =(a +(b)) b + $(b +(b)) +-- diff --git a/desk/bar/bigslot.nock b/desk/bar/bigslot.nock new file mode 100644 index 0000000..dd161d0 --- /dev/null +++ b/desk/bar/bigslot.nock @@ -0,0 +1 @@ +[0 8 [1 [8 [1 0 0] [1 8 [1 6 [5 [1 0] 0 28] [1 0] [0 29] 9 2 10 [28 8 [9 10 0 15] 9 2 10 [6 0 60] 0 2] 0 1] 9 2 0 1] 0 1] [8 [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] 7 [8 [9 4 0 1] 9 2 10 [6 [7 [0 3] 1 100] 7 [0 3] 1 0] 0 2] 0 2.535.301.200.456.458.802.993.406.410.750] 9 11 0 1] diff --git a/desk/bar/bigslot.noun b/desk/bar/bigslot.noun new file mode 100644 index 0000000..4729fea --- /dev/null +++ b/desk/bar/bigslot.noun @@ -0,0 +1,2 @@ +kvqZ ؄%ɐA` !ha'Odr 9aannmvf]%̇99$CJaudX !ha~ +0K`d* \ No newline at end of file diff --git a/desk/bar/dec.nock b/desk/bar/dec.nock new file mode 100644 index 0000000..cfba104 --- /dev/null +++ b/desk/bar/dec.nock @@ -0,0 +1 @@ +[1.000.000 8 [1 [8 [9 5 0 1] 9 2 10 [6 0 7] 0 2] 8 [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] 9 4 0 1] diff --git a/desk/bar/dec.noun b/desk/bar/dec.noun new file mode 100644 index 0000000..47ba332 --- /dev/null +++ b/desk/bar/dec.noun @@ -0,0 +1 @@ + H`qA nr D ;-pb7K`C 0o 20gǽA2w$ \ No newline at end of file diff --git a/desk/bar/factorial.nock b/desk/bar/factorial.nock new file mode 100644 index 0000000..f536f63 --- /dev/null +++ b/desk/bar/factorial.nock @@ -0,0 +1 @@ +[40 8 [1 [8 [1 1 1] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 21 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 20 0 31] 9 2 10 [6 [0 125] 0 14] 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 21 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] 8 [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 [1 1] 8 [1 6 [5 [0 30] 1 1] [0 6] 9 2 10 [30 8 [9 21 0 31] 9 2 10 [6 0 62] 0 2] 10 [6 8 [9 4 0 31] 9 2 10 [6 [0 14] 0 62] 0 2] 0 1] 9 2 0 1] 0 1] 9 2 10 [6 0 7] 0 2] 9 11 0 1] diff --git a/desk/bar/factorial.noun b/desk/bar/factorial.noun new file mode 100644 index 0000000..d42a941 --- /dev/null +++ b/desk/bar/factorial.noun @@ -0,0 +1 @@ +A X\,8.ƹ K 2`5a?H p~"had0:L 2v 'ćq$CEP4V,N.ƹ A2d-`A2XM 2v0n*ۡh 88m;lCM 0m 2pơx Xl[݃`q؅pb6H AaɐA6v,H9L 2vCI8\q;C8A2d-졆m C \ No newline at end of file diff --git a/desk/bar/fibonacci.nock b/desk/bar/fibonacci.nock new file mode 100644 index 0000000..6152a02 --- /dev/null +++ b/desk/bar/fibonacci.nock @@ -0,0 +1 @@ +[10 8 [1 [8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 9 2 10 [6 [8 [9 10 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [8 [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 6 [5 [0 6] 1 1] [1 1] 6 [5 [0 6] 1 2] [1 1] 8 [9 4 0 7] 9 2 10 [6 [7 [0 3] 9 2 10 [6 8 [9 10 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 7 [0 3] 9 2 10 [6 8 [9 10 0 7] 9 2 10 [6 7 [0 3] 8 [9 10 0 7] 9 2 10 [6 0 14] 0 2] 0 2] 0 1] 0 2] 0 1] 9 2 10 [6 0 7] 0 2] 9 11 0 1] diff --git a/desk/bar/fibonacci.noun b/desk/bar/fibonacci.noun new file mode 100644 index 0000000..f6e8619 --- /dev/null +++ b/desk/bar/fibonacci.noun @@ -0,0 +1 @@ +A4 ؄p .$L NOda]<6 an aabɐMP(s4H0G`Aoq؅0cn.܆#* X s .$C6YA!d& ;!>ap) !, A2d~åp803rÌh da= d9 diff --git a/desk/bar/mmul.hoon b/desk/bar/mmul.hoon new file mode 100644 index 0000000..7dc1f6f --- /dev/null +++ b/desk/bar/mmul.hoon @@ -0,0 +1,95 @@ +=> size=@ +:- 10 +!= +%. size +|= size=@ +^- * +:: multiply two procedurally generated size x size matrices. +:: a[i][j] = i*size + j + 1 (1-indexed sequential) +:: b[i][j] = size*size - (i*size + j) (reverse sequential) +:: +|^ +=+ a=(gen size |=([i=@ j=@] (add +(j) (mul i size)))) +=+ b=(gen size |=([i=@ j=@] (sub (mul size size) (add j (mul i size))))) +(mmul a b) +:: +++ mmul + |= [a=* b=*] + ^- * + =+ bt=(trn b) + (turn a |=(row=* (turn bt |=(col=* (dot row col))))) +:: +++ gen + |= [n=@ f=$-([@ @] @)] + ^- * + =+ i=0 + |- + ?: =(i n) ~ + :_ $(i +(i)) + =+ j=0 + |- ^- * + ?: =(j n) ~ + :_ $(j +(j)) + (f [i j]) +:: +++ turn + |= [a=* b=$-(* *)] + ^- * + ?~ a ~ + [(b -.a) $(a +.a)] +:: +++ trn + |= m=* + ^- * + ?~ m ~ + ?~ -.m ~ + [(heads m) $(m (tails m))] +:: +++ heads + |= m=* + ^- * + ?~ m ~ + [-.-.m $(m +.m)] +:: +++ tails + |= m=* + ^- * + ?~ m ~ + [?~(-.m ~ +.-.m) $(m +.m)] +:: +++ dot + |= [a=* b=*] + ^- @ + ?~ a 0 + ?~ b 0 + %+ add (mul `@`-.a `@`-.b) + $(a +.a, b +.b) +:: +++ dec + |= a=@ + ?< =(0 a) + =+ b=0 + |- ^- @ + ?: =(a +(b)) b + $(b +(b)) +:: +++ add + |= [a=@ b=@] + ^- @ + ?: =(0 a) b + $(a (dec a), b +(b)) +:: +++ sub + |= [a=@ b=@] + ^- @ + ?: =(0 b) a + $(a (dec a), b (dec b)) +:: +++ mul + |= [a=@ b=@] + ^- @ + =+ c=0 + |- + ?: =(0 a) c + $(a (dec a), c (add b c)) +-- diff --git a/desk/bar/mmul.nock b/desk/bar/mmul.nock new file mode 100644 index 0000000..8087946 --- /dev/null +++ b/desk/bar/mmul.nock @@ -0,0 +1 @@ +[10 8 [8 [1 0] [1 8 [1 [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 684 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 20 0 31] 9 2 10 [6 [0 125] 0 14] 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 684 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [1 0] 0 12] [1 0] 6 [5 [1 0] 0 13] [1 0] 8 [9 20 0 7] 9 2 10 [6 [7 [0 3] 8 [9 4 0 7] 9 2 10 [6 [0 56] 0 58] 0 2] 7 [0 3] 9 2 10 [6 [0 25] 0 27] 0 1] 0 2] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] 6 [5 [1 0] 0 12] [1 0] [8 [9 43 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 8 [9 46 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 1] [[8 [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 [8 [9 170 0 7] 9 2 10 [6 0 29] 0 2] 8 [9 22 0 15] 9 2 10 [6 [0 60] 7 [0 3] 8 [1 0] [1 8 [9 22 0 63] 9 2 10 [6 [0 30] 7 [0 3] 8 [1 0] [1 8 [9 84 0 255] 9 2 10 [6 [0 62] 0 14] 0 2] 0 1] 0 2] 0 1] 0 2] 0 1] 8 [1 0 [0 15] [0 0] [0 0] 0] [1 8 [1 0] 8 [1 6 [5 [0 6] 0 60] [1 0] [8 [1 0] 8 [1 6 [5 [0 6] 0 252] [1 0] [8 [0 253] 9 2 10 [6 7 [0 3] [0 30] 0 6] 0 2] 9 2 10 [6 4 0 6] 0 1] 9 2 0 1] 9 2 10 [6 4 0 6] 0 1] 9 2 0 1] 0 1] 8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] [0 24] 9 2 10 [6 0 13] 0 1] 0 1] [8 [1 0 [0 15] 0 0 0] [1 6 [5 [1 0] 0 12] [1 0] [8 [0 13] 9 2 10 [6 0 56] 0 2] 9 2 10 [12 0 25] 0 1] 0 1] [8 [1 0] [1 6 [5 [1 0] 0 6] [1 0] [6 [5 [1 0] 0 12] [1 0] 0 25] 9 2 10 [6 0 13] 0 1] 0 1] [8 [8 [9 343 0 1] 9 2 10 [6 [0 30] 7 [0 3] 8 [1 0 0] [1 8 [9 20 0 7] 9 2 10 [6 [7 [0 3] 4 0 13] 7 [0 3] 8 [9 4 0 7] 9 2 10 [6 [0 28] 0 126] 0 2] 0 2] 0 1] 0 2] 8 [8 [9 343 0 3] 9 2 10 [6 [0 62] 7 [0 3] 8 [1 0 0] [1 8 [9 95 0 15] 9 2 10 [6 [7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [0 254] 0 254] 0 2] 7 [0 3] 8 [9 20 0 15] 9 2 10 [6 [0 29] 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [0 28] 0 254] 0 2] 0 2] 0 2] 0 1] 0 2] 8 [9 685 0 7] 9 2 10 [6 [0 14] 0 6] 0 2] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 12] 9 2 10 [6 [8 [9 684 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 684 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] 9 94 0 1] 0 1] 9 2 10 [6 0 3] 0 2] diff --git a/desk/bar/mmul.noun b/desk/bar/mmul.noun new file mode 100644 index 0000000..f9e11d2 Binary files /dev/null and b/desk/bar/mmul.noun differ diff --git a/desk/bar/sha512.hoon b/desk/bar/sha512.hoon new file mode 100644 index 0000000..3d8a806 --- /dev/null +++ b/desk/bar/sha512.hoon @@ -0,0 +1,294 @@ +=> m=@ +:- 0 +!= +|^ ^- @ +:: SHA-512 of 'abc' (3 bytes) +:: expected: 0xddaf.35a1.9361.7aba.cc41.7349.ae20.4131. +:: 12e6.fa4e.89a9.7ea2.0a9e.eee6.4b55.d39a. +:: 2192.992a.274f.c1a8.36ba.3c23.a3fe.ebbd. +:: 454d.4423.643c.e80e.2a9a.c94f.a54c.a49f +:: +%. [3 0x63.6261] +|= [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) +:: +++ dec + |= a=@ + ?< =(0 a) + =+ b=0 + |- ^- @ + ?: =(a +(b)) b + $(b +(b)) +:: +++ add + |= [a=@ b=@] + ^- @ + ?: =(0 a) b + $(a (dec a), b +(b)) +:: +++ sub + |= [a=@ b=@] + ^- @ + ?: =(0 b) a + $(a (dec a), b (dec b)) +:: +++ mul + |= [a=@ b=@] + ^- @ + =+ c=0 + |- + ?: =(0 a) c + $(a (dec a), c (add b c)) +:: +++ div + |= [a=@ b=@] + ^- @ + ?< =(0 b) + =+ c=0 + |- + ?: (lth a b) c + $(a (sub a b), c +(c)) +:: +++ mod + |= [a=@ b=@] + ^- @ + ?< =(0 b) + (sub a (mul b (div a b))) +:: +++ bex + |= a=@ + ^- @ + ?: =(0 a) 1 + (mul 2 $(a (dec a))) +:: +++ lth + |= [a=@ b=@] + ^- ? + ?& !=(a b) + |- + ?: =(0 a) & + ?: =(0 b) | + $(a (dec a), b (dec b)) + == +:: +++ lte + |= [a=@ b=@] + ^- ? + |(=(a b) (lth a b)) +:: +++ lsh + |= [a=$@(@ [@ @]) b=@] + =/ [bl=@ s=@] ?^(a a [a 1]) + (mul b (bex (mul (bex bl) s))) +:: +++ rsh + |= [a=$@(@ [@ @]) b=@] + =/ [bl=@ s=@] ?^(a a [a 1]) + (div b (bex (mul (bex bl) s))) +:: +++ con + |= [a=@ b=@] + ^- @ + ?: =(0 a) b + ?: =(0 b) a + =+ c=?|(!=(0 (mod a 2)) !=(0 (mod b 2))) + (add ?:(c 1 0) (mul 2 $(a (div a 2), b (div b 2)))) +:: +++ dis + |= [a=@ b=@] + ^- @ + ?: =(0 a) 0 + ?: =(0 b) 0 + =+ c=?&(!=(0 (mod a 2)) !=(0 (mod b 2))) + (add ?:(c 1 0) (mul 2 $(a (div a 2), b (div b 2)))) +:: +++ mix + |= [a=@ b=@] + ^- @ + ?: =(0 a) b + ?: =(0 b) a + %+ add + (mod (add (mod a 2) (mod b 2)) 2) + (mul 2 $(a (div a 2), b (div b 2))) +:: +++ met + |= [a=@ b=@] + ^- @ + ?: =(0 b) 0 + =+ c=(bex (bex a)) + |- ^- @ + ?: (lth b c) 1 + +($(b (div b c))) +:: +++ end + |= [a=$@(@ [@ @]) b=@] + =/ [bl=@ s=@] ?^(a a [a 1]) + (mod b (bex (mul (bex bl) s))) +:: +++ cut + |= [a=@ [b=@ c=@] d=@] + (end [a c] (rsh [a b] d)) +:: +++ can + |= [a=@ b=*] + ^- @ + ?~ b 0 + (add (end [a `@`-.-.b] `@`+.-.b) (lsh [a `@`-.-.b] $(b +.b))) +:: +++ rep + |= [a=$@(@ [@ @]) b=*] + =/ [bl=@ s=@] ?^(a a [a 1]) + =| i=@ + |- ^- @ + ?~ b 0 + %+ add $(i +(i), b +.b) + (lsh [bl (mul s i)] (end [bl s] `@`-.b)) +:: +++ rip + |= [a=$@(@ [@ @]) b=@] + ^- * + ?: =(0 b) ~ + [(end a b) $(b (rsh a b))] +:: +++ turn + |= [a=* b=$-(* *)] + ^- * + ?~ a ~ + [(b -.a) $(a +.a)] +:: +++ run :: +turn into atom + |= [a=$@(@ [@ @]) b=@ c=$-(@ @)] + (rep a (turn (rip a b) c)) +:: +++ fe :: modulo bloq + |_ a=@ + ++ inv |=(b=@ (sub (dec (bex (bex a))) (sit b))) + ++ net |= b=@ ^- @ + => .(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)) + ++ rol |= [b=@ c=@ d=@] ^- @ + =+ 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=@ c=@ d=@] ^- @ + =+ 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))) + ++ sit |=(b=@ (end a b)) + -- +-- diff --git a/desk/bar/sha512.nock b/desk/bar/sha512.nock new file mode 100644 index 0000000..4a897ba --- /dev/null +++ b/desk/bar/sha512.nock @@ -0,0 +1 @@ +[0 8 [1 [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 21.948 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 84 0 31] 9 2 10 [6 [0 125] 0 14] 0 2] 0 1] 9 2 0 1] 0 1] [[8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 6 [5 [1 0] 0 13] [0 12] 8 [9 84 0 7] 9 2 10 [6 [7 [0 3] 8 [9 188 0 7] 9 2 10 [6 [7 [0 3] 8 [9 84 0 7] 9 2 10 [6 [7 [0 3] 8 [9 188 0 7] 9 2 10 [6 [0 28] 7 [0 3] 1 2] 0 2] 7 [0 3] 8 [9 188 0 7] 9 2 10 [6 [0 29] 7 [0 3] 1 2] 0 2] 0 2] 7 [0 3] 1 2] 0 2] 7 [0 3] 8 [9 4 0 7] 9 2 10 [6 [7 [0 3] 1 2] 7 [0 3] 9 2 10 [6 [8 [9 5.486 0 7] 9 2 10 [6 [0 28] 7 [0 3] 1 2] 0 2] 8 [9 5.486 0 7] 9 2 10 [6 [0 29] 7 [0 3] 1 2] 0 2] 0 1] 0 2] 0 2] 0 1] [[8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 9 2 10 [6 [8 [9 21.948 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 12] [0 13] 6 [5 [1 0] 0 13] [0 12] 8 [6 [6 [5 [1 0] 8 [9 188 0 7] 9 2 10 [6 [0 28] 7 [0 3] 1 2] 0 2] [1 1] 1 0] [1 0] 6 [6 [5 [1 0] 8 [9 188 0 7] 9 2 10 [6 [0 29] 7 [0 3] 1 2] 0 2] [1 1] 1 0] [1 0] 1 1] 8 [9 84 0 15] 9 2 10 [6 [7 [0 3] 6 [0 2] [1 1] 1 0] 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 1 2] 7 [0 3] 9 2 10 [6 [8 [9 5.486 0 15] 9 2 10 [6 [0 60] 7 [0 3] 1 2] 0 2] 8 [9 5.486 0 15] 9 2 10 [6 [0 61] 7 [0 3] 1 2] 0 2] 0 3] 0 2] 0 2] 0 1] [[8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] [8 [9 87.798 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 9 2 10 [13 8 [9 87 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [8 [9 87.799 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 0] 1 1] 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 21.948 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 87.799 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 379 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 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 4 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 2.742 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 2.742 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 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 188 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 2.742 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 2.742 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 [5 [1 0] 0 29] [1 1] 9 2 10 [14 [8 [9 21.948 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 21.948 0 15] 9 2 10 [6 0 61] 0 2] 0 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] 8 [1 0 0] [1 6 [5 [1 0] 0 13] [1 0] 8 [8 [9 2.742 0 7] 9 2 10 [6 7 [0 3] 8 [9 2.742 0 7] 9 2 10 [6 0 28] 0 2] 0 2] 8 [1 6 [8 [9 87.799 0 31] 9 2 10 [6 [0 125] 0 14] 0 2] [1 1] 4 9 2 10 [61 8 [9 5.486 0 31] 9 2 10 [6 [0 125] 0 14] 0 2] 0 1] 9 2 0 1] 0 1] 8 [1 0 [0 0] 0] [1 8 [9 87.798 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 53] 7 [0 3] 8 [9 87 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 59] 0 2] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 12] [1 0] 6 [5 [1 0] 0 13] [1 0] 8 [6 [6 [5 [1 0] 8 [9 188 0 7] 9 2 10 [6 [0 28] 7 [0 3] 1 2] 0 2] [1 1] 1 0] [6 [6 [5 [1 0] 8 [9 188 0 7] 9 2 10 [6 [0 29] 7 [0 3] 1 2] 0 2] [1 1] 1 0] [1 0] 1 1] 1 1] 8 [9 84 0 15] 9 2 10 [6 [7 [0 3] 6 [0 2] [1 1] 1 0] 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 1 2] 7 [0 3] 9 2 10 [6 [8 [9 5.486 0 15] 9 2 10 [6 [0 60] 7 [0 3] 1 2] 0 2] 8 [9 5.486 0 15] 9 2 10 [6 [0 61] 7 [0 3] 1 2] 0 2] 0 3] 0 2] 0 2] 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 5.486 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 2.742 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 2.742 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [1 0 [0 15] 0 0 0] [1 6 [5 [1 0] 0 12] [1 0] [8 [0 13] 9 2 10 [6 0 56] 0 2] 9 2 10 [12 0 25] 0 1] 0 1] [8 [8 [1 0 0] [1 7 [10 [13 8 [9 343 0 7] 9 2 10 [6 [7 [0 3] 1 3] [7 [0 3] [1 0] 0 12] 0 29] 0 2] 0 1] 8 [[7 [9 190 0 7] 10 [6 1 6] 0 1] 8 [1 0 0] [1 8 [9 343 0 31] 9 2 10 [6 [7 [0 3] 1 6] [7 [0 3] [0 12] 1 1] 0 29] 0 2] 0 1] 8 [[9 4 0 4] [9 10 0 4] [9 23 0 4] 9 91 0 4] 8 [8 [9 43.898 0 31] 9 2 10 [6 [7 [0 3] 1 0 3] 0 124] 0 2] 8 [8 [9 378 0 63] 9 2 10 [6 [7 [0 3] 1 0] 7 [0 3] [[0 2] 0 125] [1 8 128] [[8 [9 188 0 63] 9 2 10 [6 [7 [0 3] 8 [9 379 0 63] 9 2 10 [6 [7 [0 3] 1 1.920] 7 [0 3] 8 [9 188 0 63] 9 2 10 [6 [7 [0 3] 8 [9 84 0 63] 9 2 10 [6 [7 [0 3] 1 8] 0 6] 0 2] 7 [0 3] 1 1.024] 0 2] 0 2] 7 [0 3] 1 1.024] 0 2] 1 0] [[1 128] 8 [8 [9 190 0 63] 9 23 10 [6 7 [0 3] 1 7] 0 2] 9 2 10 [6 0 6] 0 2] 1 0] 0 2] 8 [8 [9 10.975 0 127] 9 2 10 [6 [7 [0 3] 1 10] 0 6] 0 2] 8 [1 79.401.733.742.453.553.460.850.974.233.500.163.835.348.862.130.151.944.941.868.585.954.107.921.729.851.966.433.709.504.484.594.679.435.920.217.403.432.902.140.994.683.155.589.145.428.503.332.143.350.099.233.675.287.629.342.148.958.156.760.608.048.718.624.254.807.234.857.957.852.455.754.214.058.884.921.634.611.326.080.205.028.019.932.017.299.108.412.944.066.748.695.243.938.538.222.011.871.193.474.315.677.411.354.832.238.878.879.580.026.905.713.004.175.351.116.394.147.631.691.291.051.896.265.977.658.407.765.544.729.563.264.081.113.624.712.905.526.199.824.849.243.202.590.140.303.189.688.134.116.128.494.335.089.560.005.513.154.509.089.550.000.761.255.799.866.325.224.245.302.341.002.348.938.473.127.098.360.843.277.708.398.217.491.814.982.223.042.684.701.014.439.043.985.348.647.627.260.823.478.770.080.292.761.916.386.342.786.932.479.083.740.835.907.016.162.305.032.857.537.046.140.546.558.784.246.985.852.552.655.451.305.556.579.902.388.712.433.715.435.365.355.118.487.175.420.852.053.958.416.930.158.193.676.921.281.365.595.997.321.839.184.966.351.001.269.990.065.517.904.640.083.352.893.266.395.342.353.390.165.452.080.100.972.549.846.464.999.139.078.654.794.207.765.074.847.081.235.236.169.199.660.995.854.142.221.606.170.754.579.040.654.251.887.857.292.569.044.177.719.716.794.421.818.060.776.737.044.033.093.531.714.540.655.966.802.073.377.033.638.767.129.476.236.253.099.442.454.114.897.544.131.384.012.900.311.640.737.753.004.131.001.050.775.512.054.237.450.756.896.889.568.333.869.892.075.607.669.344.033.195.862.547.426.252.590.686.148.624.074.116.392.191.708.788.571.081.612.071.343.428.420.806.936.287.685.748.480.654.347.806.239.090.915.076.728.239.100.344.933.911.375.104.624.615.916.807.971.556.351.801.760.876.948.354.563.175.513.568.373.209.404.554.063.007.387.465.388.995.308.446.212.666.495.189.366.480.319.809.197.885.878.244.498.379.497.550.728.853.899.917.860.378.912.106.109.910.455.014.168.049.971.294.187.227.495.270.703.061.017.345.423.922.759.262.219.819.475.714.723.322.081.387.967.974.931.234.460.660.416.134.255.259.170] 8 [1 4.812.048.101.252.663.290.612.834.066.995.531.158.742.713.419.846.591.145.376.350.182.667.999.366.794.400.516.985.448.940.192.745.739.731.038.893.726.247.251.609.359.409.289.363.687.649.257.956.495.378.696] 8 [1 0] 8 [1 6 [5 [0 6] 0 62] [8 [9 382 0 4.095] 9 2 10 [6 [7 [0 3] 1 6] [0 30] 0 8.182] 0 2] 8 [8 [8 [9 343 0 4.095] 9 2 10 [6 [7 [0 3] 1 10] [7 [0 3] [0 6] 1 1] 0 254] 0 2] 8 [8 [9 382 0 8.191] 9 2 10 [6 [7 [0 3] 1 6] [0 6] 0 16.374] 0 2] 8 [1 16] 8 [1 6 [5 [1 80] 0 6] [0 14] 8 [[8 [0 32.765] 9 2 10 [6 [7 [0 3] 8 [9 379 0 65.535] 9 2 10 [6 [0 14] 7 [0 3] 1 15] 0 2] 0 30] 0 2] [8 [0 32.765] 9 2 10 [6 [7 [0 3] 8 [9 379 0 65.535] 9 2 10 [6 [0 14] 7 [0 3] 1 2] 0 2] 0 30] 0 2] [8 [0 32.765] 9 2 10 [6 [7 [0 3] 8 [9 379 0 65.535] 9 2 10 [6 [0 14] 7 [0 3] 1 16] 0 2] 0 30] 0 2] 8 [0 32.765] 9 2 10 [6 [7 [0 3] 8 [9 379 0 65.535] 9 2 10 [6 [0 14] 7 [0 3] 1 7] 0 2] 0 30] 0 2] 8 [8 [9 20 0 131.071] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [0 65.530] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 1] 0 12] 0 2] 7 [0 3] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [0 65.530] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 8] 0 12] 0 2] 7 [0 3] 7 [0 3] 8 [9 87 0 131.071] 9 2 10 [6 [7 [0 3] 1 0 7] 0 12] 0 2] 0 2] 0 2] 8 [8 [9 20 0 262.143] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [0 131.066] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 19] 0 58] 0 2] 7 [0 3] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [0 131.066] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 61] 0 58] 0 2] 7 [0 3] 7 [0 3] 8 [9 87 0 262.143] 9 2 10 [6 [7 [0 3] 1 0 6] 0 58] 0 2] 0 2] 0 2] 8 [8 [0 131.068] 8 [0 2] 9 2 10 [6 [0 502] 7 [0 3] 8 [0 2] 9 2 10 [6 [0 30] 7 [0 3] 8 [0 2] 9 2 10 [6 [0 503] 0 14] 0 2] 0 2] 0 2] 9 2 10 [14 8 [9 170 0 1.048.575] 9 2 10 [6 [7 [0 3] 8 [9 43.898 0 1.048.575] 9 2 10 [6 [7 [0 3] [1 6] 0 126] 0 6] 0 2] 0 510] 0 2] 10 [6 4 0 126] 0 31] 9 2 0 1] 8 [1 0] 8 [[8 [0 8.189] 9 2 10 [6 [7 [0 3] 1 0] 0 126] 0 2] [8 [0 8.189] 9 2 10 [6 [7 [0 3] 1 1] 0 126] 0 2] [8 [0 8.189] 9 2 10 [6 [7 [0 3] 1 2] 0 126] 0 2] [8 [0 8.189] 9 2 10 [6 [7 [0 3] 1 3] 0 126] 0 2] [8 [0 8.189] 9 2 10 [6 [7 [0 3] 1 4] 0 126] 0 2] [8 [0 8.189] 9 2 10 [6 [7 [0 3] 1 5] 0 126] 0 2] [8 [0 8.189] 9 2 10 [6 [7 [0 3] 1 6] 0 126] 0 2] 8 [0 8.189] 9 2 10 [6 [7 [0 3] 1 7] 0 126] 0 2] 8 [1 6 [5 [1 80] 0 14] [9 2 10 [14 8 [9 383 0 65.535] 9 2 10 [6 [7 [0 3] 1 6] 7 [0 3] [8 [0 16.380] 9 2 10 [6 [0 28] 7 [0 3] 8 [0 32.765] 9 2 10 [6 [7 [0 3] 1 0] 0 510] 0 2] 0 2] [8 [0 16.380] 9 2 10 [6 [0 58] 7 [0 3] 8 [0 32.765] 9 2 10 [6 [7 [0 3] 1 1] 0 510] 0 2] 0 2] [8 [0 16.380] 9 2 10 [6 [0 118] 7 [0 3] 8 [0 32.765] 9 2 10 [6 [7 [0 3] 1 2] 0 510] 0 2] 0 2] [8 [0 16.380] 9 2 10 [6 [0 238] 7 [0 3] 8 [0 32.765] 9 2 10 [6 [7 [0 3] 1 3] 0 510] 0 2] 0 2] [8 [0 16.380] 9 2 10 [6 [0 478] 7 [0 3] 8 [0 32.765] 9 2 10 [6 [7 [0 3] 1 4] 0 510] 0 2] 0 2] [8 [0 16.380] 9 2 10 [6 [0 958] 7 [0 3] 8 [0 32.765] 9 2 10 [6 [7 [0 3] 1 5] 0 510] 0 2] 0 2] [8 [0 16.380] 9 2 10 [6 [0 1.918] 7 [0 3] 8 [0 32.765] 9 2 10 [6 [7 [0 3] 1 6] 0 510] 0 2] 0 2] [8 [0 16.380] 9 2 10 [6 [0 1.919] 7 [0 3] 8 [0 32.765] 9 2 10 [6 [7 [0 3] 1 7] 0 510] 0 2] 0 2] 1 0] 0 2] 10 [6 4 0 126] 0 31] 8 [8 [9 20 0 65.535] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [0 32.762] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 28] 0 28] 0 2] 7 [0 3] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [0 32.762] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 34] 0 28] 0 2] 7 [0 3] 7 [0 3] 8 [0 32.762] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 39] 0 28] 0 2] 0 2] 0 2] 8 [8 [9 20 0 131.071] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [9 86 0 131.071] 9 2 10 [6 [0 60] 0 122] 0 2] 7 [0 3] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [9 86 0 131.071] 9 2 10 [6 [0 60] 0 246] 0 2] 7 [0 3] 7 [0 3] 8 [9 86 0 131.071] 9 2 10 [6 [0 122] 0 246] 0 2] 0 2] 0 2] 8 [8 [0 65.532] 9 2 10 [6 [0 14] 0 6] 0 2] 8 [8 [9 20 0 524.287] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [0 262.138] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 14] 0 4.062] 0 2] 7 [0 3] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [0 262.138] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 18] 0 4.062] 0 2] 7 [0 3] 7 [0 3] 8 [0 262.138] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] 1 41] 0 4.062] 0 2] 0 2] 0 2] 8 [8 [9 20 0 1.048.575] 9 2 10 [6 [7 [0 3] 8 [9 86 0 1.048.575] 9 2 10 [6 [0 8.158] 0 16.318] 0 2] 7 [0 3] 8 [9 86 0 1.048.575] 9 2 10 [6 [7 [0 3] 8 [0 1.048.567] 9 2 10 [6 0 8.158] 0 2] 0 32.638] 0 2] 0 2] 8 [8 [0 524.284] 8 [0 2] 9 2 10 [6 [0 130.943] 7 [0 3] 8 [0 2] 9 2 10 [6 [0 30] 7 [0 3] 8 [0 2] 9 2 10 [6 [0 14] 7 [0 3] 8 [0 2] 9 2 10 [6 [7 [0 3] 7 [0 3] 8 [0 1.048.573] 9 2 10 [6 [0 1.022] 0 32.766] 0 2] 7 [0 3] 7 [0 3] 8 [0 1.048.573] 9 2 10 [6 [0 1.022] 0 2.046] 0 2] 0 2] 0 2] 0 2] 0 2] 9 2 10 [14 4 0 1.022] 10 [6 [8 [0 1.048.572] 9 2 10 [6 [0 6] 0 62] 0 2] [0 1.020] [0 2.042] [0 4.086] [8 [0 1.048.572] 9 2 10 [6 [0 16.366] 0 6] 0 2] [0 16.350] [0 32.702] 0 65.406] 0 127] 9 2 0 1] 9 2 0 1] 0 1] 9 2 10 [6 7 [0 3] 1 3 6.513.249] 0 2] [[8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 379 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 5.486 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 84 0 7] 9 2 10 [6 [7 [0 3] 8 [9 87.798 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 117] 0 2] 7 [0 3] 8 [9 43.898 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 [5 [1 0] 0 13] [0 12] 9 2 10 [6 [8 [9 21.948 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 21.948 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] [8 [1 0] [1 [8 [1 0 0] [1 8 [9 90 0 7] 9 2 10 [6 7 [0 3] 8 [9 84 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 90 0 7] 9 2 10 [6 0 59] 0 2] 8 [8 [9 2.742 0 63] 9 2 10 [6 7 [0 3] 8 [9 379 0 63] 9 2 10 [6 [0 126] 0 60] 0 2] 0 2] 8 [8 [9 188 0 127] 9 2 10 [6 [0 250] 0 6] 0 2] 8 [9 90 0 63] 9 2 10 [6 7 [0 3] 8 [9 170 0 255] 9 2 10 [6 [7 [0 3] 8 [9 87 0 255] 9 2 10 [6 [7 [0 3] [0 124] 0 2] 0 30] 0 2] 7 [0 3] 8 [9 43.898 0 255] 9 2 10 [6 [7 [0 3] [0 124] 8 [9 379 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 0 0] [1 8 [8 [9 90 0 7] 9 2 10 [6 0 59] 0 2] 8 [8 [9 2.742 0 63] 9 2 10 [6 7 [0 3] 8 [9 379 0 63] 9 2 10 [6 [0 126] 0 60] 0 2] 0 2] 8 [8 [9 188 0 127] 9 2 10 [6 [0 250] 0 6] 0 2] 8 [9 90 0 63] 9 2 10 [6 7 [0 3] 8 [9 170 0 255] 9 2 10 [6 [7 [0 3] 8 [9 43.898 0 255] 9 2 10 [6 [7 [0 3] [0 124] 0 2] 0 30] 0 2] 7 [0 3] 8 [9 87 0 255] 9 2 10 [6 [7 [0 3] [0 124] 8 [9 379 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 87.798 0 31] 9 2 10 [6 [0 62] 0 14] 0 2] 0 1] 8 [1 0] [1 8 [9 379 0 31] 9 2 10 [6 [7 [0 3] 8 [9 21.948 0 31] 9 2 10 [6 7 [0 3] 8 [9 2.742 0 31] 9 2 10 [6 7 [0 3] 8 [9 2.742 0 31] 9 2 10 [6 0 62] 0 2] 0 2] 0 2] 7 [0 3] 8 [9 90 0 7] 9 2 10 [6 0 14] 0 2] 0 2] 0 1] 8 [1 0] [1 7 [10 [6 8 [9 90 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 6 [8 [9 1.370 0 31] 9 2 10 [6 [0 62] 7 [0 3] 1 3] 0 2] [0 6] 8 [8 [9 21.948 0 31] 9 2 10 [6 0 62] 0 2] 8 [9 170 0 63] 9 2 10 [6 [7 [0 3] 8 [9 43.898 0 63] 9 2 10 [6 [0 6] 7 [0 3] 9 2 10 [30 0 2] 10 [6 8 [9 343 0 63] 9 2 10 [6 [0 6] [7 [0 3] 1 0 1] 0 30] 0 2] 0 3] 0 2] 7 [0 3] 9 2 10 [30 0 2] 10 [6 8 [9 343 0 63] 9 2 10 [6 [0 6] [7 [0 3] 1 1 1] 0 30] 0 2] 0 3] 0 2] 0 1] 0 1] [8 [1 0 0 [0 15] 0 0 0] [1 8 [9 383 0 7] 9 2 10 [6 [0 28] 7 [0 3] 8 [9 22 0 7] 9 2 10 [6 [7 [0 3] 8 [9 684 0 7] 9 2 10 [6 [0 28] 0 58] 0 2] 0 59] 0 2] 0 2] 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 84 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 43.898 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 87.798 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] 9 46 0 1] diff --git a/desk/bar/sha512.noun b/desk/bar/sha512.noun new file mode 100644 index 0000000..235d55f Binary files /dev/null and b/desk/bar/sha512.noun differ diff --git a/desk/bar/sieve.hoon b/desk/bar/sieve.hoon index de9fab8..7a908a0 100644 --- a/desk/bar/sieve.hoon +++ b/desk/bar/sieve.hoon @@ -1,10 +1,7 @@ -/+ tiny -:: -=> tiny -:: -:- . +=> m=@ +:- 100.000 != -%. 100.000 +%. m |= n-max=@ ^- @ub :: 0 means prime, 1 means not a prime, @@ -27,11 +24,104 @@ inner-loop(index (add index cursor), out (sew 0 [index 1 1] out)) :: ++ sew - |= [a=bloq [b=step c=step d=@] e=@] + |= [a=@ [b=@ c=@ d=@] e=@] ^- @ %+ add - (can a b^e c^d ~) + (can a [b e] [c d] ~) =/ f [a (add b c)] (lsh f (rsh f e)) :: +++ dec + |= a=@ + ?< =(0 a) + =+ b=0 + |- ^- @ + ?: =(a +(b)) b + $(b +(b)) +:: +++ add + |= [a=@ b=@] + ^- @ + ?: =(0 a) b + $(a (dec a), b +(b)) +:: +++ sub + |= [a=@ b=@] + ^- @ + ?: =(0 b) a + $(a (dec a), b (dec b)) +:: +++ mul + |= [a=@ b=@] + ^- @ + =+ c=0 + |- + ?: =(0 a) c + $(a (dec a), c (add b c)) +:: +++ gth + |= [a=@ b=@] + ^- ? + !(lte a b) +:: +++ lte + |= [a=@ b=@] + ^- ? + |(=(a b) (lth a b)) +:: +++ lth + |= [a=@ b=@] + ^- ? + ?& !=(a b) + |- + ?: =(0 a) & + ?: =(0 b) | + $(a (dec a), b (dec b)) + == +:: +++ bex + |= a=@ + ^- @ + ?: =(0 a) 1 + (mul 2 $(a (dec a))) +:: +++ lsh + |= [a=$@(@ [@ @]) b=@] + =/ [bl=@ s=@] ?^(a a [a 1]) + (mul b (bex (mul (bex bl) s))) +:: +++ rsh + |= [a=$@(@ [@ @]) b=@] + =/ [bl=@ s=@] ?^(a a [a 1]) + (div b (bex (mul (bex bl) s))) +:: +++ div + |= [a=@ b=@] + ^- @ + ?< =(0 b) + =+ c=0 + |- + ?: (lth a b) c + $(a (sub a b), c +(c)) +:: +++ cut + |= [a=@ [b=@ c=@] d=@] + (end [a c] (rsh [a b] d)) +:: +++ end + |= [a=$@(@ [@ @]) b=@] + =/ [bl=@ s=@] ?^(a a [a 1]) + (mod b (bex (mul (bex bl) s))) +:: +++ mod + |= [a=@ b=@] + ^- @ + ?< =(0 b) + (sub a (mul b (div a b))) +:: +++ can + |= [a=@ b=*] + ^- @ + ?~ b 0 + (add (end [a `@`-.-.b] `@`+.-.b) (lsh [a `@`-.-.b] $(b +.b))) -- diff --git a/desk/bar/sieve.nock b/desk/bar/sieve.nock index 369aeb1..9837413 100644 --- a/desk/bar/sieve.nock +++ b/desk/bar/sieve.nock @@ -1 +1 @@ -[[[[7 [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] 11 [1.953.718.630 1 7.107.949 [0 7] 0] 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 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] 11 [1.953.718.630 1 1.734.438.515 [0 7] 0] 0 1] [[7 [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] 11 [1.953.718.630 1 6.648.940 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 1.886.152.055 [0 7] 0] 0 1] 7 [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] 11 [1.953.718.630 1 1.953.391.980 [0 7] 0] 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 2.810 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] 7 [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 5.622 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] 0 1] 0 1] 11 [1.953.718.630 1 7.367.026 [0 7] 0] 0 1] [7 [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 5.622 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 5.622 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] 11 [1.953.718.630 1 7.891.309 [0 7] 0] 0 1] [[7 [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] 11 [1.953.718.630 1 6.579.297 [0 7] 0] 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 2.810 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] [[7 [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] 11 [1.953.718.630 1 1.734.438.003 [0 7] 0] 0 1] [7 [8 [7 [8 [9 2.810 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 [7 [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] 11 [1.953.718.630 1 7.632.240 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 7.103.844 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 7.628.135 [0 7] 0] 0 1] 7 [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] 11 [1.953.718.630 1 7.630.945 [0 7] 0] 0 1] 9 2 0 1] 0 1] 11 [1.953.718.630 1 31.074 [0 7] 0] 0 1] [[7 [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] 11 [1.953.718.630 1 7.501.412 [0 7] 0] 0 1] [8 [7 [8 [9 2.810 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 2.810 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] 7 [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] 11 [1.953.718.630 1 6.845.292 [0 7] 0] 0 1] [7 [8 [7 [7 [9 2.810 0 1] 9 2 0 1] 9 2 0 1] [1 [7 [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] 11 [1.953.718.630 1 7.632.240 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 7.103.844 [0 7] 0] 0 1] 7 [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] 11 [1.953.718.630 1 7.630.945 [0 7] 0] 0 1] 9 2 0 1] 0 1] 11 [1.953.718.630 1 28.265 [0 7] 0] 0 1] 7 [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] 11 [1.953.718.630 1 1.886.350.438 [0 7] 0] 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] [[7 [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] 11 [1.953.718.630 1 7.760.228 [0 7] 0] 0 1] [[7 [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] 11 [1.953.718.630 1 6.514.020 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 6.581.861 [0 7] 0] 0 1] 7 [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] 11 [1.953.718.630 1 6.845.548 [0 7] 0] 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] [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 5.622 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] [7 [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 5.622 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 5.622 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] 11 [1.953.718.630 1 7.237.475 [0 7] 0] 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] [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] 11 [1.953.718.630 1 7.890.274 [0 7] 0] 0 1] 8 [1 0] [1 0 6] 0 1] [7 [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 5.622 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] [7 [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 5.622 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] 11 [1.953.718.630 1 6.780.269 [0 7] 0] 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 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 5.622 0 31] 9 2 10 [6 [7 [0 3] 1 0] 0 124] 0 2] 8 [9 5.622 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] 11 [1.953.718.630 1 7.563.620 [0 7] 0] 0 1] [[7 [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] 11 [1.953.718.630 1 7.370.611 [0 7] 0] 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 2.810 0 7] 9 2 10 [6 0 14] 0 2] 9 2 10 [6 0 58] 0 2] 8 [7 [0 7] 8 [9 2.810 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] [7 [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] 11 [1.953.718.630 1 6.845.298 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 6.578.531 [0 7] 0] 0 1] [7 [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 5.622 0 63] 9 2 10 [6 [7 [0 3] 1 3] 0 252] 0 2] 8 [9 5.622 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] 11 [1.953.718.630 1 7.499.632 [0 7] 0] 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] 7 [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] 11 [1.953.718.630 1 6.845.543 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 7.627.107 [0 7] 0] 0 1] [[7 [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] 11 [1.953.718.630 1 7.499.623 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 1.885.431.154 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 7.499.620 [0 7] 0] 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] [7 [8 [[7 [9 22.495 0 1] 9 2 0 1] 7 [9 22.495 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] 7 [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 8 [1 [7 [8 [[7 [8 [9 2.810 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] 11 [1.953.718.630 1 7.632.240 [0 7] 0] 0 1] [7 [8 [[7 [8 [9 2.810 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] 11 [1.953.718.630 1 7.628.135 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 7.630.945 [0 7] 0] 0 1] 7 [8 [[7 [8 [9 2.810 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] 11 [1.953.718.630 1 7.561.576 [0 7] 0] 0 1] 11 [1.953.718.630 1 1.701.998.435 [0 3] 0] 0 1] 0 1] 11 [1.953.718.630 1 1.886.220.131 [0 15] 0] 0 1] 0 1] 11 [1.953.718.630 1 28.271 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 6.582.125 [0 7] 0] 0 1] 7 [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] 11 [1.953.718.630 1 7.233.891 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 6.648.935 [0 7] 0] 0 1] [7 [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] 11 [1.953.718.630 1 7.499.629 [0 7] 0] 0 1] [[7 [8 [8 [9 1.531 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 5.622 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 5.622 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 5.622 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] 11 [1.953.718.630 1 7.042.413 [0 59] 0] 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] 7 [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] 11 [1.953.718.630 1 6.452.595 [0 7] 0] 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 5.622 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] 7 [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] 11 [1.953.718.630 1 7.366.002 [0 7] 0] 0 1] 3.159.393] 8 [8 [1 0] [1 8 [1 [8 [1 0 [1 1 0] 0] [1 8 [9 348 0 63] 9 2 10 [6 [7 [0 3] 8 [9 6.015 0 63] 9 2 10 [6 [0 28] [7 [0 3] [0 52] 0 27] [7 [0 3] [0 106] 0 107] 7 [0 3] 1 0] 0 2] 7 [0 3] 8 [[0 12] 8 [9 348 0 63] 9 2 10 [6 [0 116] 0 234] 0 2] 8 [9 179.035 0 127] 9 2 10 [6 [0 6] 7 [0 3] 8 [9 5.622 0 127] 9 2 10 [6 [0 6] 0 123] 0 2] 0 2] 0 2] 0 1] 8 [1 3] 8 [1 2] 8 [1 7 [0 1] 6 [5 [0 6] 0 126] [0 14] 6 [5 [1 1] 8 [9 11.198 0 127] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] [0 6] 1 1] 0 30] 0 2] [9 2 10 [6 4 0 6] 0 1] 8 [8 [9 4 0 127] 9 2 10 [6 [0 14] 0 14] 0 2] 8 [1 7 [0 1] 6 [8 [9 703 0 511] 9 2 10 [6 [0 14] 0 1.022] 0 2] [9 2 10 [6 4 0 30] 0 7] 9 2 10 [62 8 [9 4 0 63] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] [0 6] 1 1 1] 0 126] 0 2] 10 [6 8 [9 348 0 511] 9 2 10 [6 [0 14] 0 62] 0 2] 0 1] 9 2 0 1] 9 2 0 1] 9 5 0 1] 0 1] 9 2 10 [6 7 [0 3] 1 100.000] 0 2] \ No newline at end of file +[100.000 8 [8 [1 0] [1 8 [1 [8 [1 0 0] [1 8 [1 0] 8 [1 6 [5 [1 0] 0 60] [0 6] 9 2 10 [60 8 [9 1.374 0 31] 9 2 10 [6 0 124] 0 2] 10 [6 8 [9 20 0 31] 9 2 10 [6 [0 125] 0 14] 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 1.374 0 7] 9 2 10 [6 0 28] 0 2] 4 0 13] 0 1] 0 1] [[8 [1 0 [0 0] 0] [1 8 [9 5.502 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 53] 7 [0 3] 8 [9 87 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 59] 0 2] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [0 12] 0 13] [1 0] 6 [8 [9 5.503 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 0] 1 1] 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 1.374 0 7] 9 2 10 [6 0 14] 0 2] 0 1] 0 2] 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [1 0] 8 [1 6 [8 [9 5.503 0 31] 9 2 10 [6 [0 124] 0 125] 0 2] [0 6] 9 2 10 [60 8 [9 191 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 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 4 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 342 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 342 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 [6 [6 [3 0 12] [1 1] 1 0] [[0 12] 1 1] 0 12] 8 [9 94 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 342 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 342 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 [5 [1 0] 0 29] [1 1] 9 2 10 [14 [8 [9 1.374 0 15] 9 2 10 [6 0 60] 0 2] 8 [9 1.374 0 15] 9 2 10 [6 0 61] 0 2] 0 1] 9 2 0 1] [1 0] 1 1] 1 1] 0 1] [8 [1 0 0] [1 6 [8 [9 170 0 7] 9 2 10 [6 [0 28] 0 29] 0 2] [1 1] 1 0] 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 686 0 15] 9 2 10 [6 [0 61] 7 [0 3] 8 [9 342 0 15] 9 2 10 [6 7 [0 3] 8 [9 4 0 15] 9 2 10 [6 [7 [0 3] 8 [9 342 0 15] 9 2 10 [6 0 12] 0 2] 0 13] 0 2] 0 2] 0 2] 0 1] [8 [1 0 [0 0 0] 0] [1 8 [9 20 0 7] 9 2 10 [6 [7 [0 3] 8 [9 190 0 7] 9 2 10 [6 [0 28] [7 [0 3] [0 52] 0 27] [7 [0 3] [0 106] 0 107] 7 [0 3] 1 0] 0 2] 7 [0 3] 8 [[0 12] 8 [9 20 0 7] 9 2 10 [6 [0 116] 0 234] 0 2] 8 [9 2.750 0 15] 9 2 10 [6 [0 6] 7 [0 3] 8 [9 87 0 15] 9 2 10 [6 [0 6] 0 123] 0 2] 0 2] 0 2] 0 1] [8 [1 3] 8 [1 2] 8 [1 7 [0 1] 6 [5 [0 6] 0 126] [0 14] 6 [5 [1 1] 8 [9 84 0 15] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] [0 6] 1 1] 0 30] 0 2] [9 2 10 [6 4 0 6] 0 1] 8 [8 [9 4 0 15] 9 2 10 [6 [0 14] 0 14] 0 2] 8 [1 7 [0 1] 6 [8 [9 86 0 63] 9 2 10 [6 [0 14] 0 1.022] 0 2] [9 2 10 [6 4 0 30] 0 7] 9 2 10 [62 8 [9 22 0 63] 9 2 10 [6 [7 [0 3] 1 0] [7 [0 3] [0 6] 1 1 1] 0 126] 0 2] 10 [6 8 [9 20 0 63] 9 2 10 [6 [0 14] 0 62] 0 2] 0 1] 9 2 0 1] 9 2 0 1] [8 [1 0 0] [1 6 [5 [1 0] 0 13] [0 0] 8 [9 191 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 686 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 20 0 7] 9 2 10 [6 [7 [0 3] 8 [9 5.502 0 7] 9 2 10 [6 [7 [0 3] [0 12] 0 52] 0 117] 0 2] 7 [0 3] 8 [9 2.750 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 [5 [1 0] 0 13] [0 12] 9 2 10 [6 [8 [9 1.374 0 7] 9 2 10 [6 0 28] 0 2] 8 [9 1.374 0 7] 9 2 10 [6 0 29] 0 2] 0 1] 0 1] 9 46 0 1] 0 1] 9 2 10 [6 0 3] 0 2] diff --git a/desk/bar/sieve.noun b/desk/bar/sieve.noun index 7582cfa..dc320ce 100644 Binary files a/desk/bar/sieve.noun and b/desk/bar/sieve.noun differ diff --git a/desk/bar/tests.json b/desk/bar/tests.json new file mode 100644 index 0000000..bcf1ae5 --- /dev/null +++ b/desk/bar/tests.json @@ -0,0 +1,91 @@ +[ + { + "name": "ackermann", + "description": "Ackermann function ack(3,6)", + "subject": "[3 6]", + "default_subject": "[3 6]", + "result": "509" + }, + { + "name": "add", + "description": "Naive addition 1000 + 2000", + "subject": "[1.000 2.000]", + "default_subject": "[1.000 2.000]", + "result": "3.000" + }, + { + "name": "dec", + "description": "Naive decrement of 100", + "subject": "100", + "default_subject": "1.000.000", + "result": "99" + }, + { + "name": "factorial", + "description": "Factorial of 5 (tail-recursive)", + "subject": "5", + "default_subject": "40", + "result": "120" + }, + { + "name": "fibonacci", + "description": "Fibonacci of 10 (naive recursive)", + "subject": "10", + "default_subject": "10", + "result": "55" + }, + { + "name": "bigslot", + "description": "Deep tree addressing: axis 100 of list of 100 nulls", + "subject": "0", + "default_subject": "0", + "result": "0" + }, + { + "name": "atomcat", + "description": "Arithmetic on 16-bit atoms (add, sub, mul, div, mod)", + "subject": "0", + "default_subject": "0", + "result": "[98.303 32.767 2.147.450.880 1 32.767]", + "note": "Hardcoded inputs: m=2^16-1, n=2^15. Result computed via stdlib." + }, + { + "name": "atomdog", + "description": "Arithmetic on 32-bit atoms (add, sub, mul, div, mod)", + "subject": "0", + "default_subject": "0", + "result": "[6.442.450.943 2.147.483.647 9.223.372.034.707.292.160 1 2.147.483.647]", + "note": "Hardcoded inputs: m=2^32-1, n=2^31. Result computed via stdlib." + }, + { + "name": "atomgmp", + "description": "Arithmetic on 128-bit atoms (add, sub, mul, div, mod)", + "subject": "0", + "default_subject": "0", + "result": "[ 510.423.550.381.407.695.195.061.911.147.652.317.183 170.141.183.460.469.231.731.687.303.715.884.105.727 57.896.044.618.658.097.711.785.492.504.343.953.926.464.851.149.359.812.787.997.104.700.240.680.714.240 1 170.141.183.460.469.231.731.687.303.715.884.105.727 ]", + "note": "Hardcoded inputs: m=2^128-1, n=2^127. Result computed via stdlib." + }, + { + "name": "mmul", + "description": "3x3 matrix multiplication", + "subject": "3", + "default_subject": "10", + "result": "[[30 24 18 0] [84 69 54 0] [138 114 90 0] 0]" + }, + { + "name": "sha512", + "description": "SHA-512 hash of 'abc' (3 bytes)", + "subject": "0", + "default_subject": "0", + "result": "11.610.554.759.577.678.887.058.616.627.522.426.787.358.414.133.166.247.019.097.754.655.123.425.531.747.192.578.669.846.860.198.531.688.061.507.751.898.313.498.051.436.198.428.987.376.028.989.280.584.770.719", + "note": "Known test vector: SHA-512('abc'). Result computed from spec." + }, + { + "name": "sieve", + "description": "Sieve of Eratosthenes up to 30", + "subject": "30", + "default_subject": "100.000", + "result": "1.601.558.355", + "note": "Result computed via stdlib; too slow in pure Nock." + } +] diff --git a/norm/README.md b/norm/README.md new file mode 100644 index 0000000..73ea2d8 --- /dev/null +++ b/norm/README.md @@ -0,0 +1,50 @@ +# Nock Reference Tests + +Machine-legible test vectors for validating Nock 4K runtime implementations. Each test is a triple of subject, formula, and expected result covering all twelve opcodes (0–11) and auto-cons. + +## Files + +- `tests.json` — Canonical test data. Each entry has fields: + - `opcode` — integer 0–11 or `"autocons"` + - `description` — human-readable explanation + - `subject` — Nock noun (as a string in standard notation) + - `formula` — Nock formula (as a string) + - `result` — expected product (as a string), or `null` for crash + - `hoon` — equivalent Hoon expression (optional, may be `null`) +- `REFERENCE.md` — Generated Markdown table (do not edit by hand). +- `generate.py` — Regenerates `REFERENCE.md` from `tests.json`. +- `validate.py` — Validates every test against a live Nock runtime. + +## Usage + +### Generate the reference table + +``` +python3 norm/generate.py +``` + +### Validate against a runtime + +``` +python3 norm/validate.py --urbit ~/bin/urbit --verbose +``` + +The validator runs each test as `.*(subject formula)` via `urbit eval` and compares the output. Tests with `result: null` expect the runtime to bail (crash). + +By default the script looks for `~/bin/urbit` or `urbit` on `$PATH`. + +### Crash convention + +A `null` result means the expression is undefined per the Nock 4K spec. The reduction rules have no matching pattern, so a conforming runtime must crash (not produce a value). Common examples: + +- `*[a 0 0]` — axis 0 is undefined +- `+[a b]` — increment of a cell +- `*[a 6 b c d]` where `*[a b]` is not 0 or 1 + +### Noun printing + +Results use right-associative flattening: `[a [b c]]` is printed as `[a b c]`. This matches Urbit's canonical noun printer. + +## Spec + +These tests target [Nock 4K](https://nock.is/content/specification/index.html). diff --git a/norm/REFERENCE.md b/norm/REFERENCE.md new file mode 100644 index 0000000..b1c23ef --- /dev/null +++ b/norm/REFERENCE.md @@ -0,0 +1,176 @@ +# Nock Reference Tests + +*Auto-generated from `tests.json` — do not edit by hand.* + +Each row is a triple of **subject**, **formula**, and expected **result**. A result of **crash** means the expression is undefined per the Nock spec and a conforming runtime must not produce a value. + +## Contents + +- [Auto-cons (distribution)](#auto-cons-distribution) +- [Nock 0 — Slot (tree addressing)](#nock-0-slot-tree-addressing) +- [Nock 1 — Constant](#nock-1-constant) +- [Nock 2 — Evaluate](#nock-2-evaluate) +- [Nock 3 — Cell test](#nock-3-cell-test) +- [Nock 4 — Increment](#nock-4-increment) +- [Nock 5 — Equality](#nock-5-equality) +- [Nock 6 — If-then-else](#nock-6-if-then-else) +- [Nock 7 — Compose](#nock-7-compose) +- [Nock 8 — Push](#nock-8-push) +- [Nock 9 — Invoke](#nock-9-invoke) +- [Nock 10 — Edit](#nock-10-edit) +- [Nock 11 — Hint](#nock-11-hint) + +## Auto-cons (distribution) + +Spec: `*[a [b c] d]` → `[*[a b c] *[a d]]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | distribution over a cell of formulas | `42` | `[[4 0 1] [0 1]]` | `[43 42]` | `[.+(.) .]` | +| 2 | nested distribution | `[1 2]` | `[[0 2] [0 3] [0 1]]` | `[1 2 1 2]` | `[- + .]` | + +## Nock 0 — Slot (tree addressing) + +Spec: `*[a 0 b]` → `/[b a]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | axis 1 returns the whole subject | `42` | `[0 1]` | `42` | `.` | +| 2 | axis 2 returns the head | `[1 2]` | `[0 2]` | `1` | `-` | +| 3 | axis 3 returns the tail | `[1 2]` | `[0 3]` | `2` | `+` | +| 4 | axis 4 returns the head of the head | `[[1 2] [3 4]]` | `[0 4]` | `1` | `-.-` | +| 5 | axis 5 returns the tail of the head | `[[1 2] [3 4]]` | `[0 5]` | `2` | `+.-` | +| 6 | axis 6 returns the head of the tail | `[[1 2] [3 4]]` | `[0 6]` | `3` | `-.+` | +| 7 | axis 7 returns the tail of the tail | `[[1 2] [3 4]]` | `[0 7]` | `4` | `+.+` | +| 8 | deep addressing (axis 12) | `[[[1 2] [3 4]] [[5 6] [7 8]]]` | `[0 12]` | `5` | `-.-.+` | +| 9 | deep addressing (axis 15) | `[[[1 2] [3 4]] [[5 6] [7 8]]]` | `[0 15]` | `8` | `+.+.+` | +| 10 | axis 0 crashes (undefined) | `42` | `[0 0]` | **crash** | | +| 11 | addressing into atom crashes | `[1 2]` | `[0 6]` | **crash** | | + +## Nock 1 — Constant + +Spec: `*[a 1 b]` → `b` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | constant atom | `42` | `[1 0]` | `0` | | +| 2 | constant atom, subject ignored | `42` | `[1 57]` | `57` | | +| 3 | constant cell | `0` | `[1 [1 2]]` | `[1 2]` | | +| 4 | constant deep cell | `0` | `[1 [[1 2] [3 4]]]` | `[[1 2] 3 4]` | | +| 5 | subject has no effect on result | `[[99 100] [101 102]]` | `[1 0]` | `0` | | + +## Nock 2 — Evaluate + +Spec: `*[a 2 b c]` → `*[*[a b] *[a c]]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | evaluate with computed subject and formula | `42` | `[2 [0 1] [1 [4 0 1]]]` | `43` | | +| 2 | evaluate constant subject and formula | `0` | `[2 [1 [1 2]] [1 [1 3]]]` | `3` | | +| 3 | evaluate with subject from slot | `[[4 0 1] 99]` | `[2 [0 3] [0 2]]` | `100` | | +| 4 | nested evaluate | `42` | `[2 [1 0] [1 [4 0 1]]]` | `1` | | + +## Nock 3 — Cell test + +Spec: `*[a 3 b]` → `?*[a b]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | cell test on cell yields 0 (yes) | `[1 2]` | `[3 [0 1]]` | `0` | `.?([1 2])` | +| 2 | cell test on atom yields 1 (no) | `42` | `[3 [0 1]]` | `1` | `.?(42)` | +| 3 | cell test on computed cell | `0` | `[3 [1 [1 2]]]` | `0` | | +| 4 | cell test on computed atom | `0` | `[3 [1 42]]` | `1` | | + +## Nock 4 — Increment + +Spec: `*[a 4 b]` → `+*[a b]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | increment atom | `42` | `[4 0 1]` | `43` | `.+(42)` | +| 2 | increment zero | `0` | `[4 0 1]` | `1` | `.+(0)` | +| 3 | increment computed value | `[1 2]` | `[4 0 3]` | `3` | `.+(+:[1 2])` | +| 4 | double increment via composition | `0` | `[4 4 0 1]` | `2` | `.+(.+(0))` | +| 5 | increment cell crashes | `[1 2]` | `[4 0 1]` | **crash** | | + +## Nock 5 — Equality + +Spec: `*[a 5 b c]` → `=[*[a b] *[a c]]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | equal atoms yield 0 (yes) | `42` | `[5 [0 1] [0 1]]` | `0` | `.=(42 42)` | +| 2 | unequal atoms yield 1 (no) | `42` | `[5 [0 1] [1 43]]` | `1` | `.=(42 43)` | +| 3 | equal cells yield 0 | `[[1 2] [1 2]]` | `[5 [0 2] [0 3]]` | `0` | `.=([1 2] [1 2])` | +| 4 | unequal cells yield 1 | `[[1 2] [3 4]]` | `[5 [0 2] [0 3]]` | `1` | `.=([1 2] [3 4])` | +| 5 | atom vs cell yields 1 | `[42 [1 2]]` | `[5 [0 2] [0 3]]` | `1` | `.=(42 [1 2])` | + +## Nock 6 — If-then-else + +Spec: `*[a 6 b c d]` → if `*[a b]` = 0 then `*[a c]`, if 1 then `*[a d]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | branch on 0 takes the true arm | `42` | `[6 [1 0] [1 1] [1 2]]` | `1` | `?:(& 1 2)` | +| 2 | branch on 1 takes the false arm | `42` | `[6 [1 1] [1 1] [1 2]]` | `2` | `?:(| 1 2)` | +| 3 | branch with computed test (cell test) | `[1 2]` | `[6 [3 [0 1]] [1 99] [0 2]]` | `99` | `?:(.?([1 2]) 99 -:[1 2])` | +| 4 | branch with computed test (atom case) | `42` | `[6 [3 [0 1]] [1 99] [0 1]]` | `42` | | +| 5 | non-boolean test crashes | `42` | `[6 [1 2] [1 1] [1 2]]` | **crash** | | + +## Nock 7 — Compose + +Spec: `*[a 7 b c]` → `*[*[a b] c]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | compose two increments | `42` | `[7 [4 0 1] [4 0 1]]` | `44` | `=>(42 =>(+(.) +(.) ))` | +| 2 | compose slot then increment | `[1 2]` | `[7 [0 2] [4 0 1]]` | `2` | | +| 3 | compose constant then slot | `42` | `[7 [1 [1 2]] [0 2]]` | `1` | | +| 4 | triple composition | `0` | `[7 [4 0 1] [7 [4 0 1] [4 0 1]]]` | `3` | | + +## Nock 8 — Push + +Spec: `*[a 8 b c]` → `*[[*[a b] a] c]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | push value, read it from head | `42` | `[8 [4 0 1] [0 2]]` | `43` | `=+(+(.) .)` | +| 2 | push value, read original subject from tail | `42` | `[8 [4 0 1] [0 3]]` | `42` | | +| 3 | push and compare with original | `42` | `[8 [1 0] [5 [0 2] [0 3]]]` | `1` | | +| 4 | push constant, use in formula | `[1 2]` | `[8 [1 99] [0 2]]` | `99` | | +| 5 | push and auto-cons from augmented subject | `42` | `[8 [4 0 1] [[0 2] [0 3]]]` | `[43 42]` | | + +## Nock 9 — Invoke + +Spec: `*[a 9 b c]` → `*[*[a c] 2 [0 1] 0 b]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | invoke arm in a simple core | `0` | `[9 2 [1 [[4 0 3] 42]]]` | `43` | | +| 2 | invoke identity arm | `0` | `[9 2 [1 [[0 3] 99]]]` | `99` | | +| 3 | invoke with modified payload via Nock 10 | `0` | `[9 2 [10 [3 [1 7]] [1 [[4 0 3] 42]]]]` | `8` | | +| 4 | invoke on pre-built core from subject | `[[4 0 3] 0]` | `[9 2 [0 1]]` | `1` | | + +## Nock 10 — Edit + +Spec: `*[a 10 [b c] d]` → `#[b *[a c] *[a d]]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | edit head of a cell | `[1 2]` | `[10 [2 [1 3]] [0 1]]` | `[3 2]` | | +| 2 | edit tail of a cell | `[1 2]` | `[10 [3 [1 3]] [0 1]]` | `[1 3]` | | +| 3 | edit axis 1 replaces entire noun | `[1 2]` | `[10 [1 [1 99]] [0 1]]` | `99` | | +| 4 | deep edit at axis 4 | `[[1 2] [3 4]]` | `[10 [4 [1 99]] [0 1]]` | `[[99 2] 3 4]` | | +| 5 | deep edit at axis 7 | `[[1 2] [3 4]]` | `[10 [7 [1 99]] [0 1]]` | `[[1 2] 3 99]` | | + +## Nock 11 — Hint + +Spec: `*[a 11 [b c] d]` → `*[[*[a c] *[a d]] 0 3]` +`*[a 11 b c]` → `*[a c]` + +| # | Description | Subject | Formula | Result | Hoon | +|---|-------------|---------|---------|--------|------| +| 1 | static hint is transparent | `42` | `[11 1 [4 0 1]]` | `43` | `~>(1 .+(42))` | +| 2 | static hint with different tag | `[1 2]` | `[11 37 [0 2]]` | `1` | | +| 3 | dynamic hint evaluates and discards clue | `42` | `[11 [1 [1 0]] [4 0 1]]` | `43` | | +| 4 | dynamic hint clue does not affect result | `[1 2]` | `[11 [1 [4 0 2]] [0 3]]` | `2` | | diff --git a/norm/generate.py b/norm/generate.py new file mode 100644 index 0000000..ea87fde --- /dev/null +++ b/norm/generate.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 +"""Generate REFERENCE.md from tests.json. + +Usage: + python3 norm/generate.py +""" + +import json +import os +from collections import OrderedDict + +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +TESTS_PATH = os.path.join(SCRIPT_DIR, "tests.json") +OUTPUT_PATH = os.path.join(SCRIPT_DIR, "REFERENCE.md") + +OPCODE_NAMES = OrderedDict([ + ("autocons", "Auto-cons (distribution)"), + (0, "Nock 0 — Slot (tree addressing)"), + (1, "Nock 1 — Constant"), + (2, "Nock 2 — Evaluate"), + (3, "Nock 3 — Cell test"), + (4, "Nock 4 — Increment"), + (5, "Nock 5 — Equality"), + (6, "Nock 6 — If-then-else"), + (7, "Nock 7 — Compose"), + (8, "Nock 8 — Push"), + (9, "Nock 9 — Invoke"), + (10, "Nock 10 — Edit"), + (11, "Nock 11 — Hint"), +]) + +SPEC_LINES = { + "autocons": "`*[a [b c] d]` → `[*[a b c] *[a d]]`", + 0: "`*[a 0 b]` → `/[b a]`", + 1: "`*[a 1 b]` → `b`", + 2: "`*[a 2 b c]` → `*[*[a b] *[a c]]`", + 3: "`*[a 3 b]` → `?*[a b]`", + 4: "`*[a 4 b]` → `+*[a b]`", + 5: "`*[a 5 b c]` → `=[*[a b] *[a c]]`", + 6: "`*[a 6 b c d]` → if `*[a b]` = 0 then `*[a c]`, if 1 then `*[a d]`", + 7: "`*[a 7 b c]` → `*[*[a b] c]`", + 8: "`*[a 8 b c]` → `*[[*[a b] a] c]`", + 9: "`*[a 9 b c]` → `*[*[a c] 2 [0 1] 0 b]`", + 10: "`*[a 10 [b c] d]` → `#[b *[a c] *[a d]]`", + 11: "`*[a 11 [b c] d]` → `*[[*[a c] *[a d]] 0 3]` \n`*[a 11 b c]` → `*[a c]`", +} + + +def load_tests(): + with open(TESTS_PATH) as f: + return json.load(f) + + +def group_by_opcode(tests): + groups = OrderedDict() + for t in tests: + op = t["opcode"] + groups.setdefault(op, []).append(t) + return groups + + +def fmt_result(result): + if result is None: + return "**crash**" + return f"`{result}`" + + +def fmt_hoon(hoon): + if hoon is None: + return "" + return f"`{hoon}`" + + +def generate(): + tests = load_tests() + groups = group_by_opcode(tests) + + lines = [] + lines.append("# Nock Reference Tests") + lines.append("") + lines.append("*Auto-generated from `tests.json` — do not edit by hand.*") + lines.append("") + lines.append("Each row is a triple of **subject**, **formula**, and expected " + "**result**. A result of **crash** means the expression is " + "undefined per the Nock spec and a conforming runtime must not " + "produce a value.") + lines.append("") + + # Table of contents + lines.append("## Contents") + lines.append("") + for op in OPCODE_NAMES: + anchor = OPCODE_NAMES[op].lower().replace(" ", "-").replace("—", "").replace("(", "").replace(")", "") + anchor = anchor.replace("--", "-").strip("-") + lines.append(f"- [{OPCODE_NAMES[op]}](#{anchor})") + lines.append("") + + for op, name in OPCODE_NAMES.items(): + cases = groups.get(op, []) + lines.append(f"## {name}") + lines.append("") + if op in SPEC_LINES: + lines.append(f"Spec: {SPEC_LINES[op]}") + lines.append("") + + lines.append("| # | Description | Subject | Formula | Result | Hoon |") + lines.append("|---|-------------|---------|---------|--------|------|") + + for i, t in enumerate(cases, 1): + desc = t["description"] + # Strip the "Nock N: " or "Auto-cons: " prefix for brevity + for prefix in [f"Nock {op}: ", "Auto-cons: "]: + if desc.startswith(prefix): + desc = desc[len(prefix):] + break + row = ( + f"| {i} " + f"| {desc} " + f"| `{t['subject']}` " + f"| `{t['formula']}` " + f"| {fmt_result(t['result'])} " + f"| {fmt_hoon(t.get('hoon'))} |" + ) + lines.append(row) + + lines.append("") + + md = "\n".join(lines) + with open(OUTPUT_PATH, "w") as f: + f.write(md) + + print(f"Wrote {OUTPUT_PATH} ({len(tests)} test cases)") + + +if __name__ == "__main__": + generate() diff --git a/norm/tests.json b/norm/tests.json new file mode 100644 index 0000000..952da49 --- /dev/null +++ b/norm/tests.json @@ -0,0 +1,518 @@ +[ + { + "opcode": "autocons", + "description": "Auto-cons: distribution over a cell of formulas", + "subject": "42", + "formula": "[[4 0 1] [0 1]]", + "result": "[43 42]", + "hoon": "[.+(.) .]" + }, + { + "opcode": "autocons", + "description": "Auto-cons: nested distribution", + "subject": "[1 2]", + "formula": "[[0 2] [0 3] [0 1]]", + "result": "[1 2 1 2]", + "hoon": "[- + .]" + }, + + { + "opcode": 0, + "description": "Nock 0: axis 1 returns the whole subject", + "subject": "42", + "formula": "[0 1]", + "result": "42", + "hoon": "." + }, + { + "opcode": 0, + "description": "Nock 0: axis 2 returns the head", + "subject": "[1 2]", + "formula": "[0 2]", + "result": "1", + "hoon": "-" + }, + { + "opcode": 0, + "description": "Nock 0: axis 3 returns the tail", + "subject": "[1 2]", + "formula": "[0 3]", + "result": "2", + "hoon": "+" + }, + { + "opcode": 0, + "description": "Nock 0: axis 4 returns the head of the head", + "subject": "[[1 2] [3 4]]", + "formula": "[0 4]", + "result": "1", + "hoon": "-.-" + }, + { + "opcode": 0, + "description": "Nock 0: axis 5 returns the tail of the head", + "subject": "[[1 2] [3 4]]", + "formula": "[0 5]", + "result": "2", + "hoon": "+.-" + }, + { + "opcode": 0, + "description": "Nock 0: axis 6 returns the head of the tail", + "subject": "[[1 2] [3 4]]", + "formula": "[0 6]", + "result": "3", + "hoon": "-.+" + }, + { + "opcode": 0, + "description": "Nock 0: axis 7 returns the tail of the tail", + "subject": "[[1 2] [3 4]]", + "formula": "[0 7]", + "result": "4", + "hoon": "+.+" + }, + { + "opcode": 0, + "description": "Nock 0: deep addressing (axis 12)", + "subject": "[[[1 2] [3 4]] [[5 6] [7 8]]]", + "formula": "[0 12]", + "result": "5", + "hoon": "-.-.+" + }, + { + "opcode": 0, + "description": "Nock 0: deep addressing (axis 15)", + "subject": "[[[1 2] [3 4]] [[5 6] [7 8]]]", + "formula": "[0 15]", + "result": "8", + "hoon": "+.+.+" + }, + { + "opcode": 0, + "description": "Nock 0: axis 0 crashes (undefined)", + "subject": "42", + "formula": "[0 0]", + "result": null, + "hoon": null + }, + { + "opcode": 0, + "description": "Nock 0: addressing into atom crashes", + "subject": "[1 2]", + "formula": "[0 6]", + "result": null, + "hoon": null + }, + + { + "opcode": 1, + "description": "Nock 1: constant atom", + "subject": "42", + "formula": "[1 0]", + "result": "0", + "hoon": null + }, + { + "opcode": 1, + "description": "Nock 1: constant atom, subject ignored", + "subject": "42", + "formula": "[1 57]", + "result": "57", + "hoon": null + }, + { + "opcode": 1, + "description": "Nock 1: constant cell", + "subject": "0", + "formula": "[1 [1 2]]", + "result": "[1 2]", + "hoon": null + }, + { + "opcode": 1, + "description": "Nock 1: constant deep cell", + "subject": "0", + "formula": "[1 [[1 2] [3 4]]]", + "result": "[[1 2] 3 4]", + "hoon": null + }, + { + "opcode": 1, + "description": "Nock 1: subject has no effect on result", + "subject": "[[99 100] [101 102]]", + "formula": "[1 0]", + "result": "0", + "hoon": null + }, + + { + "opcode": 2, + "description": "Nock 2: evaluate with computed subject and formula", + "subject": "42", + "formula": "[2 [0 1] [1 [4 0 1]]]", + "result": "43", + "hoon": null + }, + { + "opcode": 2, + "description": "Nock 2: evaluate constant subject and formula", + "subject": "0", + "formula": "[2 [1 [1 2]] [1 [1 3]]]", + "result": "3", + "hoon": null + }, + { + "opcode": 2, + "description": "Nock 2: evaluate with subject from slot", + "subject": "[[4 0 1] 99]", + "formula": "[2 [0 3] [0 2]]", + "result": "100", + "hoon": null + }, + { + "opcode": 2, + "description": "Nock 2: nested evaluate", + "subject": "42", + "formula": "[2 [1 0] [1 [4 0 1]]]", + "result": "1", + "hoon": null + }, + + { + "opcode": 3, + "description": "Nock 3: cell test on cell yields 0 (yes)", + "subject": "[1 2]", + "formula": "[3 [0 1]]", + "result": "0", + "hoon": ".?([1 2])" + }, + { + "opcode": 3, + "description": "Nock 3: cell test on atom yields 1 (no)", + "subject": "42", + "formula": "[3 [0 1]]", + "result": "1", + "hoon": ".?(42)" + }, + { + "opcode": 3, + "description": "Nock 3: cell test on computed cell", + "subject": "0", + "formula": "[3 [1 [1 2]]]", + "result": "0", + "hoon": null + }, + { + "opcode": 3, + "description": "Nock 3: cell test on computed atom", + "subject": "0", + "formula": "[3 [1 42]]", + "result": "1", + "hoon": null + }, + + { + "opcode": 4, + "description": "Nock 4: increment atom", + "subject": "42", + "formula": "[4 0 1]", + "result": "43", + "hoon": ".+(42)" + }, + { + "opcode": 4, + "description": "Nock 4: increment zero", + "subject": "0", + "formula": "[4 0 1]", + "result": "1", + "hoon": ".+(0)" + }, + { + "opcode": 4, + "description": "Nock 4: increment computed value", + "subject": "[1 2]", + "formula": "[4 0 3]", + "result": "3", + "hoon": ".+(+:[1 2])" + }, + { + "opcode": 4, + "description": "Nock 4: double increment via composition", + "subject": "0", + "formula": "[4 4 0 1]", + "result": "2", + "hoon": ".+(.+(0))" + }, + { + "opcode": 4, + "description": "Nock 4: increment cell crashes", + "subject": "[1 2]", + "formula": "[4 0 1]", + "result": null, + "hoon": null + }, + + { + "opcode": 5, + "description": "Nock 5: equal atoms yield 0 (yes)", + "subject": "42", + "formula": "[5 [0 1] [0 1]]", + "result": "0", + "hoon": ".=(42 42)" + }, + { + "opcode": 5, + "description": "Nock 5: unequal atoms yield 1 (no)", + "subject": "42", + "formula": "[5 [0 1] [1 43]]", + "result": "1", + "hoon": ".=(42 43)" + }, + { + "opcode": 5, + "description": "Nock 5: equal cells yield 0", + "subject": "[[1 2] [1 2]]", + "formula": "[5 [0 2] [0 3]]", + "result": "0", + "hoon": ".=([1 2] [1 2])" + }, + { + "opcode": 5, + "description": "Nock 5: unequal cells yield 1", + "subject": "[[1 2] [3 4]]", + "formula": "[5 [0 2] [0 3]]", + "result": "1", + "hoon": ".=([1 2] [3 4])" + }, + { + "opcode": 5, + "description": "Nock 5: atom vs cell yields 1", + "subject": "[42 [1 2]]", + "formula": "[5 [0 2] [0 3]]", + "result": "1", + "hoon": ".=(42 [1 2])" + }, + + { + "opcode": 6, + "description": "Nock 6: branch on 0 takes the true arm", + "subject": "42", + "formula": "[6 [1 0] [1 1] [1 2]]", + "result": "1", + "hoon": "?:(& 1 2)" + }, + { + "opcode": 6, + "description": "Nock 6: branch on 1 takes the false arm", + "subject": "42", + "formula": "[6 [1 1] [1 1] [1 2]]", + "result": "2", + "hoon": "?:(| 1 2)" + }, + { + "opcode": 6, + "description": "Nock 6: branch with computed test (cell test)", + "subject": "[1 2]", + "formula": "[6 [3 [0 1]] [1 99] [0 2]]", + "result": "99", + "hoon": "?:(.?([1 2]) 99 -:[1 2])" + }, + { + "opcode": 6, + "description": "Nock 6: branch with computed test (atom case)", + "subject": "42", + "formula": "[6 [3 [0 1]] [1 99] [0 1]]", + "result": "42", + "hoon": null + }, + { + "opcode": 6, + "description": "Nock 6: non-boolean test crashes", + "subject": "42", + "formula": "[6 [1 2] [1 1] [1 2]]", + "result": null, + "hoon": null + }, + + { + "opcode": 7, + "description": "Nock 7: compose two increments", + "subject": "42", + "formula": "[7 [4 0 1] [4 0 1]]", + "result": "44", + "hoon": "=>(42 =>(+(.) +(.) ))" + }, + { + "opcode": 7, + "description": "Nock 7: compose slot then increment", + "subject": "[1 2]", + "formula": "[7 [0 2] [4 0 1]]", + "result": "2", + "hoon": null + }, + { + "opcode": 7, + "description": "Nock 7: compose constant then slot", + "subject": "42", + "formula": "[7 [1 [1 2]] [0 2]]", + "result": "1", + "hoon": null + }, + { + "opcode": 7, + "description": "Nock 7: triple composition", + "subject": "0", + "formula": "[7 [4 0 1] [7 [4 0 1] [4 0 1]]]", + "result": "3", + "hoon": null + }, + + { + "opcode": 8, + "description": "Nock 8: push value, read it from head", + "subject": "42", + "formula": "[8 [4 0 1] [0 2]]", + "result": "43", + "hoon": "=+(+(.) .)" + }, + { + "opcode": 8, + "description": "Nock 8: push value, read original subject from tail", + "subject": "42", + "formula": "[8 [4 0 1] [0 3]]", + "result": "42", + "hoon": null + }, + { + "opcode": 8, + "description": "Nock 8: push and compare with original", + "subject": "42", + "formula": "[8 [1 0] [5 [0 2] [0 3]]]", + "result": "1", + "hoon": null + }, + { + "opcode": 8, + "description": "Nock 8: push constant, use in formula", + "subject": "[1 2]", + "formula": "[8 [1 99] [0 2]]", + "result": "99", + "hoon": null + }, + { + "opcode": 8, + "description": "Nock 8: push and auto-cons from augmented subject", + "subject": "42", + "formula": "[8 [4 0 1] [[0 2] [0 3]]]", + "result": "[43 42]", + "hoon": null + }, + + { + "opcode": 9, + "description": "Nock 9: invoke arm in a simple core", + "subject": "0", + "formula": "[9 2 [1 [[4 0 3] 42]]]", + "result": "43", + "hoon": null + }, + { + "opcode": 9, + "description": "Nock 9: invoke identity arm", + "subject": "0", + "formula": "[9 2 [1 [[0 3] 99]]]", + "result": "99", + "hoon": null + }, + { + "opcode": 9, + "description": "Nock 9: invoke with modified payload via Nock 10", + "subject": "0", + "formula": "[9 2 [10 [3 [1 7]] [1 [[4 0 3] 42]]]]", + "result": "8", + "hoon": null + }, + { + "opcode": 9, + "description": "Nock 9: invoke on pre-built core from subject", + "subject": "[[4 0 3] 0]", + "formula": "[9 2 [0 1]]", + "result": "1", + "hoon": null + }, + + { + "opcode": 10, + "description": "Nock 10: edit head of a cell", + "subject": "[1 2]", + "formula": "[10 [2 [1 3]] [0 1]]", + "result": "[3 2]", + "hoon": null + }, + { + "opcode": 10, + "description": "Nock 10: edit tail of a cell", + "subject": "[1 2]", + "formula": "[10 [3 [1 3]] [0 1]]", + "result": "[1 3]", + "hoon": null + }, + { + "opcode": 10, + "description": "Nock 10: edit axis 1 replaces entire noun", + "subject": "[1 2]", + "formula": "[10 [1 [1 99]] [0 1]]", + "result": "99", + "hoon": null + }, + { + "opcode": 10, + "description": "Nock 10: deep edit at axis 4", + "subject": "[[1 2] [3 4]]", + "formula": "[10 [4 [1 99]] [0 1]]", + "result": "[[99 2] 3 4]", + "hoon": null + }, + { + "opcode": 10, + "description": "Nock 10: deep edit at axis 7", + "subject": "[[1 2] [3 4]]", + "formula": "[10 [7 [1 99]] [0 1]]", + "result": "[[1 2] 3 99]", + "hoon": null + }, + + { + "opcode": 11, + "description": "Nock 11: static hint is transparent", + "subject": "42", + "formula": "[11 1 [4 0 1]]", + "result": "43", + "hoon": "~>(1 .+(42))" + }, + { + "opcode": 11, + "description": "Nock 11: static hint with different tag", + "subject": "[1 2]", + "formula": "[11 37 [0 2]]", + "result": "1", + "hoon": null + }, + { + "opcode": 11, + "description": "Nock 11: dynamic hint evaluates and discards clue", + "subject": "42", + "formula": "[11 [1 [1 0]] [4 0 1]]", + "result": "43", + "hoon": null + }, + { + "opcode": 11, + "description": "Nock 11: dynamic hint clue does not affect result", + "subject": "[1 2]", + "formula": "[11 [1 [4 0 2]] [0 3]]", + "result": "2", + "hoon": null + } +] diff --git a/norm/validate.py b/norm/validate.py new file mode 100644 index 0000000..13afe95 --- /dev/null +++ b/norm/validate.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python3 +"""Validate tests.json against a Nock runtime via `urbit eval`. + +Usage: + python3 norm/validate.py [--urbit /path/to/urbit] [--verbose] + +Each test is evaluated as: + echo '.*( )' | urbit eval + +A test with result null expects the runtime to crash (bail). +""" + +import argparse +import json +import os +import re +import subprocess +import sys + +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +TESTS_PATH = os.path.join(SCRIPT_DIR, "tests.json") +ANSI_RE = re.compile(r"\x1b\[[0-9;]*m") + + +def find_urbit(): + """Find the urbit binary, checking common locations.""" + candidates = [ + os.path.expanduser("~/bin/urbit"), + "urbit", + ] + for c in candidates: + full = os.path.expanduser(c) + if os.path.isfile(full) and os.access(full, os.X_OK): + return full + return None + + +def eval_nock(urbit_bin, subject, formula, timeout=30): + """Evaluate .*(subject formula) and return (result_str, crashed).""" + expr = f".*({subject} {formula})" + try: + proc = subprocess.run( + [urbit_bin, "eval"], + input=expr, + capture_output=True, + text=True, + timeout=timeout, + ) + except subprocess.TimeoutExpired: + return None, True + + if "bail" in proc.stderr: + return None, True + + raw = ANSI_RE.sub("", proc.stdout).strip() + if not raw: + return None, True + + return raw, False + + +def main(): + parser = argparse.ArgumentParser(description="Validate Nock reference tests") + parser.add_argument( + "--urbit", default=None, + help="Path to urbit binary (default: ~/bin/urbit or $PATH)" + ) + parser.add_argument( + "--verbose", "-v", action="store_true", + help="Print each test as it runs" + ) + args = parser.parse_args() + + urbit_bin = args.urbit or find_urbit() + if not urbit_bin: + print("error: urbit binary not found; pass --urbit /path/to/urbit", + file=sys.stderr) + sys.exit(1) + + with open(TESTS_PATH) as f: + tests = json.load(f) + + passed = 0 + failed = 0 + errors = [] + + for i, t in enumerate(tests): + actual, crashed = eval_nock(urbit_bin, t["subject"], t["formula"]) + expected = t["result"] + + if expected is None: + ok = crashed + else: + ok = (not crashed) and (actual == expected) + + if ok: + passed += 1 + tag = "\033[32mPASS\033[0m" + else: + failed += 1 + tag = "\033[31mFAIL\033[0m" + errors.append((i, t, expected, actual, crashed)) + + if args.verbose or not ok: + print(f" [{tag}] {i:2d}. {t['description']}") + if not ok: + exp_str = "crash" if expected is None else expected + act_str = "crash" if crashed else actual + print(f" expected: {exp_str}") + print(f" actual: {act_str}") + + total = passed + failed + color = "\033[32m" if failed == 0 else "\033[31m" + print(f"\n{color}{passed}/{total} passed\033[0m", end="") + if failed: + print(f" ({failed} failed)") + else: + print() + + sys.exit(0 if failed == 0 else 1) + + +if __name__ == "__main__": + main()