eyeling 1.8.4 → 1.8.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.
Files changed (2) hide show
  1. package/eyeling.js +17 -31
  2. package/package.json +1 -1
package/eyeling.js CHANGED
@@ -4458,7 +4458,7 @@ function evalCryptoHashBuiltin(g, subst, algo) {
4458
4458
  // log: scoped-closure priority helper
4459
4459
  // ---------------------------------------------------------------------------
4460
4460
  // When log:collectAllIn / log:forAllIn are used with an object that is a
4461
- // natural number literal, that number is treated as a *priority* (closure level).
4461
+ // positive integer literal (>= 1), that number is treated as a *priority* (closure level).
4462
4462
  // See the adapted semantics near those builtins.
4463
4463
  function __logNaturalPriorityFromTerm(t) {
4464
4464
  const info = parseNumericLiteralInfo(t);
@@ -4467,12 +4467,12 @@ function __logNaturalPriorityFromTerm(t) {
4467
4467
 
4468
4468
  const v = info.value;
4469
4469
  if (typeof v === 'bigint') {
4470
- if (v < 0n) return null;
4470
+ if (v < 1n) return null;
4471
4471
  if (v > BigInt(Number.MAX_SAFE_INTEGER)) return null;
4472
4472
  return Number(v);
4473
4473
  }
4474
4474
  if (typeof v === 'number') {
4475
- if (!Number.isInteger(v) || v < 0) return null;
4475
+ if (!Number.isInteger(v) || v < 1) return null;
4476
4476
  return v;
4477
4477
  }
4478
4478
  return null;
@@ -6129,10 +6129,8 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen, maxResults) {
6129
6129
 
6130
6130
  // Priority / closure semantics:
6131
6131
  // - object = GraphTerm: explicit scope, run immediately (no closure gating)
6132
- // - object = natural number literal N: delay until saturated closure level >= N
6133
- // * N = 0 => run immediately (use the live fact store)
6134
- // * N >= 1 => run only when a scoped snapshot exists at closure level >= N
6135
- // - object = Var: treat as priority 1 and bind it to 1
6132
+ // - object = positive integer literal N (>= 1): delay until saturated closure level >= N
6133
+ // - object = Var: treat as priority 1 (do not bind)
6136
6134
  // - any other object: backward-compatible default priority 1
6137
6135
 
6138
6136
  let outSubst = { ...subst };
@@ -6157,25 +6155,18 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen, maxResults) {
6157
6155
  } else {
6158
6156
  let prio = 1;
6159
6157
  if (g.o instanceof Var) {
6160
- // Bind the object var to 1 (default priority)
6161
- outSubst[g.o.name] = internLiteral('1');
6158
+ // Unbound var: behave as priority 1 (do not bind)
6162
6159
  prio = 1;
6163
6160
  } else {
6164
6161
  const p0 = __logNaturalPriorityFromTerm(g.o);
6165
6162
  if (p0 !== null) prio = p0;
6166
6163
  }
6167
6164
 
6168
- if (prio === 0) {
6169
- // Immediate: use live closure during the current fixpoint phase.
6170
- scopeFacts = facts;
6171
- scopeBackRules = backRules;
6172
- } else {
6173
- const snap = facts.__scopedSnapshot || null;
6174
- const lvl = (facts && typeof facts.__scopedClosureLevel === 'number' && facts.__scopedClosureLevel) || 0;
6175
- if (!snap) return []; // DELAY until snapshot exists
6176
- if (lvl < prio) return []; // DELAY until saturated closure prio exists
6177
- scopeFacts = snap;
6178
- }
6165
+ const snap = facts.__scopedSnapshot || null;
6166
+ const lvl = (facts && typeof facts.__scopedClosureLevel === 'number' && facts.__scopedClosureLevel) || 0;
6167
+ if (!snap) return []; // DELAY until snapshot exists
6168
+ if (lvl < prio) return []; // DELAY until saturated closure prio exists
6169
+ scopeFacts = snap;
6179
6170
  }
6180
6171
 
6181
6172
  // If sols is a blank node succeed without collecting/binding.
@@ -6231,23 +6222,18 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen, maxResults) {
6231
6222
  } else {
6232
6223
  let prio = 1;
6233
6224
  if (g.o instanceof Var) {
6234
- outSubst[g.o.name] = internLiteral('1');
6225
+ // Unbound var: behave as priority 1 (do not bind)
6235
6226
  prio = 1;
6236
6227
  } else {
6237
6228
  const p0 = __logNaturalPriorityFromTerm(g.o);
6238
6229
  if (p0 !== null) prio = p0;
6239
6230
  }
6240
6231
 
6241
- if (prio === 0) {
6242
- scopeFacts = facts;
6243
- scopeBackRules = backRules;
6244
- } else {
6245
- const snap = facts.__scopedSnapshot || null;
6246
- const lvl = (facts && typeof facts.__scopedClosureLevel === 'number' && facts.__scopedClosureLevel) || 0;
6247
- if (!snap) return []; // DELAY until snapshot exists
6248
- if (lvl < prio) return []; // DELAY until saturated closure prio exists
6249
- scopeFacts = snap;
6250
- }
6232
+ const snap = facts.__scopedSnapshot || null;
6233
+ const lvl = (facts && typeof facts.__scopedClosureLevel === 'number' && facts.__scopedClosureLevel) || 0;
6234
+ if (!snap) return []; // DELAY until snapshot exists
6235
+ if (lvl < prio) return []; // DELAY until saturated closure prio exists
6236
+ scopeFacts = snap;
6251
6237
  }
6252
6238
 
6253
6239
  const visited1 = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyeling",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
4
4
  "description": "A minimal Notation3 (N3) reasoner in JavaScript.",
5
5
  "main": "./index.js",
6
6
  "keywords": [