eyeprolog 1.1.13 → 1.1.15
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 +8 -8
- package/examples/age.pl +1 -1
- package/examples/aliases-and-namespaces.pl +1 -1
- package/examples/binomial-vandermonde.pl +2 -1
- package/examples/book/README.md +1 -0
- package/examples/book/chapter-02/02-measurement.pl +0 -1
- package/examples/book/chapter-03/01-eligible.pl +0 -1
- package/examples/book/chapter-03/02-adult.pl +0 -1
- package/examples/book/chapter-04/02-path.pl +0 -1
- package/examples/book/chapter-06/01-next.pl +0 -1
- package/examples/book/chapter-06/03-square.pl +1 -1
- package/examples/book/chapter-08/01-findall.pl +1 -1
- package/examples/book/chapter-08/02-outgoing_costs.pl +1 -1
- package/examples/book/chapter-08/03-best_route.pl +1 -1
- package/examples/book/chapter-09/02-normalized.pl +1 -1
- package/examples/book/chapter-09/03-message.pl +0 -1
- package/examples/book/chapter-10/02-plan.pl +0 -1
- package/examples/book/chapter-11/01-why.pl +0 -1
- package/examples/book/chapter-17/01-path.pl +0 -1
- package/examples/book/chapter-17/02-adult.pl +0 -1
- package/examples/book/chapter-17/03-bad_member.pl +0 -1
- package/examples/book/chapter-18/01-routeable.pl +0 -1
- package/examples/book/chapter-18/02-routeable-2.pl +0 -1
- package/examples/book/chapter-21/03-loop_edge.pl +0 -1
- package/examples/book/chapter-21/04-eligible.pl +0 -1
- package/examples/book/chapter-22/02-tree_member.pl +0 -1
- package/examples/book/chapter-22/06-lookup.pl +0 -1
- package/examples/book/chapter-23/01-adult.pl +0 -1
- package/examples/book/chapter-23/02-adult-2.pl +0 -1
- package/examples/book/chapter-23/03-can_board.pl +0 -1
- package/examples/book/chapter-23/04-traveler_in_good_standing.pl +0 -1
- package/examples/book/chapter-24/02-simple_path.pl +0 -1
- package/examples/book/chapter-24/03-reachable.pl +0 -1
- package/examples/book/chapter-24/04-best_plan.pl +1 -1
- package/examples/book/chapter-25/01-person.pl +0 -1
- package/examples/book/chapter-25/02-active_badge.pl +0 -1
- package/examples/book/chapter-25/04-permit.pl +0 -1
- package/examples/book/chapter-26/02-triple.pl +1 -1
- package/examples/book/chapter-26/03-triple-2.pl +0 -1
- package/examples/book/chapter-26/04-edge.pl +0 -1
- package/examples/book/chapter-27/02-list_length.pl +0 -1
- package/examples/book/chapter-28/02-triangle.pl +1 -1
- package/examples/book/chapter-28/03-rectangle.pl +0 -1
- package/examples/book/chapter-28/04-integer_rectangle.pl +1 -1
- package/examples/book/chapter-28/05-preserves_combine.pl +0 -1
- package/examples/book/chapter-29/01-counterexample_to_odd_square.pl +1 -1
- package/examples/book/chapter-31/01-edge.pl +0 -1
- package/examples/book/chapter-31/03-double.pl +1 -1
- package/examples/book/chapter-32/01-eligible.pl +0 -1
- package/examples/book/chapter-32/02-eligible-2.pl +0 -1
- package/examples/book/chapter-32/03-candidate_debug.pl +0 -1
- package/examples/book/chapter-32/04-reference_square.pl +1 -1
- package/examples/book/chapter-33/01-assigned_badge.pl +0 -1
- package/examples/book/chapter-33/02-source_role.pl +1 -1
- package/examples/book/chapter-33/03-chosen_pair.pl +1 -1
- package/examples/book/chapter-33/04-path.pl +0 -1
- package/examples/book/chapter-33/09-invalid_badge_assignment.pl +0 -1
- package/examples/book/chapter-34/03-regional_total.pl +0 -1
- package/examples/book/chapter-38/01-city.pl +0 -1
- package/examples/book/chapter-39/01-answer.pl +3 -1
- package/examples/book/chapter-39/02-answer-2.pl +0 -1
- package/examples/book/chapter-39/03-answer-3.pl +1 -1
- package/examples/book/chapter-39/04-cost.pl +1 -1
- package/examples/book/chapter-39/05-message.pl +0 -1
- package/examples/book/chapter-39/06-task.pl +18 -0
- package/examples/catalan-convolution.pl +2 -1
- package/examples/collatz-1000.pl +1 -1
- package/examples/continued-fraction-sqrt2.pl +2 -1
- package/examples/critical-path-schedule.pl +1 -1
- package/examples/delfour.pl +1 -1
- package/examples/easter-computus.pl +1 -1
- package/examples/enigma1225.pl +1 -1
- package/examples/equality-saturation.pl +3 -2
- package/examples/flandor.pl +1 -1
- package/examples/fundamental-theorem-arithmetic.pl +2 -2
- package/examples/goldbach.pl +2 -1
- package/examples/integer-partitions.pl +2 -1
- package/examples/iso-extensions.pl +29 -0
- package/examples/job-shop-scheduling.pl +2 -1
- package/examples/knapsack-optimization.pl +1 -1
- package/examples/markov-logic-network.pl +1 -1
- package/examples/matrix-chain-order.pl +2 -1
- package/examples/missionaries-cannibals.pl +1 -1
- package/examples/observability-log-correlation.pl +1 -1
- package/examples/output/iso-extensions.pl +6 -0
- package/examples/path-discovery.pl +1 -1
- package/examples/pell-equation.pl +2 -1
- package/examples/polynomial.pl +1 -1
- package/examples/prime-range.pl +1 -1
- package/examples/register-allocation.pl +1 -1
- package/examples/reusable-builtins.pl +1 -1
- package/examples/sat-solver-dpll.pl +1 -1
- package/examples/stirling-bell-numbers.pl +2 -1
- package/examples/sudoku.pl +1 -1
- package/examples/term-tools.pl +1 -1
- package/examples/totient-summatory.pl +2 -1
- package/examples/uuid.pl +1 -1
- package/examples/weighted-interval-scheduling.pl +1 -1
- package/index.d.ts +5 -0
- package/package.json +1 -1
- package/playground.html +1 -0
- package/src/cli.js +10 -0
- package/src/iso.js +20 -3
- package/src/lib/aggregate.pl +33 -0
- package/src/lib/comparison.pl +107 -0
- package/src/lib/dates.pl +112 -0
- package/src/lib/iso_ext.pl +84 -0
- package/src/lib/lists.pl +57 -31
- package/src/lib/primes.pl +79 -0
- package/src/lib/prologue.pl +4 -0
- package/src/lib/random.pl +24 -0
- package/src/lib/strings.pl +411 -0
- package/src/lib/uuid.pl +54 -0
- package/src/quads.js +28 -6
- package/src/solver.js +38 -2
- package/src/standard-library.js +16 -7
- package/src/term.js +20 -0
- package/test/fixtures/length_quad.pl +94 -0
- package/test/run-conformance.mjs +10 -1
- package/test/run-playground.mjs +9 -1
- package/test/run-regression.mjs +77 -19
- package/the-art-of-eyeprolog.md +149 -96
- package/src/lib/eyeprolog.pl +0 -772
package/README.md
CHANGED
|
@@ -91,14 +91,14 @@ noun --> [world] | [prolog].
|
|
|
91
91
|
%% goal: phrase(sentence, Words)
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
EyeProlog also adds
|
|
95
|
-
profile. **
|
|
96
|
-
`src/lib
|
|
97
|
-
|
|
98
|
-
They are ISO/IEC 13211-2 modules,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
EyeProlog also adds 62 public library predicate indicators to its 129-entry ISO
|
|
95
|
+
profile. **60 are implemented entirely as ordinary Prolog clauses** in focused
|
|
96
|
+
modules under `src/lib/`; `call_nth/2` and `freeze/2` use private host adapters
|
|
97
|
+
for their control behavior.
|
|
98
|
+
They are ISO/IEC 13211-2 modules loaded explicitly by purpose, such as
|
|
99
|
+
`library(lists)`, `library(strings)`, or `library(aggregate)`. Portable text
|
|
100
|
+
predicates use ISO atoms or character lists. The old catch-all
|
|
101
|
+
`library(eyeprolog)` module is no longer needed.
|
|
102
102
|
|
|
103
103
|
## Development
|
|
104
104
|
|
package/examples/age.pl
CHANGED
package/examples/book/README.md
CHANGED
|
@@ -242,6 +242,7 @@ npm run generate
|
|
|
242
242
|
- [03-answer-3.pl](chapter-39/03-answer-3.pl)
|
|
243
243
|
- [04-cost.pl](chapter-39/04-cost.pl)
|
|
244
244
|
- [05-message.pl](chapter-39/05-message.pl)
|
|
245
|
+
- [06-task.pl](chapter-39/06-task.pl)
|
|
245
246
|
|
|
246
247
|
## Chapter 40: Running EyeProlog: command line and corpus
|
|
247
248
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
% From The Art of EyeProlog, Chapter 39 — The EyeProlog library.
|
|
2
|
-
:- use_module(library(
|
|
2
|
+
:- use_module(library(dates)).
|
|
3
|
+
:- use_module(library(prologue), [between/3]).
|
|
4
|
+
:- use_module(library(random)).
|
|
3
5
|
:- use_module(library(lists)).
|
|
4
6
|
|
|
5
7
|
answer(square, S) :- (S is 12 * 12).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
% From The Art of EyeProlog, Chapter 39.
|
|
2
|
+
:- use_module(library(iso_ext)).
|
|
3
|
+
|
|
4
|
+
task(parse).
|
|
5
|
+
task(check).
|
|
6
|
+
task(report).
|
|
7
|
+
|
|
8
|
+
extension_answer(all_tasks_are_atoms, true) :-
|
|
9
|
+
forall(task(Task), atom(Task)).
|
|
10
|
+
|
|
11
|
+
extension_answer(numbered, Pairs) :-
|
|
12
|
+
findall(N-S, (cfor(1, 3, N), succ(N, S)), Pairs).
|
|
13
|
+
|
|
14
|
+
extension_answer(with_tail, Tasks) :-
|
|
15
|
+
findall(Task, task(Task), Tasks, [done]).
|
|
16
|
+
|
|
17
|
+
extension_answer(same_shape, true) :-
|
|
18
|
+
variant(node(X, X), node(Y, Y)).
|
package/examples/collatz-1000.pl
CHANGED
package/examples/delfour.pl
CHANGED
package/examples/enigma1225.pl
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
:- use_module(library(
|
|
1
|
+
:- use_module(library(aggregate)).
|
|
2
|
+
:- use_module(library(prologue), [between/3]).
|
|
2
3
|
:- use_module(library(lists)).
|
|
3
4
|
|
|
4
5
|
% Bounded equality saturation over tiny arithmetic expression terms.
|
|
@@ -62,7 +63,7 @@ candidate_expression(Candidate) :-
|
|
|
62
63
|
% their children. The numeric range is deliberately bounded for the generated
|
|
63
64
|
% constants in this example.
|
|
64
65
|
expr_cost(x, 1).
|
|
65
|
-
expr_cost(N, 1) :- between(0, 20, N).
|
|
66
|
+
expr_cost(N, 1) :- integer(N), between(0, 20, N).
|
|
66
67
|
expr_cost(add(A, B), Cost) :-
|
|
67
68
|
expr_cost(A, A_cost),
|
|
68
69
|
expr_cost(B, B_cost),
|
package/examples/flandor.pl
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
:- use_module(library(
|
|
1
|
+
:- use_module(library(primes)).
|
|
2
2
|
:- use_module(library(lists)).
|
|
3
3
|
|
|
4
4
|
% Adapted from Eyeling's fundamental-theorem-arithmetic.n3.
|
|
@@ -40,7 +40,7 @@ divides(A, B) :-
|
|
|
40
40
|
(B > 0),
|
|
41
41
|
(0 is B mod A).
|
|
42
42
|
|
|
43
|
-
% smallest_divisor_from/3 is exported by library(
|
|
43
|
+
% smallest_divisor_from/3 is exported by library(primes). Its
|
|
44
44
|
% implementation is plain Prolog and avoids repeating a long trial scan for
|
|
45
45
|
% values that are prime.
|
|
46
46
|
|
package/examples/goldbach.pl
CHANGED