eyeprolog 1.3.95 → 1.3.96
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/examples/book/README.md +7 -6
- package/examples/book/chapter-39/01-program.pl +4 -0
- package/examples/book/chapter-39/{01-answer.pl → 02-answer.pl} +1 -1
- package/package.json +1 -1
- package/test/run-regression.mjs +14 -0
- package/the-art-of-eyeprolog.md +9 -1
- /package/examples/book/chapter-39/{02-answer-2.pl → 03-answer-2.pl} +0 -0
- /package/examples/book/chapter-39/{03-answer-3.pl → 04-answer-3.pl} +0 -0
- /package/examples/book/chapter-39/{04-cost.pl → 05-cost.pl} +0 -0
- /package/examples/book/chapter-39/{05-message.pl → 06-message.pl} +0 -0
- /package/examples/book/chapter-39/{06-task.pl → 07-task.pl} +0 -0
package/examples/book/README.md
CHANGED
|
@@ -238,12 +238,13 @@ npm run generate
|
|
|
238
238
|
|
|
239
239
|
## Chapter 39: Built-in predicates by programming role
|
|
240
240
|
|
|
241
|
-
- [01-
|
|
242
|
-
- [02-answer
|
|
243
|
-
- [03-answer-
|
|
244
|
-
- [04-
|
|
245
|
-
- [05-
|
|
246
|
-
- [06-
|
|
241
|
+
- [01-program.pl](chapter-39/01-program.pl) — The EyeProlog library
|
|
242
|
+
- [02-answer.pl](chapter-39/02-answer.pl)
|
|
243
|
+
- [03-answer-2.pl](chapter-39/03-answer-2.pl)
|
|
244
|
+
- [04-answer-3.pl](chapter-39/04-answer-3.pl)
|
|
245
|
+
- [05-cost.pl](chapter-39/05-cost.pl)
|
|
246
|
+
- [06-message.pl](chapter-39/06-message.pl)
|
|
247
|
+
- [07-task.pl](chapter-39/07-task.pl)
|
|
247
248
|
|
|
248
249
|
## Chapter 40: Running EyeProlog: command line and corpus
|
|
249
250
|
|
package/package.json
CHANGED
package/test/run-regression.mjs
CHANGED
|
@@ -400,6 +400,20 @@ function regressionCases() {
|
|
|
400
400
|
'dif/2 residuals are minimal without auxiliary terms');
|
|
401
401
|
assertEqual(residuals.stderr, '', 'dif/2 normalization display stderr');
|
|
402
402
|
|
|
403
|
+
const perfection = runCli([], {
|
|
404
|
+
input:
|
|
405
|
+
'dif(f(X,A),f(Y,B)), ( true ; A = B ).\n' +
|
|
406
|
+
';\n' +
|
|
407
|
+
'halt.\n',
|
|
408
|
+
});
|
|
409
|
+
assertEqual(perfection.status, 0, 'dif/2 branch-local projection status');
|
|
410
|
+
assertEqual(perfection.stdout,
|
|
411
|
+
'?- dif(f(X, A), f(Y, B))\n' +
|
|
412
|
+
'; A = B, dif(X, Y).\n' +
|
|
413
|
+
'?- ',
|
|
414
|
+
'dif/2 residual projection is re-evaluated after branch-local bindings');
|
|
415
|
+
assertEqual(perfection.stderr, '', 'dif/2 branch-local projection stderr');
|
|
416
|
+
|
|
403
417
|
const pendingDifCount = (text) => {
|
|
404
418
|
const solver = new Solver(Program.parse(''), { registry: getEyePrologRegistry() });
|
|
405
419
|
const solutions = solver.solve([parseGoalText(text)], new Env(), 0);
|
package/the-art-of-eyeprolog.md
CHANGED
|
@@ -6293,7 +6293,15 @@ answers `Y=1`, `Y=2`, and `Y=3`.
|
|
|
6293
6293
|
can still unify. Its residual store is normalized by logical implication:
|
|
6294
6294
|
symmetric or equivalent constraints share one residual, and a stronger
|
|
6295
6295
|
constraint removes weaker ones regardless of insertion order. Independent
|
|
6296
|
-
disequalities remain separate.
|
|
6296
|
+
disequalities remain separate. Residual projection is re-evaluated in each
|
|
6297
|
+
solution environment, so a compound disequality is kept intact until later
|
|
6298
|
+
bindings make one aligned subterm pair sufficient. For example:
|
|
6299
|
+
|
|
6300
|
+
```eyeprolog
|
|
6301
|
+
?- dif(f(X,A),f(Y,B)), ( true ; A = B ).
|
|
6302
|
+
dif(f(X, A), f(Y, B))
|
|
6303
|
+
; A = B, dif(X, Y).
|
|
6304
|
+
```
|
|
6297
6305
|
|
|
6298
6306
|
<!-- eyeprolog-library-catalog:start -->
|
|
6299
6307
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|