@tuprolog/arg2p-core 0.6.6 → 0.6.7

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.
@@ -121,9 +121,9 @@
121
121
  var compareBy = Kotlin.kotlin.comparisons.compareBy_bvgy4j$;
122
122
  var sortedWith = Kotlin.kotlin.sequences.sortedWith_vjgqpk$;
123
123
  var mapIndexed = Kotlin.kotlin.sequences.mapIndexed_b7yuyq$;
124
+ var Pair = Kotlin.kotlin.Pair;
124
125
  var firstOrNull = Kotlin.kotlin.sequences.firstOrNull_veqyi0$;
125
126
  var NoSuchElementException_init = Kotlin.kotlin.NoSuchElementException;
126
- var addAll = Kotlin.kotlin.collections.addAll_ipc267$;
127
127
  var firstOrNull_0 = Kotlin.kotlin.collections.firstOrNull_2p1efm$;
128
128
  var plus_0 = Kotlin.kotlin.collections.plus_qloxvw$;
129
129
  var Cons = $module$_2p_core.it.unibo.tuprolog.core.Cons;
@@ -4280,7 +4280,12 @@
4280
4280
  function attacks$lambda$lambda(it) {
4281
4281
  return it.isYes;
4282
4282
  }
4283
- function attacks$lambda$lambda_0(closure$arguments, this$) {
4283
+ function attacks$lambda$lambda_0(this$) {
4284
+ return function (it) {
4285
+ return new Pair(ensureNotNull(it.substitution.get_11rb$(this$.X)), ensureNotNull(it.substitution.get_11rb$(this$.Y)));
4286
+ };
4287
+ }
4288
+ function attacks$lambda$lambda_1(closure$arguments) {
4284
4289
  return function (solution) {
4285
4290
  var $receiver = closure$arguments;
4286
4291
  var first$result;
@@ -4289,8 +4294,7 @@
4289
4294
  tmp$ = $receiver.iterator();
4290
4295
  while (tmp$.hasNext()) {
4291
4296
  var element = tmp$.next();
4292
- var this$_0 = this$;
4293
- if (Unificator.Companion.default.match(element.termRepresentation(), ensureNotNull(solution.substitution.get_11rb$(this$_0.X)))) {
4297
+ if (element.hashCode() === solution.first.hashCode()) {
4294
4298
  first$result = element;
4295
4299
  break first$break;
4296
4300
  }}
@@ -4305,8 +4309,7 @@
4305
4309
  tmp$_1 = $receiver_0.iterator();
4306
4310
  while (tmp$_1.hasNext()) {
4307
4311
  var element_0 = tmp$_1.next();
4308
- var this$_1 = this$;
4309
- if (Unificator.Companion.default.match(element_0.termRepresentation(), ensureNotNull(solution.substitution.get_11rb$(this$_1.Y)))) {
4312
+ if (element_0.hashCode() === solution.second.hashCode()) {
4310
4313
  first$result_0 = element_0;
4311
4314
  break first$break;
4312
4315
  }}
@@ -4318,7 +4321,7 @@
4318
4321
  }
4319
4322
  function attacks$lambda(this$attacks, closure$context, closure$arguments) {
4320
4323
  return function ($receiver) {
4321
- return map(filter(this$attacks.solve($receiver.stringInvoke('context_check', closure$context, [$receiver.stringInvoke('attack', $receiver._, [$receiver.X, $receiver.Y, $receiver._])])), attacks$lambda$lambda), attacks$lambda$lambda_0(closure$arguments, $receiver));
4324
+ return map(map(filter(this$attacks.solve($receiver.stringInvoke('context_check', closure$context, [$receiver.stringInvoke('attack', $receiver._, [$receiver.X, $receiver.Y, $receiver._])])), attacks$lambda$lambda), attacks$lambda$lambda_0($receiver)), attacks$lambda$lambda_1(closure$arguments));
4322
4325
  };
4323
4326
  }
4324
4327
  function attacks($receiver, context, arguments_0) {
@@ -4326,15 +4329,15 @@
4326
4329
  return emptyList();
4327
4330
  return toList(prolog(attacks$lambda($receiver, context, arguments_0)));
4328
4331
  }
4329
- function supports$lambda$lambda$lambda(it) {
4332
+ function supports$lambda$lambda(it) {
4330
4333
  return it.isYes;
4331
4334
  }
4332
- function supports$lambda$lambda$lambda_0(this$) {
4335
+ function supports$lambda$lambda_0(this$) {
4333
4336
  return function (it) {
4334
- return ensureNotNull(it.substitution.get_11rb$(this$.X));
4337
+ return new Pair(ensureNotNull(it.substitution.get_11rb$(this$.X)), ensureNotNull(it.substitution.get_11rb$(this$.Y)));
4335
4338
  };
4336
4339
  }
4337
- function supports$lambda$lambda$lambda_1(closure$arguments, closure$argument) {
4340
+ function supports$lambda$lambda_1(closure$arguments) {
4338
4341
  return function (solution) {
4339
4342
  var $receiver = closure$arguments;
4340
4343
  var first$result;
@@ -4343,33 +4346,40 @@
4343
4346
  tmp$ = $receiver.iterator();
4344
4347
  while (tmp$.hasNext()) {
4345
4348
  var element = tmp$.next();
4346
- if (Unificator.Companion.default.match(element.termRepresentation(), solution)) {
4349
+ if (element.hashCode() === solution.second.hashCode()) {
4347
4350
  first$result = element;
4348
4351
  break first$break;
4349
4352
  }}
4350
4353
  throw new NoSuchElementException_init('Collection contains no element matching the predicate.');
4351
4354
  }
4352
4355
  while (false);
4353
- var $receiver_0 = new Support(first$result, closure$argument);
4354
- closure$argument.supports.add_11rb$($receiver_0.supporter);
4355
- return $receiver_0;
4356
+ var $receiver_0 = first$result;
4357
+ var $receiver_1 = closure$arguments;
4358
+ var first$result_0;
4359
+ first$break: do {
4360
+ var tmp$_0;
4361
+ tmp$_0 = $receiver_1.iterator();
4362
+ while (tmp$_0.hasNext()) {
4363
+ var element_0 = tmp$_0.next();
4364
+ if (element_0.hashCode() === solution.first.hashCode()) {
4365
+ first$result_0 = element_0;
4366
+ break first$break;
4367
+ }}
4368
+ throw new NoSuchElementException_init('Collection contains no element matching the predicate.');
4369
+ }
4370
+ while (false);
4371
+ var $receiver_2 = new Support(first$result_0, $receiver_0);
4372
+ $receiver_0.supports.add_11rb$($receiver_2.supporter);
4373
+ return $receiver_2;
4356
4374
  };
4357
4375
  }
4358
- function supports$lambda$lambda(this$supports, closure$context, closure$argument, closure$arguments) {
4376
+ function supports$lambda(this$supports, closure$context, closure$arguments) {
4359
4377
  return function ($receiver) {
4360
- return toList(map(map(filter(this$supports.solve($receiver.stringInvoke('context_check', closure$context, [$receiver.stringInvoke('support', $receiver.X, [closure$argument.termRepresentation()])])), supports$lambda$lambda$lambda), supports$lambda$lambda$lambda_0($receiver)), supports$lambda$lambda$lambda_1(closure$arguments, closure$argument)));
4378
+ return toList(map(map(filter(this$supports.solve($receiver.stringInvoke('context_check', closure$context, [$receiver.stringInvoke('support', $receiver.X, [$receiver.Y])])), supports$lambda$lambda), supports$lambda$lambda_0($receiver)), supports$lambda$lambda_1(closure$arguments)));
4361
4379
  };
4362
4380
  }
4363
4381
  function supports($receiver, context, arguments_0) {
4364
- var destination = ArrayList_init_0();
4365
- var tmp$;
4366
- tmp$ = arguments_0.iterator();
4367
- while (tmp$.hasNext()) {
4368
- var element = tmp$.next();
4369
- var list = prolog(supports$lambda$lambda($receiver, context, element, arguments_0));
4370
- addAll(destination, list);
4371
- }
4372
- return destination;
4382
+ return prolog(supports$lambda($receiver, context, arguments_0));
4373
4383
  }
4374
4384
  function labels$checkFunctor$lambda$lambda(it) {
4375
4385
  return it.isYes;
@@ -4401,7 +4411,7 @@
4401
4411
  }
4402
4412
  return destination;
4403
4413
  }
4404
- function Argument(rules, topRule, conclusion, groundings, defeasibleRules, defeasiblePremises, lastDefeasibleRules) {
4414
+ function Argument(rules, topRule, conclusion, groundings, defeasibleRules, defeasiblePremises, lastDefeasibleRules, term) {
4405
4415
  Argument$Companion_getInstance();
4406
4416
  if (groundings === void 0)
4407
4417
  groundings = emptyList();
@@ -4411,6 +4421,8 @@
4411
4421
  defeasiblePremises = emptyList();
4412
4422
  if (lastDefeasibleRules === void 0)
4413
4423
  lastDefeasibleRules = emptyList();
4424
+ if (term === void 0)
4425
+ term = null;
4414
4426
  this.rules = rules;
4415
4427
  this.topRule = topRule;
4416
4428
  this.conclusion = conclusion;
@@ -4418,9 +4430,15 @@
4418
4430
  this.defeasibleRules = defeasibleRules;
4419
4431
  this.defeasiblePremises = defeasiblePremises;
4420
4432
  this.lastDefeasibleRules = lastDefeasibleRules;
4433
+ this.term_0 = term;
4421
4434
  this.identifier = '';
4422
4435
  this.supports = ArrayList_init_0();
4423
4436
  }
4437
+ Argument.prototype.hashCode = function () {
4438
+ var $receiver = this.term_0;
4439
+ var tmp$;
4440
+ return (tmp$ = $receiver != null ? hashCode($receiver) : null) != null ? tmp$ : 0;
4441
+ };
4424
4442
  Object.defineProperty(Argument.prototype, 'descriptor', {
4425
4443
  configurable: true,
4426
4444
  get: function () {
@@ -4450,7 +4468,8 @@
4450
4468
  }
4451
4469
  });
4452
4470
  Argument.prototype.termRepresentation = function () {
4453
- return parse_1(Struct.Companion, '[' + this.rules + ', ' + this.topRule + ', [' + this.conclusion + '], ' + this.groundings + ', [' + this.lastDefeasibleRules + ', ' + this.defeasibleRules + ', ' + this.defeasiblePremises + ']]');
4471
+ var tmp$;
4472
+ return (tmp$ = this.term_0) != null ? tmp$ : parse_1(Struct.Companion, '[' + this.rules + ', ' + this.topRule + ', [' + this.conclusion + '], ' + this.groundings + ', [' + this.lastDefeasibleRules + ', ' + this.defeasibleRules + ', ' + this.defeasiblePremises + ']]');
4454
4473
  };
4455
4474
  Argument.prototype.toString = function () {
4456
4475
  return 'argument(' + this.termRepresentation() + ')';
@@ -4519,7 +4538,7 @@
4519
4538
  var argDefeasiblePremises = Argument$Companion$of$argDefeasiblePremises(termAsList, toStringList);
4520
4539
  var argLastDefeasibleRules = Argument$Companion$of$argLastDefeasibleRules(termAsList, toStringList);
4521
4540
  var it = termAsList(term);
4522
- return new Argument(argRules(it), argTopRule(it), argConclusion(it), argGroundings(it), argDefeasibleRules(it), argDefeasiblePremises(it), argLastDefeasibleRules(it));
4541
+ return new Argument(argRules(it), argTopRule(it), argConclusion(it), argGroundings(it), argDefeasibleRules(it), argDefeasiblePremises(it), argLastDefeasibleRules(it), term);
4523
4542
  };
4524
4543
  Argument$Companion.$metadata$ = {
4525
4544
  kind: Kind_OBJECT,
@@ -4558,22 +4577,14 @@
4558
4577
  Argument.prototype.component7 = function () {
4559
4578
  return this.lastDefeasibleRules;
4560
4579
  };
4561
- Argument.prototype.copy_2b7ur7$ = function (rules, topRule, conclusion, groundings, defeasibleRules, defeasiblePremises, lastDefeasibleRules) {
4562
- return new Argument(rules === void 0 ? this.rules : rules, topRule === void 0 ? this.topRule : topRule, conclusion === void 0 ? this.conclusion : conclusion, groundings === void 0 ? this.groundings : groundings, defeasibleRules === void 0 ? this.defeasibleRules : defeasibleRules, defeasiblePremises === void 0 ? this.defeasiblePremises : defeasiblePremises, lastDefeasibleRules === void 0 ? this.lastDefeasibleRules : lastDefeasibleRules);
4580
+ Argument.prototype.component8_0 = function () {
4581
+ return this.term_0;
4563
4582
  };
4564
- Argument.prototype.hashCode = function () {
4565
- var result = 0;
4566
- result = result * 31 + Kotlin.hashCode(this.rules) | 0;
4567
- result = result * 31 + Kotlin.hashCode(this.topRule) | 0;
4568
- result = result * 31 + Kotlin.hashCode(this.conclusion) | 0;
4569
- result = result * 31 + Kotlin.hashCode(this.groundings) | 0;
4570
- result = result * 31 + Kotlin.hashCode(this.defeasibleRules) | 0;
4571
- result = result * 31 + Kotlin.hashCode(this.defeasiblePremises) | 0;
4572
- result = result * 31 + Kotlin.hashCode(this.lastDefeasibleRules) | 0;
4573
- return result;
4583
+ Argument.prototype.copy_fhhptr$ = function (rules, topRule, conclusion, groundings, defeasibleRules, defeasiblePremises, lastDefeasibleRules, term) {
4584
+ return new Argument(rules === void 0 ? this.rules : rules, topRule === void 0 ? this.topRule : topRule, conclusion === void 0 ? this.conclusion : conclusion, groundings === void 0 ? this.groundings : groundings, defeasibleRules === void 0 ? this.defeasibleRules : defeasibleRules, defeasiblePremises === void 0 ? this.defeasiblePremises : defeasiblePremises, lastDefeasibleRules === void 0 ? this.lastDefeasibleRules : lastDefeasibleRules, term === void 0 ? this.term_0 : term);
4574
4585
  };
4575
4586
  Argument.prototype.equals = function (other) {
4576
- return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.rules, other.rules) && Kotlin.equals(this.topRule, other.topRule) && Kotlin.equals(this.conclusion, other.conclusion) && Kotlin.equals(this.groundings, other.groundings) && Kotlin.equals(this.defeasibleRules, other.defeasibleRules) && Kotlin.equals(this.defeasiblePremises, other.defeasiblePremises) && Kotlin.equals(this.lastDefeasibleRules, other.lastDefeasibleRules)))));
4587
+ return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.rules, other.rules) && Kotlin.equals(this.topRule, other.topRule) && Kotlin.equals(this.conclusion, other.conclusion) && Kotlin.equals(this.groundings, other.groundings) && Kotlin.equals(this.defeasibleRules, other.defeasibleRules) && Kotlin.equals(this.defeasiblePremises, other.defeasiblePremises) && Kotlin.equals(this.lastDefeasibleRules, other.lastDefeasibleRules) && Kotlin.equals(this.term_0, other.term_0)))));
4577
4588
  };
4578
4589
  function Attack(attacker, target, type, on) {
4579
4590
  if (type === void 0)
@@ -6070,9 +6081,9 @@
6070
6081
  PrologWithArgumentationImpl.prototype.anyMguWith = PrologWithArgumentation.prototype.anyMguWith;
6071
6082
  PrologWithArgumentationImpl.prototype.anyUnifyWith = PrologWithArgumentation.prototype.anyUnifyWith;
6072
6083
  PrologWithArgumentationImpl.prototype.list = PrologWithArgumentation.prototype.list;
6073
- PrologWithArgumentationImpl.prototype.listFrom = PrologWithArgumentation.prototype.listFrom;
6074
6084
  PrologWithArgumentationImpl.prototype.listFromIterable = PrologWithArgumentation.prototype.listFromIterable;
6075
6085
  PrologWithArgumentationImpl.prototype.listFromSequence = PrologWithArgumentation.prototype.listFromSequence;
6086
+ PrologWithArgumentationImpl.prototype.listFrom = PrologWithArgumentation.prototype.listFrom;
6076
6087
  PrologWithArgumentationImpl.prototype.matchAny = PrologWithArgumentation.prototype.matchAny;
6077
6088
  PrologWithArgumentationImpl.prototype.mguWithOccurCheck = PrologWithArgumentation.prototype.mguWithOccurCheck;
6078
6089
  PrologWithArgumentationImpl.prototype.mguAny = PrologWithArgumentation.prototype.mguAny;