eyeprolog 1.5.16 → 1.5.17

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.
@@ -236,15 +236,15 @@ npm run generate
236
236
  - [01-city.pl](chapter-38/01-city.pl)
237
237
  - [02-look_ahead.pl](chapter-38/02-look_ahead.pl) — Part 3-oriented definite clause grammars
238
238
 
239
- ## Chapter 39: Built-in predicates by programming role
240
-
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)
239
+ ## Chapter 39: Predicate reference
240
+
241
+ - [01-answer.pl](chapter-39/01-answer.pl) — Library relations by programming role
242
+ - [02-answer-2.pl](chapter-39/02-answer-2.pl)
243
+ - [03-answer-3.pl](chapter-39/03-answer-3.pl)
244
+ - [04-cost.pl](chapter-39/04-cost.pl)
245
+ - [05-message.pl](chapter-39/05-message.pl)
246
+ - [06-task.pl](chapter-39/06-task.pl)
247
+ - [07-program.pl](chapter-39/07-program.pl) — Specialized library implementation notes
248
248
 
249
249
  ## Chapter 40: Running EyeProlog: command line and corpus
250
250
 
@@ -1,4 +1,4 @@
1
- % From The Art of EyeProlog, Chapter 39.
1
+ % From The Art of EyeProlog, Chapter 39 — Library relations by programming role.
2
2
  :- use_module(library(dates)).
3
3
  :- use_module(library(between), [between/3]).
4
4
  :- use_module(library(random)).
@@ -1,4 +1,4 @@
1
- % From The Art of EyeProlog, Chapter 39 — The EyeProlog library.
1
+ % From The Art of EyeProlog, Chapter 39 — Specialized library implementation notes.
2
2
  ?- dif(f(X,A),f(Y,B)), ( true ; A = B ).
3
3
  dif(f(X, A), f(Y, B))
4
4
  ; A = B, dif(X, Y).
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.5.16",
6
+ "version": "1.5.17",
7
7
  "description": "EyeProlog turns facts and rules into answers and proofs.",
8
8
  "type": "module",
9
9
  "main": "./index.js",
@@ -4804,6 +4804,25 @@ function documentationSyncCases() {
4804
4804
  assertNotIncludes(section, '[Symbols](#predicate-reference-symbols)', 'predicate index does not rely on renderer-generated group anchors');
4805
4805
  assertIncludes(section, 'stable numeric IDs instead of relying on Markdown heading-slug rules', 'renderer-independent predicate anchors');
4806
4806
  assertIncludes(section, 'wrap naturally on narrow screens without horizontal scrolling', 'responsive predicate reference layout');
4807
+
4808
+ const chapter = between(book, '## 39. Predicate reference', '## 40. Running EyeProlog: command line and corpus');
4809
+ assertEqual(chapter.split('\n').some((line) => line.trimStart().startsWith('|')), false, 'Chapter 39 uses one wrapping stacked layout without Markdown tables');
4810
+ const orderedHeadings = [
4811
+ '### How to read this chapter',
4812
+ '### Core registry',
4813
+ '### Normal-mode extensions',
4814
+ '### Bundled libraries',
4815
+ '### Library relations by programming role',
4816
+ '### Interoperability, autoloading, and portability',
4817
+ '### Specialized library implementation notes',
4818
+ '### Complete predicate indicator reference',
4819
+ ];
4820
+ let previous = -1;
4821
+ for (const heading of orderedHeadings) {
4822
+ const position = chapter.indexOf(heading);
4823
+ assertEqual(position > previous, true, `Chapter 39 section order: ${heading}`);
4824
+ previous = position;
4825
+ }
4807
4826
  },
4808
4827
  },
4809
4828
  {
@@ -7564,7 +7583,7 @@ function bookReferenceDocumentationIssues() {
7564
7583
  if (book.includes('EyeProlog does not perform it.')) {
7565
7584
  issues.push('book contradicts implementation occurs-check behavior');
7566
7585
  }
7567
- for (const heading of ['## 38. Language and ISO profile', '## 39. Built-in predicates by programming role', '## 40. Running EyeProlog: command line and corpus']) {
7586
+ for (const heading of ['## 38. Language and ISO profile', '## 39. Predicate reference', '## 40. Running EyeProlog: command line and corpus']) {
7568
7587
  if (!book.includes(heading)) issues.push(`book is missing ${heading}`);
7569
7588
  }
7570
7589
  if (!guide.includes('[*The Art of EyeProlog*](../../the-art-of-eyeprolog.md) is the reference')) {
@@ -7811,26 +7830,31 @@ function registeredBuiltinSummary() {
7811
7830
 
7812
7831
  function bookBuiltinNames() {
7813
7832
  const book = fs.readFileSync(path.join(packageRoot, 'the-art-of-eyeprolog.md'), 'utf8');
7814
- return documentedBuiltinNames(between(book, '## 39. Built-in predicates by programming role', '### The EyeProlog library'), 2);
7833
+ return documentedBuiltinNames(
7834
+ between(book, '<!-- eyeprolog-core-catalog:start -->', '<!-- eyeprolog-core-catalog:end -->'),
7835
+ );
7815
7836
  }
7816
7837
 
7817
7838
  function bookEyePrologLibraryNames() {
7818
7839
  const book = fs.readFileSync(path.join(packageRoot, 'the-art-of-eyeprolog.md'), 'utf8');
7819
7840
  const iso = new Set(registeredBuiltinNames());
7820
- return documentedBuiltinNames(
7821
- between(book, '<!-- eyeprolog-library-catalog:start -->', '<!-- eyeprolog-library-catalog:end -->'),
7822
- 2,
7823
- ).filter((indicator) => !iso.has(indicator));
7841
+ const section = between(book, '<!-- eyeprolog-library-catalog:start -->', '<!-- eyeprolog-library-catalog:end -->');
7842
+ const exports = section.split('\n')
7843
+ .filter((line) => line.trimStart().startsWith('**Exports:**'))
7844
+ .join('\n');
7845
+ return documentedBuiltinNames(exports).filter((indicator) => !iso.has(indicator));
7824
7846
  }
7825
7847
 
7826
7848
  function bookLibraryModuleIssues() {
7827
7849
  const book = fs.readFileSync(path.join(packageRoot, 'the-art-of-eyeprolog.md'), 'utf8');
7828
7850
  const section = between(book, '<!-- eyeprolog-library-catalog:start -->', '<!-- eyeprolog-library-catalog:end -->');
7829
7851
  const documented = new Map();
7830
- for (const line of section.split('\n')) {
7831
- const match = line.match(/^\|\s*`library\(([^)`]+)\)`\s*\|/);
7852
+ const lines = section.split('\n');
7853
+ for (let i = 0; i < lines.length; i++) {
7854
+ const match = lines[i].match(/^- \*\*`library\(([^)`]+)\)`\*\*/);
7832
7855
  if (match == null) continue;
7833
- documented.set(match[1], documentedBuiltinNames(line, 2));
7856
+ const exports = lines[i + 1] ?? '';
7857
+ documented.set(match[1], documentedBuiltinNames(exports));
7834
7858
  }
7835
7859
 
7836
7860
  const issues = [];
@@ -7864,18 +7888,12 @@ function bookBuiltinSummary() {
7864
7888
  return { entries: Number(match[1]), names: Number(match[2]) };
7865
7889
  }
7866
7890
 
7867
- function documentedBuiltinNames(section, catalogColumn) {
7891
+ function documentedBuiltinNames(section) {
7868
7892
  const names = [];
7869
- for (const line of section.split('\n')) {
7870
- if (!line.trim().startsWith('|') || !line.includes('`')) continue;
7871
- const catalogCell = line.split('|')[catalogColumn] ?? '';
7872
- for (const match of catalogCell.matchAll(/`([A-Za-z_][A-Za-z0-9_]*)\(([^`)]*)\)`/g)) {
7873
- const arity = match[2].trim() === '' ? 0 : match[2].split(',').length;
7874
- names.push(`${match[1]}/${arity}`);
7875
- }
7876
- for (const match of catalogCell.matchAll(/`([^`\s]+)\/(\d+)`/g)) {
7877
- names.push(`${match[1]}/${match[2]}`);
7878
- }
7893
+ for (const match of section.matchAll(/`([^`]+)`/g)) {
7894
+ const indicator = match[1].match(/^(.+)\/(\d+)$/);
7895
+ if (indicator == null) continue;
7896
+ names.push(`${indicator[1]}/${indicator[2]}`);
7879
7897
  }
7880
7898
  return [...new Set(names)].sort();
7881
7899
  }