eyeling 1.33.4 → 1.33.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -105
- package/docs/eyelang-guide.md +551 -0
- package/{examples/eyelang/SPEC.md → docs/eyelang-language-reference.md} +6 -10
- package/lib/eyelang/builtins/arithmetic.js +1 -3
- package/lib/eyelang/builtins/formula.js +0 -16
- package/lib/eyelang/builtins/lists.js +0 -5
- package/lib/eyelang/builtins/registry.js +1 -2
- package/lib/eyelang/builtins/search.js +1 -61
- package/lib/eyelang/builtins/strings.js +10 -14
- package/package.json +2 -1
- package/test/eyelang/conformance/README.md +7 -7
- package/test/eyelang/conformance/cases/core/001_fact_output.pl +1 -1
- package/test/eyelang/conformance/cases/core/002_rule_recursion.pl +1 -1
- package/test/eyelang/conformance/cases/core/003_terms_and_readback.pl +1 -1
- package/test/eyelang/conformance/cases/core/004_conjunction_and_parentheses.pl +1 -1
- package/test/eyelang/conformance/cases/core/005_list_deconstruction.pl +1 -1
- package/test/eyelang/conformance/cases/core/006_comma_formula_data.pl +1 -1
- package/test/eyelang/conformance/cases/core/007_anonymous_variables.pl +1 -1
- package/test/eyelang/conformance/cases/core/008_graphic_atoms.pl +1 -1
- package/test/eyelang/conformance/cases/core/009_comments_and_whitespace.pl +1 -1
- package/test/eyelang/conformance/cases/core/010_variable_scope_and_reuse.pl +1 -1
- package/test/eyelang/conformance/cases/core/011_predicate_arity.pl +1 -1
- package/test/eyelang/conformance/cases/core/012_nested_compound_unification.pl +1 -1
- package/test/eyelang/conformance/cases/core/013_multiple_clauses_order.pl +1 -1
- package/test/eyelang/conformance/cases/core/014_failure_filters_answers.pl +1 -1
- package/test/eyelang/conformance/cases/core/015_improper_list_unification.pl +1 -1
- package/test/eyelang/conformance/cases/core/016_zero_arity_compound.pl +1 -1
- package/test/eyelang/conformance/cases/core/017_three_step_recursion.pl +1 -1
- package/test/eyelang/conformance/cases/core/018_quoted_atom_readback.pl +1 -1
- package/test/eyelang/conformance/cases/core/019_parenthesized_three_conjuncts.pl +1 -1
- package/test/eyelang/conformance/cases/core/020_nested_list_terms.pl +1 -1
- package/test/eyelang/conformance/cases/core/021_repeated_variable_head.pl +1 -1
- package/test/eyelang/conformance/cases/core/022_rule_head_structure.pl +1 -1
- package/test/eyelang/conformance/cases/core/023_quoted_escapes_readback.pl +1 -1
- package/test/eyelang/conformance/cases/core/024_numeric_literal_readback.pl +1 -1
- package/test/eyelang/conformance/cases/core/025_body_parentheses_with_formula_data.pl +1 -1
- package/test/eyelang/conformance/cases/core/026_underscore_named_variable_reuse.pl +1 -1
- package/test/eyelang/conformance/cases/extension/001_default_derived_output.pl +1 -1
- package/test/eyelang/conformance/cases/extension/002_materialize_focus.pl +1 -1
- package/test/eyelang/conformance/cases/extension/003_arithmetic_and_comparison.pl +1 -2
- package/test/eyelang/conformance/cases/extension/004_strings_and_atoms.pl +1 -3
- package/test/eyelang/conformance/cases/extension/005_lists_aggregation_ordering.pl +1 -1
- package/test/eyelang/conformance/cases/extension/006_formula_terms.pl +1 -2
- package/test/eyelang/conformance/cases/extension/007_negation_once_generators.pl +1 -1
- package/test/eyelang/conformance/cases/extension/008_equality_and_inequality.pl +1 -1
- package/test/eyelang/conformance/cases/extension/009_list_relations.pl +1 -2
- package/test/eyelang/conformance/cases/extension/010_append_splits.pl +1 -1
- package/test/eyelang/conformance/cases/extension/011_matching_and_comparison.pl +1 -1
- package/test/eyelang/conformance/cases/extension/012_memoize_declaration.pl +1 -1
- package/test/eyelang/conformance/cases/extension/013_numeric_functions.pl +1 -1
- package/test/eyelang/conformance/cases/extension/014_between_enumeration.pl +1 -1
- package/test/eyelang/conformance/cases/extension/015_smallest_divisor.pl +1 -1
- package/test/eyelang/conformance/cases/extension/016_negation_filter.pl +1 -1
- package/test/eyelang/conformance/cases/extension/017_once_user_predicate.pl +1 -1
- package/test/eyelang/conformance/cases/extension/018_findall_user_goal.pl +1 -1
- package/test/eyelang/conformance/cases/extension/019_sort_deduplicates_atoms.pl +1 -1
- package/test/eyelang/conformance/cases/extension/020_append_bound_prefix_suffix.pl +1 -1
- package/test/eyelang/conformance/cases/extension/021_nth0_index_generation.pl +1 -1
- package/test/eyelang/conformance/cases/extension/022_set_nth0_edges.pl +1 -1
- package/test/eyelang/conformance/cases/extension/023_select_duplicate_occurrences.pl +1 -1
- package/test/eyelang/conformance/cases/extension/024_not_member_filter.pl +1 -1
- package/test/eyelang/conformance/cases/extension/026_nested_formula_terms.pl +1 -2
- package/test/eyelang/conformance/cases/extension/027_materialize_excludes_source_fact.pl +1 -1
- package/test/eyelang/conformance/cases/extension/028_numeric_and_lexical_comparison.pl +1 -1
- package/test/eyelang/conformance/cases/extension/029_string_matching_filters.pl +1 -1
- package/test/eyelang/conformance/cases/extension/030_string_and_atom_concat.pl +1 -2
- package/test/eyelang/conformance/cases/extension/035_date_difference.pl +1 -1
- package/test/eyelang/conformance/cases/extension/036_extended_gcd.pl +1 -1
- package/test/eyelang/conformance/cases/extension/037_collatz_trajectory.pl +1 -1
- package/test/eyelang/conformance/cases/extension/038_kaprekar_steps.pl +1 -1
- package/test/eyelang/conformance/cases/extension/039_goldbach_pair.pl +1 -1
- package/test/eyelang/conformance/cases/extension/040_matrix_operations.pl +1 -1
- package/test/eyelang/conformance/cases/extension/042_n_queens_small.pl +1 -1
- package/test/eyelang/conformance/cases/extension/043_cnf_model.pl +1 -1
- package/test/eyelang/conformance/cases/extension/045_alphametic_sum_small.pl +1 -1
- package/test/eyelang/conformance/cases/extension/046_bounded_subset.pl +1 -1
- package/test/eyelang/conformance/expected/extension/003_arithmetic_and_comparison.out +0 -1
- package/test/eyelang/conformance/expected/extension/004_strings_and_atoms.out +0 -2
- package/test/eyelang/conformance/expected/extension/006_formula_terms.out +0 -2
- package/test/eyelang/conformance/expected/extension/009_list_relations.out +0 -1
- package/test/eyelang/conformance/expected/extension/026_nested_formula_terms.out +0 -3
- package/test/eyelang/conformance/expected/extension/030_string_and_atom_concat.out +0 -1
- package/test/eyelang/run-regression.mjs +2 -2
- package/test/packlist.test.js +2 -0
- package/examples/eyelang/INTEGRATION.md +0 -20
- package/examples/eyelang/README.md +0 -567
- package/examples/eyelang/exact-cover-sudoku.pl +0 -113
- package/examples/eyelang/output/exact-cover-sudoku.pl +0 -3
- package/examples/eyelang/output/sudoku.pl +0 -2
- package/examples/eyelang/sudoku.pl +0 -20
- package/lib/eyelang/builtins/sudoku.js +0 -141
- package/test/eyelang/conformance/cases/extension/025_is_list_filter.pl +0 -5
- package/test/eyelang/conformance/cases/extension/025_is_list_filter.query +0 -1
- package/test/eyelang/conformance/cases/extension/041_atom_range_generators.pl +0 -5
- package/test/eyelang/conformance/cases/extension/044_cover9_filter.pl +0 -6
- package/test/eyelang/conformance/expected/extension/025_is_list_filter.out +0 -1
- package/test/eyelang/conformance/expected/extension/041_atom_range_generators.out +0 -8
- package/test/eyelang/conformance/expected/extension/044_cover9_filter.out +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
%
|
|
1
|
+
% Reference 9.3, 9.6: lexical comparison and simple text matching.
|
|
2
2
|
answer(matches, true) :- matches("eyelang", "eye").
|
|
3
3
|
answer(not_matches, true) :- not_matches("eyelang", "cat").
|
|
4
4
|
answer(lex_lt, true) :- lt(alpha, beta).
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
%
|
|
1
|
+
% Reference 9.9: formula helpers enumerate nested comma formula members.
|
|
2
2
|
formula(((name(a, "A"), knows(a, b)), likes(b, c))).
|
|
3
|
-
answer(atom, A) :- formula(F), formula_atom(F, A).
|
|
4
3
|
answer(binary, exposed(S, P, O)) :- formula(F), formula_binary(F, S, P, O).
|
|
5
4
|
materialize(answer, 2).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
%
|
|
1
|
+
% Reference 9.3: comparisons handle numeric and lexical scalar ordering.
|
|
2
2
|
answer(numeric_gt, true) :- gt(10, 2).
|
|
3
3
|
answer(numeric_le, true) :- le(2, 2.0).
|
|
4
4
|
answer(lexical_ge, true) :- ge(beta, alpha).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
%
|
|
1
|
+
% Reference 9.1: difference/3 computes ISO date durations.
|
|
2
2
|
answer(duration, D) :- difference("2024-03-01", "2020-02-29", D).
|
|
3
3
|
answer(month_borrow, D) :- difference("2024-03-01", "2024-01-31", D).
|
|
4
4
|
materialize(answer, 2).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
%
|
|
1
|
+
% Reference 9.2: matrix helpers handle small ground numeric matrices.
|
|
2
2
|
answer(sum, M) :- matrix_sum([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], M).
|
|
3
3
|
answer(product, M) :- matrix_multiply([[[1, 2], [3, 4]], [[2, 0], [1, 2]]], M).
|
|
4
4
|
answer(determinant, D) :- determinant([[4, 2], [2, 3]], D).
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
%
|
|
1
|
+
% Reference 9.5: alphametic_sum/5 enumerates unique digit assignments for column addition.
|
|
2
2
|
answer(solution, result(Digits, Values)) :- alphametic_sum([a, b], [[a], [a]], [b], Digits, Values).
|
|
3
3
|
materialize(answer, 2).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
%
|
|
1
|
+
% Reference 9.5: bounded_subset/7 enumerates subsets within budget and risk caps.
|
|
2
2
|
projects([p(a, 5, 3, 1), p(b, 4, 2, 2), p(c, 7, 5, 3)]).
|
|
3
3
|
answer(selection, result(Names, Value, Cost, Risk)) :- projects(Ps), bounded_subset(Ps, 5, 3, Names, Value, Cost, Risk).
|
|
4
4
|
materialize(answer, 2).
|
|
@@ -491,9 +491,9 @@ function listExampleNames() {
|
|
|
491
491
|
}
|
|
492
492
|
|
|
493
493
|
function readmeCatalogExampleNames() {
|
|
494
|
-
const readme = fs.readFileSync(path.join(packageRoot, '
|
|
494
|
+
const readme = fs.readFileSync(path.join(packageRoot, 'docs', 'eyelang-guide.md'), 'utf8');
|
|
495
495
|
const section = between(readme, '## Example catalog', '## Golden outputs, tests, and conformance');
|
|
496
|
-
return [...section.matchAll(/examples\/([A-Za-z0-9_-]+)\.pl/g)]
|
|
496
|
+
return [...section.matchAll(/examples\/eyelang\/([A-Za-z0-9_-]+)\.pl/g)]
|
|
497
497
|
.map((match) => match[1])
|
|
498
498
|
.filter((name, index, names) => names.indexOf(name) === index)
|
|
499
499
|
.sort();
|
package/test/packlist.test.js
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Eyelang examples inside Eyeling
|
|
2
|
-
|
|
3
|
-
This directory contains eyelang examples that can be exercised through Eyeling's experimental second engine:
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
eyeling --engine eyelang examples/eyelang/ancestor.pl
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
For a paired example, compare the N3 and eyelang versions of the same dependency-risk scenario:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
eyeling examples/vulnerability-impact.n3
|
|
13
|
-
eyeling --engine eyelang examples/eyelang/vulnerability-impact.pl
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
The eyelang conformance corpus is kept under `test/eyelang/` and can be run with:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm run test:eyelang:corpus
|
|
20
|
-
```
|