sub_atom/5 (non-det substring) + aggregate_all/3 (count/bag/sum/max/min/set)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Adds two new builtins to lib/prolog/runtime.sx: - sub_atom/5: non-deterministic substring enumeration. Iterates all (start, length) pairs over the atom string, tries to unify Before, Length, After, SubAtom for each candidate. Uses CPS loop helpers pl-substring, pl-sub-atom-try-one!, pl-sub-atom-loop!. Fixed trail undo semantics: only undo on backtrack (k returns false), not on success. - aggregate_all/3: collects all solutions via pl-collect-solutions then reduces. Templates: count, bag(T), sum(E), max(E), min(E), set(T). max/min fail on empty; count/bag/sum/set always succeed. New test suite lib/prolog/tests/string_agg.sx: 25 tests, all passing. Total conformance: 496/496. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,7 @@ SUITES=(
|
||||
"char_predicates:lib/prolog/tests/char_predicates.sx:pl-char-predicates-tests-run!"
|
||||
"io_predicates:lib/prolog/tests/io_predicates.sx:pl-io-predicates-tests-run!"
|
||||
"assert_rules:lib/prolog/tests/assert_rules.sx:pl-assert-rules-tests-run!"
|
||||
"string_agg:lib/prolog/tests/string_agg.sx:pl-string-agg-tests-run!"
|
||||
)
|
||||
|
||||
SCRIPT='(epoch 1)
|
||||
|
||||
Reference in New Issue
Block a user