|
| 1 | +# MeTTa TS 1.2.0 |
| 2 | + |
| 3 | +MeTTa TS 1.2.0 adds eight importable standard libraries and makes the core list |
| 4 | +operations run in linear time. Both changes keep the conformance oracle |
| 5 | +byte-identical: the libraries stay off the prelude, and the faster list |
| 6 | +operations return results equal to the prelude recursion up to variable renaming. |
| 7 | + |
| 8 | +## Standard libraries |
| 9 | + |
| 10 | +Eight libraries from the PeTTa distribution are now importable modules. Load one |
| 11 | +with `(import! &self <name>)`. They are kept off the prelude, so a program that |
| 12 | +imports none of them behaves exactly as before and the oracle is unchanged. |
| 13 | + |
| 14 | +- `vector`, `roman`, `combinatorics`, `patrick`, `datastructures`, and `spaces` |
| 15 | + port the corresponding PeTTa utilities. |
| 16 | +- `nars` is a Non-Axiomatic Reasoning System belief engine. |
| 17 | +- `pln` is a Probabilistic Logic Networks reasoner with truth-value revision, |
| 18 | + negation, and deduction, reached through a `PLN.Query` entry point. |
| 19 | + |
| 20 | +The ports follow Hyperon semantics rather than PeTTa's cons-cell representation: |
| 21 | +list construction uses `decons-atom`/`cons-atom`, `collapse` yields a comma |
| 22 | +tuple, and `foldl`/`msort` map to `foldl-atom`/`sort`. |
| 23 | + |
| 24 | +## Linear-time list operations |
| 25 | + |
| 26 | +`size-atom`, `map-atom`, `filter-atom`, and `foldl-atom` over a literal list of |
| 27 | +N elements now run in O(N) time on a constant native stack. The prelude |
| 28 | +recursion was quadratic to cubic and overflowed the stack before reaching a |
| 29 | +million elements. |
| 30 | + |
| 31 | +`size-atom` gains a fast path that returns a ground tuple of inert data without |
| 32 | +threading each element through the interpreter. `map-atom`, `filter-atom`, and |
| 33 | +`foldl-atom` evaluate as grounded operations, and when the per-element function |
| 34 | +is compiled they call it directly on the compiled path. Every result is equal to |
| 35 | +the prelude recursion up to variable renaming, checked by an on/off differential. |
| 36 | + |
| 37 | +A five-run minimum-time subprocess benchmark against PeTTa on SWI-Prolog, at |
| 38 | +N=100000 and including process startup, with a one-clause user function per |
| 39 | +element: |
| 40 | + |
| 41 | +| Operation | PeTTa | MeTTa TS | Speedup | |
| 42 | +| ------------- | -----: | -------: | ------: | |
| 43 | +| `size-atom` | 887 ms | 170 ms | 5.23x | |
| 44 | +| `map-atom` | 999 ms | 348 ms | 2.87x | |
| 45 | +| `filter-atom` | 966 ms | 360 ms | 2.68x | |
| 46 | +| `foldl-atom` | 999 ms | 346 ms | 2.89x | |
| 47 | + |
| 48 | +## Trace bus and metta-debug |
| 49 | + |
| 50 | +The core exposes an optional trace bus: pass a `trace` sink to a run and the |
| 51 | +evaluator reports its reduce, rule-selection, grounded-dispatch, and |
| 52 | +specialization decisions, with no cost when no sink is set. The `@metta-ts/node` |
| 53 | +package adds a `metta-debug` command that runs a call under that sink and prints |
| 54 | +those decisions, so a depth or dispatch question is a one-command diagnosis. |
| 55 | + |
| 56 | +## Fixes |
| 57 | + |
| 58 | +A function that returns a control form such as `let` or `if` under |
| 59 | +`{tabling: true}` now reduces it fully instead of leaving it partially reduced. |
| 60 | + |
| 61 | +## Verification |
| 62 | + |
| 63 | +Checked on Linux with Node and pnpm. |
| 64 | + |
| 65 | +- Build, type check, lint, and format checks pass across all ten packages. |
| 66 | +- `pnpm test` passes: 1,208 tests across 123 files, with 38 optional live |
| 67 | + integration tests (7 files) skipped. |
| 68 | +- The checked oracle passes all 23 corpus files. It is byte-identical to 1.1.7: |
| 69 | + the new libraries are opt-in and off the prelude, and the faster list |
| 70 | + operations equal the prelude recursion up to variable renaming. |
| 71 | + |
| 72 | +## Packages |
| 73 | + |
| 74 | +All public packages use version `1.2.0`: |
| 75 | + |
| 76 | +```bash |
| 77 | +npm install @metta-ts/core@1.2.0 |
| 78 | +npm install -g @metta-ts/node@1.2.0 |
| 79 | +``` |
| 80 | + |
| 81 | +Optional host packages use the same version: |
| 82 | + |
| 83 | +```bash |
| 84 | +npm install @metta-ts/py@1.2.0 pythonia |
| 85 | +npm install @metta-ts/prolog@1.2.0 |
| 86 | +``` |
| 87 | + |
1 | 88 | # MeTTa TS 1.1.7 |
2 | 89 |
|
3 | 90 | MeTTa TS 1.1.7 fixes a unification soundness bug in grounded substitution. |
|
0 commit comments