Остання активність 1735261342

Версія 8f7faf153dffb4783d11c9d0a851802522ef0f88

callatz.chr Неформатований Playground
1move, y <=> x, move
2move, x, x <=> x, x, eval
3move, x <=> x
4
5odd, y <=> x, x, x, x, x, x, odd
6odd <=> x, eval
7
8eval, x, x <=> y, eval
9eval, x <=> x, x, x, odd
10eval <=> move
11
12start <=>
13 x, x, x, x, x,
14 x, x, x, x, x,
15 x, x, eval
callatz.js Неформатований Playground
1/**
2 *
3 * Automatically generated
4 * Do not edit
5 *
6 * Created using CHR.js AOT compiler
7 * (CHR.js version v3.3.21)
8 * http://github.com/fnogatz/CHR.js
9 *
10 */
11
12module.exports = (function () {
13
14 /* eslint no-labels: ["error", { "allowLoop": true }] */
15
16 // Constraint
17 function Constraint (name, arity, args) {
18 this.name = name
19 this.arity = arity
20 this.functor = name + '/' + arity
21 this.args = args
22 this.id = null
23 this.alive = true
24 this.activated = false
25 this.stored = false
26 this.hist = null
27 this.cont = null
28 }
29
30 Constraint.prototype.continue = function () {
31 this.cont[0].call(this, this, this.cont[1])
32 }
33
34 Constraint.prototype.toString = function () {
35 let s = this.name
36 if (this.arity >= 1) {
37 s += '(' + this.args.join(',') + ')'
38 }
39 return s
40 }
41
42 // Store
43 function Store () {
44 this._index = {}
45 this._size = 0
46 this._nextId = 0
47 }
48
49 Store.prototype.add = function (constraint) {
50 if (typeof this._index[constraint.functor] === 'undefined') {
51 this._index[constraint.functor] = []
52 }
53 constraint.id = this._nextId
54 this._index[constraint.functor].push(constraint)
55 this._size += 1
56 this._nextId += 1
57 }
58
59 Store.prototype.remove = function (constraint) {
60 constraint.alive = false
61 const ix = this._index[constraint.functor].indexOf(constraint)
62 this._index[constraint.functor].splice(ix, 1)
63
64 this._size -= 1
65 }
66
67 Store.prototype.lookup = function (rule, patterns, constraint) {
68 const ret = this.lookupResume(rule, patterns, constraint, 0)
69 if (!ret || !ret.res) {
70 return false
71 }
72 return ret.res
73 }
74
75 Store.prototype.lookupResume = function (rule, patterns, constraint, startFrom) {
76 startFrom = startFrom || 0
77
78 const lastPattern = patterns.length - 1
79 const lengths = []
80 const divs = []
81 let div = 1
82 let i
83
84 // build array of arrays
85 const arr = []
86 for (i = 0; i <= lastPattern; i++) {
87 if (patterns[i] === '_') {
88 // "_" is a placeholder for the given `constraint`
89 arr[i] = [constraint]
90 } else if (typeof this._index[patterns[i]] !== 'undefined') {
91 arr[i] = this._index[patterns[i]]
92 } else {
93 // not a single element for this functor
94 return false
95 }
96 }
97
98 for (i = lastPattern; i >= 0; i--) {
99 lengths[i] = arr[i].length
100 divs[i] = div
101 div *= arr[i].length
102 }
103 const max = divs[0] * arr[0].length
104
105 let res
106 let resIds
107 let curr
108 loopng: for (let n = startFrom; n < max; n++) {
109 res = []
110 resIds = []
111 curr = n
112 for (i = 0; i <= lastPattern; i++) {
113 res[i] = arr[i][curr / divs[i] >> 0]
114 resIds[i] = res[i].id
115
116 // avoid multiple occurences of the same constraint
117 if (res.slice(0, i).indexOf(res[i]) !== -1) {
118 continue loopng
119 }
120
121 curr = curr % divs[i]
122 }
123
124 // check if already in history
125 /*
126 if (history.lookup(rule, resIds)) {
127 continue loopng
128 }
129 */
130 return {
131 n: n,
132 res: res
133 }
134 }
135
136 return false
137 }
138
139 Store.prototype.size = function () {
140 return this._size
141 }
142
143 Store.prototype.valueOf = function () {
144 return this.size()
145 }
146
147 Store.prototype.toString = function () {
148 if (this.size() === 0) {
149 return '(empty)'
150 }
151
152 let maxLengthC = 'constraint'.length
153 let maxLengthI = 'id'.length
154 const rows = []
155 let functor
156 for (functor in this._index) {
157 this._index[functor].forEach(function (c) {
158 const s = c.toString()
159 maxLengthC = Math.max(s.length, maxLengthC)
160 maxLengthI = Math.max(c.id.toString().length + 1, maxLengthI)
161 })
162 }
163 for (functor in this._index) {
164 this._index[functor].forEach(function (c) {
165 rows.push(c.id.toString().padStart(maxLengthI) + ' | ' + c.toString().padEnd(maxLengthC))
166 })
167 }
168
169 return [
170 'id'.padStart(maxLengthI) + ' | ' + 'constraint'.padEnd(maxLengthC),
171 ''.padStart(maxLengthI, '-') + '-+-' + ''.padEnd(maxLengthC, '-')
172 ].concat(rows).join('\n')
173 }
174
175 // History
176 /*
177 function History () {
178 this._index = {}
179 this._size = 0
180 }
181
182 History.prototype.size = function () {
183 return this._size
184 }
185
186 History.prototype.valueOf = function () {
187 return this.size()
188 }
189
190 History.prototype.toString = function () {
191 if (this.size() === 0) {
192 return "(empty)"
193 }
194
195 var maxLength_r = "rule".length
196 var maxLength_f = "fired with".length
197 var rows = []
198 var curr
199 for (var rule in this._index) {
200 maxLength_r = Math.max(rule.toString().length, maxLength_r)
201 }
202
203 // TODO
204 }
205
206 History.prototype.add = function (rule, ids) {
207 if (!this._index.hasOwnProperty(rule)) {
208 this._index[rule] = {}
209 }
210
211 var curr = this._index[rule]
212 for (var i = 0; i < ids.length-1; i++) {
213 if (!curr.hasOwnProperty(ids[i])) {
214 curr[ids[i]] = {}
215 }
216 curr = curr[ids[i]]
217 }
218 curr[ids[i]] = true
219
220 this._size += 1
221 }
222
223 History.prototype.lookup = function (rule, ids) {
224 if (!this._index.hasOwnProperty(rule)) {
225 return false
226 }
227
228 var curr = this._index[rule]
229 for (var i = 0; i < ids.length; i++) {
230 if (!curr[ids[i]]) {
231 return false
232 }
233 curr = curr[ids[i]]
234 }
235
236 if (curr !== true) {
237 return false
238 }
239
240 return true
241 }
242 */
243 // trampoline
244 function trampoline () { // eslint-disable-line
245 let constraint
246 while (constraint = stack.pop()) { // eslint-disable-line
247 constraint.continue()
248 }
249 }
250
251 var chr = { // eslint-disable-line
252 Store: new Store()
253 }
254
255 var stack = [] // eslint-disable-line
256 // var history = new History()
257
258 function __y_0_0 (constraint, __n) {
259 __n = __n || 0
260
261 var constraintPattern = [ "move/0", "_" ]
262 var lookupResult = chr.Store.lookupResume(0, constraintPattern, constraint, __n)
263 if (lookupResult === false) {
264 constraint.cont = [__y_0_1, 0]
265 stack.push(constraint)
266 return
267 }
268 var constraints = lookupResult.res
269
270 chr.Store.remove(constraints[0])
271
272 ;(function () {
273 var _c = new Constraint("x", 0, [ ])
274 _c.cont = [__x_0_0, 0]
275 stack.push(_c)
276 })()
277
278 ;(function () {
279 var _c = new Constraint("move", 0, [ ])
280 _c.cont = [__move_0_0, 0]
281 stack.push(_c)
282 })()
283
284 // active constraint gets removed
285 }
286
287 function __move_0_0 (constraint, __n) {
288 __n = __n || 0
289
290 var constraintPattern = [ "_", "y/0" ]
291 var lookupResult = chr.Store.lookupResume(0, constraintPattern, constraint, __n)
292 if (lookupResult === false) {
293 constraint.cont = [__move_0_1, 0]
294 stack.push(constraint)
295 return
296 }
297 var constraints = lookupResult.res
298
299 chr.Store.remove(constraints[1])
300
301 ;(function () {
302 var _c = new Constraint("x", 0, [ ])
303 _c.cont = [__x_0_0, 0]
304 stack.push(_c)
305 })()
306
307 ;(function () {
308 var _c = new Constraint("move", 0, [ ])
309 _c.cont = [__move_0_0, 0]
310 stack.push(_c)
311 })()
312
313 // active constraint gets removed
314 }
315
316 function __x_0_0 (constraint, __n) {
317 __n = __n || 0
318
319 var constraintPattern = [ "move/0", "x/0", "_" ]
320 var lookupResult = chr.Store.lookupResume(1, constraintPattern, constraint, __n)
321 if (lookupResult === false) {
322 constraint.cont = [__x_0_1, 0]
323 stack.push(constraint)
324 return
325 }
326 var constraints = lookupResult.res
327
328 chr.Store.remove(constraints[0])
329 chr.Store.remove(constraints[1])
330
331 ;(function () {
332 var _c = new Constraint("x", 0, [ ])
333 _c.cont = [__x_0_0, 0]
334 stack.push(_c)
335 })()
336
337 ;(function () {
338 var _c = new Constraint("x", 0, [ ])
339 _c.cont = [__x_0_0, 0]
340 stack.push(_c)
341 })()
342
343 ;(function () {
344 var _c = new Constraint("eval", 0, [ ])
345 _c.cont = [__eval_0_0, 0]
346 stack.push(_c)
347 })()
348
349 // active constraint gets removed
350 }
351
352 function __x_0_1 (constraint, __n) {
353 __n = __n || 0
354
355 var constraintPattern = [ "move/0", "_", "x/0" ]
356 var lookupResult = chr.Store.lookupResume(1, constraintPattern, constraint, __n)
357 if (lookupResult === false) {
358 constraint.cont = [__x_0_2, 0]
359 stack.push(constraint)
360 return
361 }
362 var constraints = lookupResult.res
363
364 chr.Store.remove(constraints[0])
365 chr.Store.remove(constraints[2])
366
367 ;(function () {
368 var _c = new Constraint("x", 0, [ ])
369 _c.cont = [__x_0_0, 0]
370 stack.push(_c)
371 })()
372
373 ;(function () {
374 var _c = new Constraint("x", 0, [ ])
375 _c.cont = [__x_0_0, 0]
376 stack.push(_c)
377 })()
378
379 ;(function () {
380 var _c = new Constraint("eval", 0, [ ])
381 _c.cont = [__eval_0_0, 0]
382 stack.push(_c)
383 })()
384
385 // active constraint gets removed
386 }
387
388 function __move_0_1 (constraint, __n) {
389 __n = __n || 0
390
391 var constraintPattern = [ "_", "x/0", "x/0" ]
392 var lookupResult = chr.Store.lookupResume(1, constraintPattern, constraint, __n)
393 if (lookupResult === false) {
394 constraint.cont = [__move_0_2, 0]
395 stack.push(constraint)
396 return
397 }
398 var constraints = lookupResult.res
399
400 chr.Store.remove(constraints[1])
401 chr.Store.remove(constraints[2])
402
403 ;(function () {
404 var _c = new Constraint("x", 0, [ ])
405 _c.cont = [__x_0_0, 0]
406 stack.push(_c)
407 })()
408
409 ;(function () {
410 var _c = new Constraint("x", 0, [ ])
411 _c.cont = [__x_0_0, 0]
412 stack.push(_c)
413 })()
414
415 ;(function () {
416 var _c = new Constraint("eval", 0, [ ])
417 _c.cont = [__eval_0_0, 0]
418 stack.push(_c)
419 })()
420
421 // active constraint gets removed
422 }
423
424 function __x_0_2 (constraint, __n) {
425 __n = __n || 0
426
427 var constraintPattern = [ "move/0", "_" ]
428 var lookupResult = chr.Store.lookupResume(2, constraintPattern, constraint, __n)
429 if (lookupResult === false) {
430 constraint.cont = [__x_0_3, 0]
431 stack.push(constraint)
432 return
433 }
434 var constraints = lookupResult.res
435
436 chr.Store.remove(constraints[0])
437
438 ;(function () {
439 var _c = new Constraint("x", 0, [ ])
440 _c.cont = [__x_0_0, 0]
441 stack.push(_c)
442 })()
443
444 // active constraint gets removed
445 }
446
447 function __move_0_2 (constraint, __n) {
448 __n = __n || 0
449
450 var constraintPattern = [ "_", "x/0" ]
451 var lookupResult = chr.Store.lookupResume(2, constraintPattern, constraint, __n)
452 if (lookupResult === false) {
453 constraint.cont = [__move_0_3, 0]
454 stack.push(constraint)
455 return
456 }
457 var constraints = lookupResult.res
458
459 chr.Store.remove(constraints[1])
460
461 ;(function () {
462 var _c = new Constraint("x", 0, [ ])
463 _c.cont = [__x_0_0, 0]
464 stack.push(_c)
465 })()
466
467 // active constraint gets removed
468 }
469
470 function __y_0_1 (constraint, __n) {
471 __n = __n || 0
472
473 var constraintPattern = [ "odd/0", "_" ]
474 var lookupResult = chr.Store.lookupResume(3, constraintPattern, constraint, __n)
475 if (lookupResult === false) {
476 constraint.cont = [__y_0_2, 0]
477 stack.push(constraint)
478 return
479 }
480 var constraints = lookupResult.res
481
482 chr.Store.remove(constraints[0])
483
484 ;(function () {
485 var _c = new Constraint("x", 0, [ ])
486 _c.cont = [__x_0_0, 0]
487 stack.push(_c)
488 })()
489
490 ;(function () {
491 var _c = new Constraint("x", 0, [ ])
492 _c.cont = [__x_0_0, 0]
493 stack.push(_c)
494 })()
495
496 ;(function () {
497 var _c = new Constraint("x", 0, [ ])
498 _c.cont = [__x_0_0, 0]
499 stack.push(_c)
500 })()
501
502 ;(function () {
503 var _c = new Constraint("x", 0, [ ])
504 _c.cont = [__x_0_0, 0]
505 stack.push(_c)
506 })()
507
508 ;(function () {
509 var _c = new Constraint("x", 0, [ ])
510 _c.cont = [__x_0_0, 0]
511 stack.push(_c)
512 })()
513
514 ;(function () {
515 var _c = new Constraint("x", 0, [ ])
516 _c.cont = [__x_0_0, 0]
517 stack.push(_c)
518 })()
519
520 ;(function () {
521 var _c = new Constraint("odd", 0, [ ])
522 _c.cont = [__odd_0_0, 0]
523 stack.push(_c)
524 })()
525
526 // active constraint gets removed
527 }
528
529 function __odd_0_0 (constraint, __n) {
530 __n = __n || 0
531
532 var constraintPattern = [ "_", "y/0" ]
533 var lookupResult = chr.Store.lookupResume(3, constraintPattern, constraint, __n)
534 if (lookupResult === false) {
535 constraint.cont = [__odd_0_1, 0]
536 stack.push(constraint)
537 return
538 }
539 var constraints = lookupResult.res
540
541 chr.Store.remove(constraints[1])
542
543 ;(function () {
544 var _c = new Constraint("x", 0, [ ])
545 _c.cont = [__x_0_0, 0]
546 stack.push(_c)
547 })()
548
549 ;(function () {
550 var _c = new Constraint("x", 0, [ ])
551 _c.cont = [__x_0_0, 0]
552 stack.push(_c)
553 })()
554
555 ;(function () {
556 var _c = new Constraint("x", 0, [ ])
557 _c.cont = [__x_0_0, 0]
558 stack.push(_c)
559 })()
560
561 ;(function () {
562 var _c = new Constraint("x", 0, [ ])
563 _c.cont = [__x_0_0, 0]
564 stack.push(_c)
565 })()
566
567 ;(function () {
568 var _c = new Constraint("x", 0, [ ])
569 _c.cont = [__x_0_0, 0]
570 stack.push(_c)
571 })()
572
573 ;(function () {
574 var _c = new Constraint("x", 0, [ ])
575 _c.cont = [__x_0_0, 0]
576 stack.push(_c)
577 })()
578
579 ;(function () {
580 var _c = new Constraint("odd", 0, [ ])
581 _c.cont = [__odd_0_0, 0]
582 stack.push(_c)
583 })()
584
585 // active constraint gets removed
586 }
587
588 function __odd_0_1 (constraint, __n) {
589 __n = __n || 0
590
591 ;(function () {
592 var _c = new Constraint("x", 0, [ ])
593 _c.cont = [__x_0_0, 0]
594 stack.push(_c)
595 })()
596
597 ;(function () {
598 var _c = new Constraint("eval", 0, [ ])
599 _c.cont = [__eval_0_0, 0]
600 stack.push(_c)
601 })()
602
603 // active constraint gets removed
604 }
605
606 function __x_0_3 (constraint, __n) {
607 __n = __n || 0
608
609 var constraintPattern = [ "eval/0", "x/0", "_" ]
610 var lookupResult = chr.Store.lookupResume(5, constraintPattern, constraint, __n)
611 if (lookupResult === false) {
612 constraint.cont = [__x_0_4, 0]
613 stack.push(constraint)
614 return
615 }
616 var constraints = lookupResult.res
617
618 chr.Store.remove(constraints[0])
619 chr.Store.remove(constraints[1])
620
621 ;(function () {
622 var _c = new Constraint("y", 0, [ ])
623 _c.cont = [__y_0_0, 0]
624 stack.push(_c)
625 })()
626
627 ;(function () {
628 var _c = new Constraint("eval", 0, [ ])
629 _c.cont = [__eval_0_0, 0]
630 stack.push(_c)
631 })()
632
633 // active constraint gets removed
634 }
635
636 function __x_0_4 (constraint, __n) {
637 __n = __n || 0
638
639 var constraintPattern = [ "eval/0", "_", "x/0" ]
640 var lookupResult = chr.Store.lookupResume(5, constraintPattern, constraint, __n)
641 if (lookupResult === false) {
642 constraint.cont = [__x_0_5, 0]
643 stack.push(constraint)
644 return
645 }
646 var constraints = lookupResult.res
647
648 chr.Store.remove(constraints[0])
649 chr.Store.remove(constraints[2])
650
651 ;(function () {
652 var _c = new Constraint("y", 0, [ ])
653 _c.cont = [__y_0_0, 0]
654 stack.push(_c)
655 })()
656
657 ;(function () {
658 var _c = new Constraint("eval", 0, [ ])
659 _c.cont = [__eval_0_0, 0]
660 stack.push(_c)
661 })()
662
663 // active constraint gets removed
664 }
665
666 function __eval_0_0 (constraint, __n) {
667 __n = __n || 0
668
669 var constraintPattern = [ "_", "x/0", "x/0" ]
670 var lookupResult = chr.Store.lookupResume(5, constraintPattern, constraint, __n)
671 if (lookupResult === false) {
672 constraint.cont = [__eval_0_1, 0]
673 stack.push(constraint)
674 return
675 }
676 var constraints = lookupResult.res
677
678 chr.Store.remove(constraints[1])
679 chr.Store.remove(constraints[2])
680
681 ;(function () {
682 var _c = new Constraint("y", 0, [ ])
683 _c.cont = [__y_0_0, 0]
684 stack.push(_c)
685 })()
686
687 ;(function () {
688 var _c = new Constraint("eval", 0, [ ])
689 _c.cont = [__eval_0_0, 0]
690 stack.push(_c)
691 })()
692
693 // active constraint gets removed
694 }
695
696 function __x_0_5 (constraint, __n) {
697 __n = __n || 0
698
699 var constraintPattern = [ "eval/0", "_" ]
700 var lookupResult = chr.Store.lookupResume(6, constraintPattern, constraint, __n)
701 if (lookupResult === false) {
702 constraint.cont = [__x_0_6, 0]
703 stack.push(constraint)
704 return
705 }
706 var constraints = lookupResult.res
707
708 chr.Store.remove(constraints[0])
709
710 ;(function () {
711 var _c = new Constraint("x", 0, [ ])
712 _c.cont = [__x_0_0, 0]
713 stack.push(_c)
714 })()
715
716 ;(function () {
717 var _c = new Constraint("x", 0, [ ])
718 _c.cont = [__x_0_0, 0]
719 stack.push(_c)
720 })()
721
722 ;(function () {
723 var _c = new Constraint("x", 0, [ ])
724 _c.cont = [__x_0_0, 0]
725 stack.push(_c)
726 })()
727
728 ;(function () {
729 var _c = new Constraint("odd", 0, [ ])
730 _c.cont = [__odd_0_0, 0]
731 stack.push(_c)
732 })()
733
734 // active constraint gets removed
735 }
736
737 function __eval_0_1 (constraint, __n) {
738 __n = __n || 0
739
740 var constraintPattern = [ "_", "x/0" ]
741 var lookupResult = chr.Store.lookupResume(6, constraintPattern, constraint, __n)
742 if (lookupResult === false) {
743 constraint.cont = [__eval_0_2, 0]
744 stack.push(constraint)
745 return
746 }
747 var constraints = lookupResult.res
748
749 chr.Store.remove(constraints[1])
750
751 ;(function () {
752 var _c = new Constraint("x", 0, [ ])
753 _c.cont = [__x_0_0, 0]
754 stack.push(_c)
755 })()
756
757 ;(function () {
758 var _c = new Constraint("x", 0, [ ])
759 _c.cont = [__x_0_0, 0]
760 stack.push(_c)
761 })()
762
763 ;(function () {
764 var _c = new Constraint("x", 0, [ ])
765 _c.cont = [__x_0_0, 0]
766 stack.push(_c)
767 })()
768
769 ;(function () {
770 var _c = new Constraint("odd", 0, [ ])
771 _c.cont = [__odd_0_0, 0]
772 stack.push(_c)
773 })()
774
775 // active constraint gets removed
776 }
777
778 function __eval_0_2 (constraint, __n) {
779 __n = __n || 0
780
781 ;(function () {
782 var _c = new Constraint("move", 0, [ ])
783 _c.cont = [__move_0_0, 0]
784 stack.push(_c)
785 })()
786
787 // active constraint gets removed
788 }
789
790 function __start_0_0 (constraint, __n) {
791 __n = __n || 0
792
793 ;(function () {
794 var _c = new Constraint("x", 0, [ ])
795 _c.cont = [__x_0_0, 0]
796 stack.push(_c)
797 })()
798
799 ;(function () {
800 var _c = new Constraint("x", 0, [ ])
801 _c.cont = [__x_0_0, 0]
802 stack.push(_c)
803 })()
804
805 ;(function () {
806 var _c = new Constraint("x", 0, [ ])
807 _c.cont = [__x_0_0, 0]
808 stack.push(_c)
809 })()
810
811 ;(function () {
812 var _c = new Constraint("x", 0, [ ])
813 _c.cont = [__x_0_0, 0]
814 stack.push(_c)
815 })()
816
817 ;(function () {
818 var _c = new Constraint("x", 0, [ ])
819 _c.cont = [__x_0_0, 0]
820 stack.push(_c)
821 })()
822
823 ;(function () {
824 var _c = new Constraint("x", 0, [ ])
825 _c.cont = [__x_0_0, 0]
826 stack.push(_c)
827 })()
828
829 ;(function () {
830 var _c = new Constraint("x", 0, [ ])
831 _c.cont = [__x_0_0, 0]
832 stack.push(_c)
833 })()
834
835 ;(function () {
836 var _c = new Constraint("x", 0, [ ])
837 _c.cont = [__x_0_0, 0]
838 stack.push(_c)
839 })()
840
841 ;(function () {
842 var _c = new Constraint("x", 0, [ ])
843 _c.cont = [__x_0_0, 0]
844 stack.push(_c)
845 })()
846
847 ;(function () {
848 var _c = new Constraint("x", 0, [ ])
849 _c.cont = [__x_0_0, 0]
850 stack.push(_c)
851 })()
852
853 ;(function () {
854 var _c = new Constraint("x", 0, [ ])
855 _c.cont = [__x_0_0, 0]
856 stack.push(_c)
857 })()
858
859 ;(function () {
860 var _c = new Constraint("x", 0, [ ])
861 _c.cont = [__x_0_0, 0]
862 stack.push(_c)
863 })()
864
865 ;(function () {
866 var _c = new Constraint("eval", 0, [ ])
867 _c.cont = [__eval_0_0, 0]
868 stack.push(_c)
869 })()
870
871 // active constraint gets removed
872 }
873
874 function __move_0_3 (constraint) {
875 constraint.cont = null
876 chr.Store.add(constraint)
877 }
878
879 function __y_0_2 (constraint) {
880 constraint.cont = null
881 chr.Store.add(constraint)
882 }
883
884 function __x_0_6 (constraint) {
885 constraint.cont = null
886 chr.Store.add(constraint)
887 }
888
889 function __eval_0_3 (constraint) {
890 constraint.cont = null
891 chr.Store.add(constraint)
892 }
893
894 function __odd_0_2 (constraint) {
895 constraint.cont = null
896 chr.Store.add(constraint)
897 }
898
899 function __start_0_1 (constraint) {
900 constraint.cont = null
901 chr.Store.add(constraint)
902 }
903
904 function move () {
905 var args = Array.prototype.slice.call(arguments)
906 var arity = arguments.length
907 var functor = "move/" + arity
908 var constraint = new Constraint("move", arity, args)
909 if (arity === 0) {
910 constraint.cont = [__move_0_0, ]
911 } else {
912 throw new Error("Undefined constraint: " + functor)
913 }
914 stack.push(constraint)
915
916 trampoline()
917 }
918
919 function y () {
920 var args = Array.prototype.slice.call(arguments)
921 var arity = arguments.length
922 var functor = "y/" + arity
923 var constraint = new Constraint("y", arity, args)
924 if (arity === 0) {
925 constraint.cont = [__y_0_0, ]
926 } else {
927 throw new Error("Undefined constraint: " + functor)
928 }
929 stack.push(constraint)
930
931 trampoline()
932 }
933
934 function x () {
935 var args = Array.prototype.slice.call(arguments)
936 var arity = arguments.length
937 var functor = "x/" + arity
938 var constraint = new Constraint("x", arity, args)
939 if (arity === 0) {
940 constraint.cont = [__x_0_0, ]
941 } else {
942 throw new Error("Undefined constraint: " + functor)
943 }
944 stack.push(constraint)
945
946 trampoline()
947 }
948
949 function eval () {
950 var args = Array.prototype.slice.call(arguments)
951 var arity = arguments.length
952 var functor = "eval/" + arity
953 var constraint = new Constraint("eval", arity, args)
954 if (arity === 0) {
955 constraint.cont = [__eval_0_0, ]
956 } else {
957 throw new Error("Undefined constraint: " + functor)
958 }
959 stack.push(constraint)
960
961 trampoline()
962 }
963
964 function odd () {
965 var args = Array.prototype.slice.call(arguments)
966 var arity = arguments.length
967 var functor = "odd/" + arity
968 var constraint = new Constraint("odd", arity, args)
969 if (arity === 0) {
970 constraint.cont = [__odd_0_0, ]
971 } else {
972 throw new Error("Undefined constraint: " + functor)
973 }
974 stack.push(constraint)
975
976 trampoline()
977 }
978
979 function start () {
980 var args = Array.prototype.slice.call(arguments)
981 var arity = arguments.length
982 var functor = "start/" + arity
983 var constraint = new Constraint("start", arity, args)
984 if (arity === 0) {
985 constraint.cont = [__start_0_0, ]
986 } else {
987 throw new Error("Undefined constraint: " + functor)
988 }
989 stack.push(constraint)
990
991 trampoline()
992 }
993
994 chr.move = move
995 chr.y = y
996 chr.x = x
997 chr.eval = eval
998 chr.odd = odd
999 chr.start = start
1000
1001 return chr
1002})()
1003