2 // This file is automatically generated by scheme2js, except for the
3 // benchmark harness code at the beginning and end of the file.
5 /************* GENERATED FILE - DO NOT EDIT *************/
6 /************* GENERATED FILE - DO NOT EDIT *************/
7 /************* GENERATED FILE - DO NOT EDIT *************/
8 /************* GENERATED FILE - DO NOT EDIT *************/
9 /************* GENERATED FILE - DO NOT EDIT *************/
10 /************* GENERATED FILE - DO NOT EDIT *************/
11 /************* GENERATED FILE - DO NOT EDIT *************/
12 /************* GENERATED FILE - DO NOT EDIT *************/
14 * To use write/prints/... the default-output port has to be set first.
15 * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values
16 * should do the trick.
17 * In the following example the std-out and error-port are redirected to
19 function initRuntime() {
20 function escapeHTML(s) {
22 tmp = tmp.replace(/&/g, "&");
23 tmp = tmp.replace(/</g, "<");
24 tmp = tmp.replace(/>/g, ">");
25 tmp = tmp.replace(/ /g, " ");
26 tmp = tmp.replace(/\n/g, "<br />");
27 tmp = tmp.replace(/\t/g, "  ");
32 document.write("<div id='stdout'></div>");
33 SC_DEFAULT_OUT = new sc_GenericOutputPort(
35 var stdout = document.getElementById('stdout');
36 stdout.innerHTML = stdout.innerHTML + escapeHTML(s);
38 SC_ERROR_OUT = SC_DEFAULT_OUT;
43 function sc_print_debug() {
44 sc_print
.apply(null, arguments
);
46 /*** META ((export *js*)) */
47 var sc_JS_GLOBALS
= this;
52 /*** META ((export #t)) */
54 var len
= arguments
.length
;
58 for( i
= 0; i
< len
; i
++ ) {
59 s
+= sc_toDisplayString(arguments
[ i
]);
65 /*** META ((export #t)) */
66 function sc_typeof( x
) {
70 /*** META ((export #t)) */
72 var a
= [sc_jsstring2symbol("*error*")];
73 for (var i
= 0; i
< arguments
.length
; i
++) {
74 a
[i
+1] = arguments
[i
];
79 /*** META ((export #t)
80 (peephole (prefix "throw ")))
82 function sc_raise(obj
) {
86 /*** META ((export with-handler-lambda)) */
87 function sc_withHandlerLambda(handler
, body
) {
91 if (!e
._internalException
)
98 var sc_properties
= new Object();
100 /*** META ((export #t)) */
101 function sc_putpropBang(sym
, key
, val
) {
102 var ht
= sc_properties
[sym
];
105 sc_properties
[sym
] = ht
;
110 /*** META ((export #t)) */
111 function sc_getprop(sym
, key
) {
112 var ht
= sc_properties
[sym
];
122 /*** META ((export #t)) */
123 function sc_rempropBang(sym
, key
) {
124 var ht
= sc_properties
[sym
];
129 /*** META ((export #t)) */
130 function sc_any2String(o
) {
131 return jsstring2string(sc_toDisplayString(o
));
134 /*** META ((export #t)
135 (peephole (infix 2 2 "==="))
138 function sc_isEqv(o1
, o2
) {
142 /*** META ((export #t)
143 (peephole (infix 2 2 "==="))
146 function sc_isEq(o1
, o2
) {
150 /*** META ((export #t)
153 function sc_isNumber(n
) {
154 return (typeof n
=== "number");
157 /*** META ((export #t)
160 function sc_isComplex(n
) {
161 return sc_isNumber(n
);
164 /*** META ((export #t)
167 function sc_isReal(n
) {
168 return sc_isNumber(n
);
171 /*** META ((export #t)
174 function sc_isRational(n
) {
178 /*** META ((export #t)
181 function sc_isInteger(n
) {
182 return (parseInt(n
) === n
);
185 /*** META ((export #t)
187 (peephole (postfix ", false")))
189 // we don't have exact numbers...
190 function sc_isExact(n
) {
194 /*** META ((export #t)
195 (peephole (postfix ", true"))
198 function sc_isInexact(n
) {
202 /*** META ((export = =fx =fl)
204 (peephole (infix 2 2 "===")))
206 function sc_equal(x
) {
207 for (var i
= 1; i
< arguments
.length
; i
++)
208 if (x
!== arguments
[i
])
213 /*** META ((export < <fx <fl)
215 (peephole (infix 2 2 "<")))
217 function sc_less(x
) {
218 for (var i
= 1; i
< arguments
.length
; i
++) {
219 if (x
>= arguments
[i
])
226 /*** META ((export > >fx >fl)
228 (peephole (infix 2 2 ">")))
230 function sc_greater(x
, y
) {
231 for (var i
= 1; i
< arguments
.length
; i
++) {
232 if (x
<= arguments
[i
])
239 /*** META ((export <= <=fx <=fl)
241 (peephole (infix 2 2 "<=")))
243 function sc_lessEqual(x
, y
) {
244 for (var i
= 1; i
< arguments
.length
; i
++) {
245 if (x
> arguments
[i
])
252 /*** META ((export >= >=fl >=fx)
254 (peephole (infix 2 2 ">=")))
256 function sc_greaterEqual(x
, y
) {
257 for (var i
= 1; i
< arguments
.length
; i
++) {
258 if (x
< arguments
[i
])
265 /*** META ((export #t)
267 (peephole (postfix "=== 0")))
269 function sc_isZero(x
) {
273 /*** META ((export #t)
275 (peephole (postfix "> 0")))
277 function sc_isPositive(x
) {
281 /*** META ((export #t)
283 (peephole (postfix "< 0")))
285 function sc_isNegative(x
) {
289 /*** META ((export #t)
291 (peephole (postfix "%2===1")))
293 function sc_isOdd(x
) {
294 return (x
% 2 === 1);
297 /*** META ((export #t)
299 (peephole (postfix "%2===0")))
301 function sc_isEven(x
) {
302 return (x
% 2 === 0);
305 /*** META ((export #t)) */
306 var sc_max
= Math
.max
;
307 /*** META ((export #t)) */
308 var sc_min
= Math
.min
;
310 /*** META ((export + +fx +fl)
311 (peephole (infix 0 #f "+" "0")))
315 for (var i
= 0; i
< arguments
.length
; i
++)
320 /*** META ((export * *fx *fl)
321 (peephole (infix 0 #f "*" "1")))
323 function sc_multi() {
325 for (var i
= 0; i
< arguments
.length
; i
++)
326 product
*= arguments
[i
];
330 /*** META ((export - -fx -fl)
333 function sc_minus(x
) {
334 if (arguments
.length
=== 1)
338 for (var i
= 1; i
< arguments
.length
; i
++)
344 /*** META ((export / /fl)
348 if (arguments
.length
=== 1)
352 for (var i
= 1; i
< arguments
.length
; i
++)
358 /*** META ((export #t)) */
359 var sc_abs
= Math
.abs
;
361 /*** META ((export quotient /fx)
362 (peephole (hole 2 "parseInt(" x "/" y ")")))
364 function sc_quotient(x
, y
) {
365 return parseInt(x
/ y
);
368 /*** META ((export #t)
369 (peephole (infix 2 2 "%")))
371 function sc_remainder(x
, y
) {
375 /*** META ((export #t)
378 function sc_modulo(x
, y
) {
379 var remainder
= x
% y
;
380 // if they don't have the same sign
381 if ((remainder
* y
) < 0)
382 return remainder
+ y
;
387 function sc_euclid_gcd(a
, b
) {
389 if (a
=== 0) return b
;
390 if (b
=== 0) return a
;
391 if (a
< 0) {a
= -a
;};
392 if (b
< 0) {b
= -b
;};
393 if (b
> a
) {temp
= a
; a
= b
; b
= temp
;};
396 if(a
=== 0) {return b
;};
398 if(b
=== 0) {return a
;};
403 /*** META ((export #t)) */
406 for (var i
= 0; i
< arguments
.length
; i
++)
407 gcd
= sc_euclid_gcd(gcd
, arguments
[i
]);
411 /*** META ((export #t)) */
414 for (var i
= 0; i
< arguments
.length
; i
++) {
415 var f
= Math
.round(arguments
[i
] / sc_euclid_gcd(arguments
[i
], lcm
));
421 // LIMITATION: numerator and denominator don't make sense in floating point world.
422 //var SC_MAX_DECIMALS = 1000000
424 // function sc_numerator(x) {
425 // var rounded = Math.round(x * SC_MAX_DECIMALS);
426 // return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
429 // function sc_denominator(x) {
430 // var rounded = Math.round(x * SC_MAX_DECIMALS);
431 // return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
434 /*** META ((export #t)) */
435 var sc_floor
= Math
.floor
;
436 /*** META ((export #t)) */
437 var sc_ceiling
= Math
.ceil
;
438 /*** META ((export #t)) */
439 var sc_truncate
= parseInt
;
440 /*** META ((export #t)) */
441 var sc_round
= Math
.round
;
443 // LIMITATION: sc_rationalize doesn't make sense in a floating point world.
445 /*** META ((export #t)) */
446 var sc_exp
= Math
.exp
;
447 /*** META ((export #t)) */
448 var sc_log
= Math
.log
;
449 /*** META ((export #t)) */
450 var sc_sin
= Math
.sin
;
451 /*** META ((export #t)) */
452 var sc_cos
= Math
.cos
;
453 /*** META ((export #t)) */
454 var sc_tan
= Math
.tan
;
455 /*** META ((export #t)) */
456 var sc_asin
= Math
.asin
;
457 /*** META ((export #t)) */
458 var sc_acos
= Math
.acos
;
459 /*** META ((export #t)) */
460 var sc_atan
= Math
.atan
;
462 /*** META ((export #t)) */
463 var sc_sqrt
= Math
.sqrt
;
464 /*** META ((export #t)) */
465 var sc_expt
= Math
.pow
;
467 // LIMITATION: we don't have complex numbers.
468 // LIMITATION: the following functions are hence not implemented.
469 // LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle
470 // LIMITATION: 2 argument atan
472 /*** META ((export #t)
475 function sc_exact2inexact(x
) {
479 /*** META ((export #t)
482 function sc_inexact2exact(x
) {
486 function sc_number2jsstring(x
, radix
) {
488 return x
.toString(radix
);
493 function sc_jsstring2number(s
, radix
) {
494 if (s
=== "") return false;
497 var t
= parseInt(s
, radix
);
498 if (!t
&& t
!== 0) return false;
499 // verify that each char is in range. (parseInt ignores leading
500 // white and trailing chars)
501 var allowedChars
= "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix
+1);
502 if ((new RegExp("^["+allowedChars
+"]*$", "i")).test(s
))
506 var t
= +s
; // does not ignore trailing chars.
507 if (!t
&& t
!== 0) return false;
508 // simply verify that first char is not whitespace.
510 // if +c is 0, but the char is not "0", then we have a whitespace.
511 if (+c
=== 0 && c
!== "0") return false;
516 /*** META ((export #t)
524 /*** META ((export #t)
527 function sc_isBoolean(b
) {
528 return (b
=== true) || (b
=== false);
531 function sc_Pair(car
, cdr
) {
536 sc_Pair
.prototype.toString = function() {
537 return sc_toDisplayString(this);
539 sc_Pair
.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay
) {
545 res
+= writeOrDisplay(current
.car
);
546 if (sc_isPair(current
.cdr
)) {
548 current
= current
.cdr
;
549 } else if (current
.cdr
!== null) {
550 res
+= " . " + writeOrDisplay(current
.cdr
);
552 } else // current.cdr == null
560 sc_Pair
.prototype.sc_toDisplayString = function() {
561 return this.sc_toWriteOrDisplayString(sc_toDisplayString
);
563 sc_Pair
.prototype.sc_toWriteString = function() {
564 return this.sc_toWriteOrDisplayString(sc_toWriteString
);
566 // sc_Pair.prototype.sc_toWriteCircleString in IO.js
568 /*** META ((export #t)
570 (peephole (postfix " instanceof sc_Pair")))
572 function sc_isPair(p
) {
573 return (p
instanceof sc_Pair
);
576 function sc_isPairEqual(p1
, p2
, comp
) {
577 return (comp(p1
.car
, p2
.car
) && comp(p1
.cdr
, p2
.cdr
));
580 /*** META ((export #t)
581 (peephole (hole 2 "new sc_Pair(" car ", " cdr ")")))
583 function sc_cons(car
, cdr
) {
584 return new sc_Pair(car
, cdr
);
587 /*** META ((export cons*)) */
588 function sc_consStar() {
589 var res
= arguments
[arguments
.length
- 1];
590 for (var i
= arguments
.length
-2; i
>= 0; i
--)
591 res
= new sc_Pair(arguments
[i
], res
);
595 /*** META ((export #t)
596 (peephole (postfix ".car")))
602 /*** META ((export #t)
603 (peephole (postfix ".cdr")))
609 /*** META ((export #t)
610 (peephole (hole 2 p ".car = " val)))
612 function sc_setCarBang(p
, val
) {
616 /*** META ((export #t)
617 (peephole (hole 2 p ".cdr = " val)))
619 function sc_setCdrBang(p
, val
) {
623 /*** META ((export #t)
624 (peephole (postfix ".car.car")))
626 function sc_caar(p
) { return p
.car
.car
; }
627 /*** META ((export #t)
628 (peephole (postfix ".cdr.car")))
630 function sc_cadr(p
) { return p
.cdr
.car
; }
631 /*** META ((export #t)
632 (peephole (postfix ".car.cdr")))
634 function sc_cdar(p
) { return p
.car
.cdr
; }
635 /*** META ((export #t)
636 (peephole (postfix ".cdr.cdr")))
638 function sc_cddr(p
) { return p
.cdr
.cdr
; }
639 /*** META ((export #t)
640 (peephole (postfix ".car.car.car")))
642 function sc_caaar(p
) { return p
.car
.car
.car
; }
643 /*** META ((export #t)
644 (peephole (postfix ".car.cdr.car")))
646 function sc_cadar(p
) { return p
.car
.cdr
.car
; }
647 /*** META ((export #t)
648 (peephole (postfix ".cdr.car.car")))
650 function sc_caadr(p
) { return p
.cdr
.car
.car
; }
651 /*** META ((export #t)
652 (peephole (postfix ".cdr.cdr.car")))
654 function sc_caddr(p
) { return p
.cdr
.cdr
.car
; }
655 /*** META ((export #t)
656 (peephole (postfix ".car.car.cdr")))
658 function sc_cdaar(p
) { return p
.car
.car
.cdr
; }
659 /*** META ((export #t)
660 (peephole (postfix ".cdr.car.cdr")))
662 function sc_cdadr(p
) { return p
.cdr
.car
.cdr
; }
663 /*** META ((export #t)
664 (peephole (postfix ".car.cdr.cdr")))
666 function sc_cddar(p
) { return p
.car
.cdr
.cdr
; }
667 /*** META ((export #t)
668 (peephole (postfix ".cdr.cdr.cdr")))
670 function sc_cdddr(p
) { return p
.cdr
.cdr
.cdr
; }
671 /*** META ((export #t)
672 (peephole (postfix ".car.car.car.car")))
674 function sc_caaaar(p
) { return p
.car
.car
.car
.car
; }
675 /*** META ((export #t)
676 (peephole (postfix ".car.cdr.car.car")))
678 function sc_caadar(p
) { return p
.car
.cdr
.car
.car
; }
679 /*** META ((export #t)
680 (peephole (postfix ".cdr.car.car.car")))
682 function sc_caaadr(p
) { return p
.cdr
.car
.car
.car
; }
683 /*** META ((export #t)
684 (peephole (postfix ".cdr.cdr.car.car")))
686 function sc_caaddr(p
) { return p
.cdr
.cdr
.car
.car
; }
687 /*** META ((export #t)
688 (peephole (postfix ".car.car.car.cdr")))
690 function sc_cdaaar(p
) { return p
.car
.car
.car
.cdr
; }
691 /*** META ((export #t)
692 (peephole (postfix ".car.cdr.car.cdr")))
694 function sc_cdadar(p
) { return p
.car
.cdr
.car
.cdr
; }
695 /*** META ((export #t)
696 (peephole (postfix ".cdr.car.car.cdr")))
698 function sc_cdaadr(p
) { return p
.cdr
.car
.car
.cdr
; }
699 /*** META ((export #t)
700 (peephole (postfix ".cdr.cdr.car.cdr")))
702 function sc_cdaddr(p
) { return p
.cdr
.cdr
.car
.cdr
; }
703 /*** META ((export #t)
704 (peephole (postfix ".car.car.cdr.car")))
706 function sc_cadaar(p
) { return p
.car
.car
.cdr
.car
; }
707 /*** META ((export #t)
708 (peephole (postfix ".car.cdr.cdr.car")))
710 function sc_caddar(p
) { return p
.car
.cdr
.cdr
.car
; }
711 /*** META ((export #t)
712 (peephole (postfix ".cdr.car.cdr.car")))
714 function sc_cadadr(p
) { return p
.cdr
.car
.cdr
.car
; }
715 /*** META ((export #t)
716 (peephole (postfix ".cdr.cdr.cdr.car")))
718 function sc_cadddr(p
) { return p
.cdr
.cdr
.cdr
.car
; }
719 /*** META ((export #t)
720 (peephole (postfix ".car.car.cdr.cdr")))
722 function sc_cddaar(p
) { return p
.car
.car
.cdr
.cdr
; }
723 /*** META ((export #t)
724 (peephole (postfix ".car.cdr.cdr.cdr")))
726 function sc_cdddar(p
) { return p
.car
.cdr
.cdr
.cdr
; }
727 /*** META ((export #t)
728 (peephole (postfix ".cdr.car.cdr.cdr")))
730 function sc_cddadr(p
) { return p
.cdr
.car
.cdr
.cdr
; }
731 /*** META ((export #t)
732 (peephole (postfix ".cdr.cdr.cdr.cdr")))
734 function sc_cddddr(p
) { return p
.cdr
.cdr
.cdr
.cdr
; }
736 /*** META ((export #t)) */
737 function sc_lastPair(l
) {
738 if (!sc_isPair(l
)) sc_error("sc_lastPair: pair expected");
741 while (sc_isPair(cdr
)) {
748 /*** META ((export #t)
750 (peephole (postfix " === null")))
752 function sc_isNull(o
) {
756 /*** META ((export #t)
759 function sc_isList(o
) {
766 if (rabbit
=== null ||
767 (rabbit
instanceof sc_Pair
&& rabbit
.cdr
=== null))
768 return true; // end of list
769 else if ((rabbit
instanceof sc_Pair
) &&
770 (rabbit
.cdr
instanceof sc_Pair
)) {
771 rabbit
= rabbit
.cdr
.cdr
;
773 if (rabbit
=== turtle
) return false; // cycle
775 return false; // not pair
779 /*** META ((export #t)) */
783 for (var i
= a
.length
-1; i
>= 0; i
--)
784 res
= new sc_Pair(a
[i
], res
);
788 /*** META ((export #t)) */
789 function sc_iota(num
, init
) {
792 for (var i
= num
- 1; i
>= 0; i
--)
793 res
= new sc_Pair(i
+ init
, res
);
797 /*** META ((export #t)) */
798 function sc_makeList(nbEls
, fill
) {
800 for (var i
= 0; i
< nbEls
; i
++)
801 res
= new sc_Pair(fill
, res
);
805 /*** META ((export #t)) */
806 function sc_length(l
) {
815 /*** META ((export #t)) */
816 function sc_remq(o
, l
) {
817 var dummy
= { cdr : null };
821 tail
.cdr
= sc_cons(l
.car
, null);
829 /*** META ((export #t)) */
830 function sc_remqBang(o
, l
) {
831 var dummy
= { cdr : null };
833 var needsAssig
= true;
850 /*** META ((export #t)) */
851 function sc_delete(o
, l
) {
852 var dummy
= { cdr : null };
855 if (!sc_isEqual(l
.car
, o
)) {
856 tail
.cdr
= sc_cons(l
.car
, null);
864 /*** META ((export #t)) */
865 function sc_deleteBang(o
, l
) {
866 var dummy
= { cdr : null };
868 var needsAssig
= true;
870 if (sc_isEqual(l
.car
, o
)) {
885 function sc_reverseAppendBang(l1
, l2
) {
887 while (l1
!== null) {
896 function sc_dualAppend(l1
, l2
) {
897 if (l1
=== null) return l2
;
898 if (l2
=== null) return l1
;
899 var rev
= sc_reverse(l1
);
900 return sc_reverseAppendBang(rev
, l2
);
903 /*** META ((export #t)) */
904 function sc_append() {
905 if (arguments
.length
=== 0)
907 var res
= arguments
[arguments
.length
- 1];
908 for (var i
= arguments
.length
- 2; i
>= 0; i
--)
909 res
= sc_dualAppend(arguments
[i
], res
);
913 function sc_dualAppendBang(l1
, l2
) {
914 if (l1
=== null) return l2
;
915 if (l2
=== null) return l1
;
917 while (tmp
.cdr
!== null) tmp
=tmp
.cdr
;
922 /*** META ((export #t)) */
923 function sc_appendBang() {
925 for (var i
= 0; i
< arguments
.length
; i
++)
926 res
= sc_dualAppendBang(res
, arguments
[i
]);
930 /*** META ((export #t)) */
931 function sc_reverse(l1
) {
933 while (l1
!== null) {
934 res
= sc_cons(l1
.car
, res
);
940 /*** META ((export #t)) */
941 function sc_reverseBang(l
) {
942 return sc_reverseAppendBang(l
, null);
945 /*** META ((export #t)) */
946 function sc_listTail(l
, k
) {
948 for (var i
= 0; i
< k
; i
++) {
954 /*** META ((export #t)) */
955 function sc_listRef(l
, k
) {
956 return sc_listTail(l
, k
).car
;
959 /* // unoptimized generic versions
960 function sc_memX(o, l, comp) {
968 function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); }
969 function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); }
970 function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); }
973 /* optimized versions */
974 /*** META ((export #t)) */
975 function sc_memq(o
, l
) {
983 /*** META ((export #t)) */
984 function sc_memv(o
, l
) {
992 /*** META ((export #t)) */
993 function sc_member(o
, l
) {
995 if (sc_isEqual(l
.car
,o
))
1002 /* // generic unoptimized versions
1003 function sc_assX(o, al, comp) {
1004 while (al != null) {
1005 if (comp(al.car.car, o))
1011 function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); }
1012 function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); }
1013 function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); }
1015 // optimized versions
1016 /*** META ((export #t)) */
1017 function sc_assq(o
, al
) {
1018 while (al
!== null) {
1019 if (al
.car
.car
=== o
)
1025 /*** META ((export #t)) */
1026 function sc_assv(o
, al
) {
1027 while (al
!== null) {
1028 if (al
.car
.car
=== o
)
1034 /*** META ((export #t)) */
1035 function sc_assoc(o
, al
) {
1036 while (al
!== null) {
1037 if (sc_isEqual(al
.car
.car
, o
))
1044 /* can be used for mutable strings and characters */
1045 function sc_isCharStringEqual(cs1
, cs2
) { return cs1
.val
=== cs2
.val
; }
1046 function sc_isCharStringLess(cs1
, cs2
) { return cs1
.val
< cs2
.val
; }
1047 function sc_isCharStringGreater(cs1
, cs2
) { return cs1
.val
> cs2
.val
; }
1048 function sc_isCharStringLessEqual(cs1
, cs2
) { return cs1
.val
<= cs2
.val
; }
1049 function sc_isCharStringGreaterEqual(cs1
, cs2
) { return cs1
.val
>= cs2
.val
; }
1050 function sc_isCharStringCIEqual(cs1
, cs2
)
1051 { return cs1
.val
.toLowerCase() === cs2
.val
.toLowerCase(); }
1052 function sc_isCharStringCILess(cs1
, cs2
)
1053 { return cs1
.val
.toLowerCase() < cs2
.val
.toLowerCase(); }
1054 function sc_isCharStringCIGreater(cs1
, cs2
)
1055 { return cs1
.val
.toLowerCase() > cs2
.val
.toLowerCase(); }
1056 function sc_isCharStringCILessEqual(cs1
, cs2
)
1057 { return cs1
.val
.toLowerCase() <= cs2
.val
.toLowerCase(); }
1058 function sc_isCharStringCIGreaterEqual(cs1
, cs2
)
1059 { return cs1
.val
.toLowerCase() >= cs2
.val
.toLowerCase(); }
1064 function sc_Char(c
) {
1065 var cached
= sc_Char
.lazy
[c
];
1069 sc_Char
.lazy
[c
] = this;
1070 // add return, so FF does not complain.
1073 sc_Char
.lazy
= new Object();
1075 sc_Char
.char2readable
= {
1078 "\010": "#\\backspace",
1080 "\012": "#\\newline",
1082 "\015": "#\\return",
1083 "\033": "#\\escape",
1085 "\177": "#\\delete",
1087 /* poeticless names */
1117 sc_Char
.readable2char
= {
1120 "backspace": "\010",
1162 sc_Char
.prototype.toString = function() {
1165 // sc_toDisplayString == toString
1166 sc_Char
.prototype.sc_toWriteString = function() {
1167 var entry
= sc_Char
.char2readable
[this.val
];
1171 return "#\\" + this.val
;
1174 /*** META ((export #t)
1176 (peephole (postfix "instanceof sc_Char")))
1178 function sc_isChar(c
) {
1179 return (c
instanceof sc_Char
);
1182 /*** META ((export char=?)
1184 (peephole (hole 2 c1 ".val === " c2 ".val")))
1186 var sc_isCharEqual
= sc_isCharStringEqual
;
1187 /*** META ((export char<?)
1189 (peephole (hole 2 c1 ".val < " c2 ".val")))
1191 var sc_isCharLess
= sc_isCharStringLess
;
1192 /*** META ((export char>?)
1194 (peephole (hole 2 c1 ".val > " c2 ".val")))
1196 var sc_isCharGreater
= sc_isCharStringGreater
;
1197 /*** META ((export char<=?)
1199 (peephole (hole 2 c1 ".val <= " c2 ".val")))
1201 var sc_isCharLessEqual
= sc_isCharStringLessEqual
;
1202 /*** META ((export char>=?)
1204 (peephole (hole 2 c1 ".val >= " c2 ".val")))
1206 var sc_isCharGreaterEqual
= sc_isCharStringGreaterEqual
;
1207 /*** META ((export char-ci=?)
1209 (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()")))
1211 var sc_isCharCIEqual
= sc_isCharStringCIEqual
;
1212 /*** META ((export char-ci<?)
1214 (peephole (hole 2 c1 ".val.toLowerCase() < " c2 ".val.toLowerCase()")))
1216 var sc_isCharCILess
= sc_isCharStringCILess
;
1217 /*** META ((export char-ci>?)
1219 (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()")))
1221 var sc_isCharCIGreater
= sc_isCharStringCIGreater
;
1222 /*** META ((export char-ci<=?)
1224 (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()")))
1226 var sc_isCharCILessEqual
= sc_isCharStringCILessEqual
;
1227 /*** META ((export char-ci>=?)
1229 (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()")))
1231 var sc_isCharCIGreaterEqual
= sc_isCharStringCIGreaterEqual
;
1233 var SC_NUMBER_CLASS
= "0123456789";
1234 var SC_WHITESPACE_CLASS
= ' \r\n\t\f';
1235 var SC_LOWER_CLASS
= 'abcdefghijklmnopqrstuvwxyz';
1236 var SC_UPPER_CLASS
= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
1238 function sc_isCharOfClass(c
, cl
) { return (cl
.indexOf(c
) != -1); }
1239 /*** META ((export #t)
1242 function sc_isCharAlphabetic(c
)
1243 { return sc_isCharOfClass(c
.val
, SC_LOWER_CLASS
) ||
1244 sc_isCharOfClass(c
.val
, SC_UPPER_CLASS
); }
1245 /*** META ((export #t)
1247 (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1")))
1249 function sc_isCharNumeric(c
)
1250 { return sc_isCharOfClass(c
.val
, SC_NUMBER_CLASS
); }
1251 /*** META ((export #t)
1254 function sc_isCharWhitespace(c
) {
1256 return tmp
=== " " || tmp
=== "\r" || tmp
=== "\n" || tmp
=== "\t" || tmp
=== "\f";
1258 /*** META ((export #t)
1260 (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1")))
1262 function sc_isCharUpperCase(c
)
1263 { return sc_isCharOfClass(c
.val
, SC_UPPER_CLASS
); }
1264 /*** META ((export #t)
1266 (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1")))
1268 function sc_isCharLowerCase(c
)
1269 { return sc_isCharOfClass(c
.val
, SC_LOWER_CLASS
); }
1271 /*** META ((export #t)
1272 (peephole (postfix ".val.charCodeAt(0)")))
1274 function sc_char2integer(c
)
1275 { return c
.val
.charCodeAt(0); }
1276 /*** META ((export #t)
1277 (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))")))
1279 function sc_integer2char(n
)
1280 { return new sc_Char(String
.fromCharCode(n
)); }
1282 /*** META ((export #t)
1283 (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())")))
1285 function sc_charUpcase(c
)
1286 { return new sc_Char(c
.val
.toUpperCase()); }
1287 /*** META ((export #t)
1288 (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())")))
1290 function sc_charDowncase(c
)
1291 { return new sc_Char(c
.val
.toLowerCase()); }
1293 function sc_makeJSStringOfLength(k
, c
) {
1295 if (c
=== undefined)
1301 // every round doubles the size of fill.
1304 res
= res
.concat(fill
);
1305 fill
= fill
.concat(fill
);
1311 function sc_makejsString(k
, c
) {
1317 return sc_makeJSStringOfLength(k
, fill
);
1320 function sc_jsstring2list(s
) {
1322 for (var i
= s
.length
- 1; i
>= 0; i
--)
1323 res
= sc_cons(new sc_Char(s
.charAt(i
)), res
);
1327 function sc_list2jsstring(l
) {
1328 var a
= new Array();
1333 return "".concat
.apply("", a
);
1336 var sc_Vector
= Array
;
1338 sc_Vector
.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay
) {
1339 if (this.length
=== 0) return "#()";
1341 var res
= "#(" + writeOrDisplay(this[0]);
1342 for (var i
= 1; i
< this.length
; i
++)
1343 res
+= " " + writeOrDisplay(this[i
]);
1347 sc_Vector
.prototype.sc_toDisplayString = function() {
1348 return this.sc_toWriteOrDisplayString(sc_toDisplayString
);
1350 sc_Vector
.prototype.sc_toWriteString = function() {
1351 return this.sc_toWriteOrDisplayString(sc_toWriteString
);
1354 /*** META ((export vector? array?)
1356 (peephole (postfix " instanceof sc_Vector")))
1358 function sc_isVector(v
) {
1359 return (v
instanceof sc_Vector
);
1362 // only applies to vectors
1363 function sc_isVectorEqual(v1
, v2
, comp
) {
1364 if (v1
.length
!== v2
.length
) return false;
1365 for (var i
= 0; i
< v1
.length
; i
++)
1366 if (!comp(v1
[i
], v2
[i
])) return false;
1370 /*** META ((export make-vector make-array)) */
1371 function sc_makeVector(size
, fill
) {
1372 var a
= new sc_Vector(size
);
1373 if (fill
!== undefined)
1374 sc_vectorFillBang(a
, fill
);
1378 /*** META ((export vector array)
1379 (peephole (vector)))
1381 function sc_vector() {
1382 var a
= new sc_Vector();
1383 for (var i
= 0; i
< arguments
.length
; i
++)
1384 a
.push(arguments
[i
]);
1388 /*** META ((export vector-length array-length)
1389 (peephole (postfix ".length")))
1391 function sc_vectorLength(v
) {
1395 /*** META ((export vector-ref array-ref)
1396 (peephole (hole 2 v "[" pos "]")))
1398 function sc_vectorRef(v
, pos
) {
1402 /*** META ((export vector-set! array-set!)
1403 (peephole (hole 3 v "[" pos "] = " val)))
1405 function sc_vectorSetBang(v
, pos
, val
) {
1409 /*** META ((export vector->list array->list)) */
1410 function sc_vector2list(a
) {
1412 for (var i
= a
.length
-1; i
>= 0; i
--)
1413 res
= sc_cons(a
[i
], res
);
1417 /*** META ((export list->vector list->array)) */
1418 function sc_list2vector(l
) {
1419 var a
= new sc_Vector();
1427 /*** META ((export vector-fill! array-fill!)) */
1428 function sc_vectorFillBang(a
, fill
) {
1429 for (var i
= 0; i
< a
.length
; i
++)
1434 /*** META ((export #t)) */
1435 function sc_copyVector(a
, len
) {
1436 if (len
<= a
.length
)
1437 return a
.slice(0, len
);
1439 var tmp
= a
.concat();
1445 /*** META ((export #t)
1446 (peephole (hole 3 a ".slice(" start "," end ")")))
1448 function sc_vectorCopy(a
, start
, end
) {
1449 return a
.slice(start
, end
);
1452 /*** META ((export #t)) */
1453 function sc_vectorCopyBang(target
, tstart
, source
, sstart
, send
) {
1454 if (!sstart
) sstart
= 0;
1455 if (!send
) send
= source
.length
;
1457 // if target == source we don't want to overwrite not yet copied elements.
1458 if (tstart
<= sstart
) {
1459 for (var i
= tstart
, j
= sstart
; j
< send
; i
++, j
++) {
1460 target
[i
] = source
[j
];
1463 var diff
= send
- sstart
;
1464 for (var i
= tstart
+ diff
- 1, j
= send
- 1;
1467 target
[i
] = source
[j
];
1473 /*** META ((export #t)
1475 (peephole (hole 1 "typeof " o " === 'function'")))
1477 function sc_isProcedure(o
) {
1478 return (typeof o
=== "function");
1481 /*** META ((export #t)) */
1482 function sc_apply(proc
) {
1483 var args
= new Array();
1484 // first part of arguments are not in list-form.
1485 for (var i
= 1; i
< arguments
.length
- 1; i
++)
1486 args
.push(arguments
[i
]);
1487 var l
= arguments
[arguments
.length
- 1];
1488 while (l
!== null) {
1492 return proc
.apply(null, args
);
1495 /*** META ((export #t)) */
1496 function sc_map(proc
, l1
) {
1497 if (l1
=== undefined)
1500 var nbApplyArgs
= arguments
.length
- 1;
1501 var applyArgs
= new Array(nbApplyArgs
);
1503 while (l1
!== null) {
1504 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1505 applyArgs
[i
] = arguments
[i
+ 1].car
;
1506 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1508 revres
= sc_cons(proc
.apply(null, applyArgs
), revres
);
1510 return sc_reverseAppendBang(revres
, null);
1513 /*** META ((export #t)) */
1514 function sc_mapBang(proc
, l1
) {
1515 if (l1
=== undefined)
1519 var nbApplyArgs
= arguments
.length
- 1;
1520 var applyArgs
= new Array(nbApplyArgs
);
1521 while (l1
!== null) {
1523 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1524 applyArgs
[i
] = arguments
[i
+ 1].car
;
1525 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1527 tmp
.car
= proc
.apply(null, applyArgs
);
1532 /*** META ((export #t)) */
1533 function sc_forEach(proc
, l1
) {
1534 if (l1
=== undefined)
1537 var nbApplyArgs
= arguments
.length
- 1;
1538 var applyArgs
= new Array(nbApplyArgs
);
1539 while (l1
!== null) {
1540 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1541 applyArgs
[i
] = arguments
[i
+ 1].car
;
1542 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1544 proc
.apply(null, applyArgs
);
1546 // add return so FF does not complain.
1550 /*** META ((export #t)) */
1551 function sc_filter(proc
, l1
) {
1552 var dummy
= { cdr : null };
1554 while (l1
!== null) {
1555 if (proc(l1
.car
) !== false) {
1556 tail
.cdr
= sc_cons(l1
.car
, null);
1564 /*** META ((export #t)) */
1565 function sc_filterBang(proc
, l1
) {
1566 var head
= sc_cons("dummy", l1
);
1569 while (next
!== null) {
1570 if (proc(next
.car
) !== false) {
1580 function sc_filterMap1(proc
, l1
) {
1582 while (l1
!== null) {
1583 var tmp
= proc(l1
.car
)
1584 if (tmp
!== false) revres
= sc_cons(tmp
, revres
);
1587 return sc_reverseAppendBang(revres
, null);
1589 function sc_filterMap2(proc
, l1
, l2
) {
1591 while (l1
!== null) {
1592 var tmp
= proc(l1
.car
, l2
.car
);
1593 if(tmp
!== false) revres
= sc_cons(tmp
, revres
);
1597 return sc_reverseAppendBang(revres
, null);
1600 /*** META ((export #t)) */
1601 function sc_filterMap(proc
, l1
, l2
, l3
) {
1602 if (l2
=== undefined)
1603 return sc_filterMap1(proc
, l1
);
1604 else if (l3
=== undefined)
1605 return sc_filterMap2(proc
, l1
, l2
);
1607 var nbApplyArgs
= arguments
.length
- 1;
1608 var applyArgs
= new Array(nbApplyArgs
);
1610 while (l1
!== null) {
1611 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1612 applyArgs
[i
] = arguments
[i
+ 1].car
;
1613 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1615 var tmp
= proc
.apply(null, applyArgs
);
1616 if(tmp
!== false) revres
= sc_cons(tmp
, revres
);
1618 return sc_reverseAppendBang(revres
, null);
1621 /*** META ((export #t)) */
1622 function sc_any(proc
, l
) {
1624 while (l
!== null) {
1625 var tmp
= proc(l
.car
);
1626 if(tmp
!== false) return tmp
;
1632 /*** META ((export any?)
1633 (peephole (hole 2 "sc_any(" proc "," l ") !== false")))
1635 function sc_anyPred(proc
, l
) {
1636 return sc_any(proc
, l
)!== false;
1639 /*** META ((export #t)) */
1640 function sc_every(proc
, l
) {
1643 while (l
!== null) {
1645 if (tmp
=== false) return false;
1651 /*** META ((export every?)
1652 (peephole (hole 2 "sc_every(" proc "," l ") !== false")))
1654 function sc_everyPred(proc
, l
) {
1655 var tmp
= sc_every(proc
, l
);
1656 if (tmp
!== false) return true;
1660 /*** META ((export #t)
1661 (peephole (postfix "()")))
1663 function sc_force(o
) {
1667 /*** META ((export #t)) */
1668 function sc_makePromise(proc
) {
1669 var isResultReady
= false;
1670 var result
= undefined;
1672 if (!isResultReady
) {
1674 if (!isResultReady
) {
1675 isResultReady
= true;
1683 function sc_Values(values
) {
1684 this.values
= values
;
1687 /*** META ((export #t)
1688 (peephole (values)))
1690 function sc_values() {
1691 if (arguments
.length
=== 1)
1692 return arguments
[0];
1694 return new sc_Values(arguments
);
1697 /*** META ((export #t)) */
1698 function sc_callWithValues(producer
, consumer
) {
1699 var produced
= producer();
1700 if (produced
instanceof sc_Values
)
1701 return consumer
.apply(null, produced
.values
);
1703 return consumer(produced
);
1706 /*** META ((export #t)) */
1707 function sc_dynamicWind(before
, thunk
, after
) {
1718 // TODO: eval/scheme-report-environment/null-environment/interaction-environment
1720 // LIMITATION: 'load' doesn't exist without files.
1721 // LIMITATION: transcript-on/transcript-off doesn't exist without files.
1724 function sc_Struct(name
) {
1727 sc_Struct
.prototype.sc_toDisplayString = function() {
1728 return "#<struct" + sc_hash(this) + ">";
1730 sc_Struct
.prototype.sc_toWriteString
= sc_Struct
.prototype.sc_toDisplayString
;
1732 /*** META ((export #t)
1733 (peephole (hole 1 "new sc_Struct(" name ")")))
1735 function sc_makeStruct(name
) {
1736 return new sc_Struct(name
);
1739 /*** META ((export #t)
1741 (peephole (postfix " instanceof sc_Struct")))
1743 function sc_isStruct(o
) {
1744 return (o
instanceof sc_Struct
);
1747 /*** META ((export #t)
1749 (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")")))
1751 function sc_isStructNamed(name
, s
) {
1752 return ((s
instanceof sc_Struct
) && (s
.name
=== name
));
1755 /*** META ((export struct-field)
1756 (peephole (hole 3 0 "[" 2 "]")))
1758 function sc_getStructField(s
, name
, field
) {
1762 /*** META ((export struct-field-set!)
1763 (peephole (hole 4 0 "[" 2 "] = " 3)))
1765 function sc_setStructFieldBang(s
, name
, field
, val
) {
1769 /*** META ((export #t)
1770 (peephole (prefix "~")))
1772 function sc_bitNot(x
) {
1776 /*** META ((export #t)
1777 (peephole (infix 2 2 "&")))
1779 function sc_bitAnd(x
, y
) {
1783 /*** META ((export #t)
1784 (peephole (infix 2 2 "|")))
1786 function sc_bitOr(x
, y
) {
1790 /*** META ((export #t)
1791 (peephole (infix 2 2 "^")))
1793 function sc_bitXor(x
, y
) {
1797 /*** META ((export #t)
1798 (peephole (infix 2 2 "<<")))
1800 function sc_bitLsh(x
, y
) {
1804 /*** META ((export #t)
1805 (peephole (infix 2 2 ">>")))
1807 function sc_bitRsh(x
, y
) {
1811 /*** META ((export #t)
1812 (peephole (infix 2 2 ">>>")))
1814 function sc_bitUrsh(x
, y
) {
1818 /*** META ((export js-field js-property)
1819 (peephole (hole 2 o "[" field "]")))
1821 function sc_jsField(o
, field
) {
1825 /*** META ((export js-field-set! js-property-set!)
1826 (peephole (hole 3 o "[" field "] = " val)))
1828 function sc_setJsFieldBang(o
, field
, val
) {
1829 return o
[field
] = val
;
1832 /*** META ((export js-field-delete! js-property-delete!)
1833 (peephole (hole 2 "delete" o "[" field "]")))
1835 function sc_deleteJsFieldBang(o
, field
) {
1839 /*** META ((export #t)
1840 (peephole (jsCall)))
1842 function sc_jsCall(o
, fun
) {
1843 var args
= new Array();
1844 for (var i
= 2; i
< arguments
.length
; i
++)
1845 args
[i
-2] = arguments
[i
];
1846 return fun
.apply(o
, args
);
1849 /*** META ((export #t)
1850 (peephole (jsMethodCall)))
1852 function sc_jsMethodCall(o
, field
) {
1853 var args
= new Array();
1854 for (var i
= 2; i
< arguments
.length
; i
++)
1855 args
[i
-2] = arguments
[i
];
1856 return o
[field
].apply(o
, args
);
1859 /*** META ((export new js-new)
1862 function sc_jsNew(c
) {
1863 var evalStr
= "new c(";
1864 evalStr
+=arguments
.length
> 1? "arguments[1]": "";
1865 for (var i
= 2; i
< arguments
.length
; i
++)
1866 evalStr
+= ", arguments[" + i
+ "]";
1868 return eval(evalStr
);
1871 // ======================== RegExp ====================
1872 /*** META ((export #t)) */
1873 function sc_pregexp(re
) {
1874 return new RegExp(sc_string2jsstring(re
));
1877 /*** META ((export #t)) */
1878 function sc_pregexpMatch(re
, s
) {
1879 var reg
= (re
instanceof RegExp
) ? re : sc_pregexp(re
);
1880 var tmp
= reg
.exec(sc_string2jsstring(s
));
1882 if (tmp
== null) return false;
1885 for (var i
= tmp
.length
-1; i
>= 0; i
--) {
1886 if (tmp
[i
] !== null) {
1887 res
= sc_cons(sc_jsstring2string(tmp
[i
]), res
);
1889 res
= sc_cons(false, res
);
1895 /*** META ((export #t)) */
1896 function sc_pregexpReplace(re
, s1
, s2
) {
1898 var jss1
= sc_string2jsstring(s1
);
1899 var jss2
= sc_string2jsstring(s2
);
1901 if (re
instanceof RegExp
) {
1905 reg
= new RegExp(re
.source
);
1907 reg
= new RegExp(sc_string2jsstring(re
));
1910 return jss1
.replace(reg
, jss2
);
1913 /*** META ((export pregexp-replace*)) */
1914 function sc_pregexpReplaceAll(re
, s1
, s2
) {
1916 var jss1
= sc_string2jsstring(s1
);
1917 var jss2
= sc_string2jsstring(s2
);
1919 if (re
instanceof RegExp
) {
1923 reg
= new RegExp(re
.source
, "g");
1925 reg
= new RegExp(sc_string2jsstring(re
), "g");
1928 return jss1
.replace(reg
, jss2
);
1931 /*** META ((export #t)) */
1932 function sc_pregexpSplit(re
, s
) {
1933 var reg
= ((re
instanceof RegExp
) ?
1935 new RegExp(sc_string2jsstring(re
)));
1936 var jss
= sc_string2jsstring(s
);
1937 var tmp
= jss
.split(reg
);
1939 if (tmp
== null) return false;
1941 return sc_vector2list(tmp
);
1945 /* =========================================================================== */
1946 /* Other library stuff */
1947 /* =========================================================================== */
1949 /*** META ((export #t)
1950 (peephole (hole 1 "Math.floor(Math.random()*" 'n ")")))
1952 function sc_random(n
) {
1953 return Math
.floor(Math
.random()*n
);
1956 /*** META ((export current-date)
1957 (peephole (hole 0 "new Date()")))
1959 function sc_currentDate() {
1963 function sc_Hashtable() {
1965 sc_Hashtable
.prototype.toString = function() {
1966 return "#{%hashtable}";
1968 // sc_toWriteString == sc_toDisplayString == toString
1970 function sc_HashtableElement(key
, val
) {
1975 /*** META ((export #t)
1976 (peephole (hole 0 "new sc_Hashtable()")))
1978 function sc_makeHashtable() {
1979 return new sc_Hashtable();
1982 /*** META ((export #t)) */
1983 function sc_hashtablePutBang(ht
, key
, val
) {
1984 var hash
= sc_hash(key
);
1985 ht
[hash
] = new sc_HashtableElement(key
, val
);
1988 /*** META ((export #t)) */
1989 function sc_hashtableGet(ht
, key
) {
1990 var hash
= sc_hash(key
);
1992 return ht
[hash
].val
;
1997 /*** META ((export #t)) */
1998 function sc_hashtableForEach(ht
, f
) {
2000 if (ht
[v
] instanceof sc_HashtableElement
)
2001 f(ht
[v
].key
, ht
[v
].val
);
2005 /*** META ((export hashtable-contains?)
2006 (peephole (hole 2 "sc_hash(" 1 ") in " 0)))
2008 function sc_hashtableContains(ht
, key
) {
2009 var hash
= sc_hash(key
);
2016 var SC_HASH_COUNTER
= 0;
2018 function sc_hash(o
) {
2021 else if (o
=== undefined)
2023 else if (o
=== true)
2025 else if (o
=== false)
2027 else if (typeof o
=== "number")
2029 else if (typeof o
=== "string")
2030 return "jsstr-" + o
;
2031 else if (o
.sc_getHash
)
2032 return o
.sc_getHash();
2034 return sc_counterHash
.call(o
);
2036 function sc_counterHash() {
2037 if (!this.sc_hash
) {
2038 this.sc_hash
= "hash-" + SC_HASH_COUNTER
;
2041 return this.sc_hash
;
2044 function sc_Trampoline(args
, maxTailCalls
) {
2045 this['__trampoline return__'] = true;
2047 this.MAX_TAIL_CALLs
= maxTailCalls
;
2049 // TODO: call/cc stuff
2050 sc_Trampoline
.prototype.restart = function() {
2053 // set both globals.
2054 SC_TAIL_OBJECT
.calls
= o
.MAX_TAIL_CALLs
-1;
2055 var fun
= o
.args
.callee
;
2056 var res
= fun
.apply(SC_TAIL_OBJECT
, o
.args
);
2057 if (res
instanceof sc_Trampoline
)
2064 /*** META ((export bind-exit-lambda)) */
2065 function sc_bindExitLambda(proc
) {
2066 var escape_obj
= new sc_BindExitException();
2067 var escape = function(res
) {
2068 escape_obj
.res
= res
;
2072 return proc(escape
);
2074 if (e
=== escape_obj
) {
2080 function sc_BindExitException() {
2081 this._internalException
= true;
2084 var SC_SCM2JS_GLOBALS
= new Object();
2086 // default tail-call depth.
2087 // normally the program should set it again. but just in case...
2088 var SC_TAIL_OBJECT
= new Object();
2089 SC_SCM2JS_GLOBALS
.TAIL_OBJECT
= SC_TAIL_OBJECT
;
2090 // ======================== I/O =======================
2092 /*------------------------------------------------------------------*/
2096 var SC_EOF_OBJECT
= new sc_EOF();
2098 function sc_Port() {
2101 /* --------------- Input ports -------------------------------------*/
2103 function sc_InputPort() {
2105 sc_InputPort
.prototype = new sc_Port();
2107 sc_InputPort
.prototype.peekChar = function() {
2108 if (!("peeked" in this))
2109 this.peeked
= this.getNextChar();
2112 sc_InputPort
.prototype.readChar = function() {
2113 var tmp
= this.peekChar();
2117 sc_InputPort
.prototype.isCharReady = function() {
2120 sc_InputPort
.prototype.close = function() {
2124 /* .............. String port ..........................*/
2125 function sc_ErrorInputPort() {
2127 sc_ErrorInputPort
.prototype = new sc_InputPort();
2128 sc_ErrorInputPort
.prototype.getNextChar = function() {
2129 throw "can't read from error-port.";
2131 sc_ErrorInputPort
.prototype.isCharReady = function() {
2136 /* .............. String port ..........................*/
2138 function sc_StringInputPort(jsStr
) {
2139 // we are going to do some charAts on the str.
2140 // instead of recreating all the time a String-object, we
2141 // create one in the beginning. (not sure, if this is really an optim)
2142 this.str
= new String(jsStr
);
2145 sc_StringInputPort
.prototype = new sc_InputPort();
2146 sc_StringInputPort
.prototype.getNextChar = function() {
2147 if (this.pos
>= this.str
.length
)
2148 return SC_EOF_OBJECT
;
2149 return this.str
.charAt(this.pos
++);
2152 /* ------------- Read and other lib-funs -------------------------------*/
2153 function sc_Token(type
, val
, pos
) {
2158 sc_Token
.EOF
= 0/*EOF*/;
2159 sc_Token
.OPEN_PAR
= 1/*OPEN_PAR*/;
2160 sc_Token
.CLOSE_PAR
= 2/*CLOSE_PAR*/;
2161 sc_Token
.OPEN_BRACE
= 3/*OPEN_BRACE*/;
2162 sc_Token
.CLOSE_BRACE
= 4/*CLOSE_BRACE*/;
2163 sc_Token
.OPEN_BRACKET
= 5/*OPEN_BRACKET*/;
2164 sc_Token
.CLOSE_BRACKET
= 6/*CLOSE_BRACKET*/;
2165 sc_Token
.WHITESPACE
= 7/*WHITESPACE*/;
2166 sc_Token
.QUOTE
= 8/*QUOTE*/;
2167 sc_Token
.ID
= 9/*ID*/;
2168 sc_Token
.DOT
= 10/*DOT*/;
2169 sc_Token
.STRING
= 11/*STRING*/;
2170 sc_Token
.NUMBER
= 12/*NUMBER*/;
2171 sc_Token
.ERROR
= 13/*ERROR*/;
2172 sc_Token
.VECTOR_BEGIN
= 14/*VECTOR_BEGIN*/;
2173 sc_Token
.TRUE
= 15/*TRUE*/;
2174 sc_Token
.FALSE
= 16/*FALSE*/;
2175 sc_Token
.UNSPECIFIED
= 17/*UNSPECIFIED*/;
2176 sc_Token
.REFERENCE
= 18/*REFERENCE*/;
2177 sc_Token
.STORE
= 19/*STORE*/;
2178 sc_Token
.CHAR
= 20/*CHAR*/;
2180 var SC_ID_CLASS
= SC_LOWER_CLASS
+ SC_UPPER_CLASS
+ "!$%*+-./:<=>?@^_~";
2181 function sc_Tokenizer(port
) {
2184 sc_Tokenizer
.prototype.peekToken = function() {
2187 var newToken
= this.nextToken();
2188 this.peeked
= newToken
;
2191 sc_Tokenizer
.prototype.readToken = function() {
2192 var tmp
= this.peekToken();
2196 sc_Tokenizer
.prototype.nextToken = function() {
2197 var port
= this.port
;
2199 function isNumberChar(c
) {
2200 return (c
>= "0" && c
<= "9");
2202 function isIdOrNumberChar(c
) {
2203 return SC_ID_CLASS
.indexOf(c
) != -1 || // ID-char
2204 (c
>= "0" && c
<= "9");
2206 function isWhitespace(c
) {
2207 return c
=== " " || c
=== "\r" || c
=== "\n" || c
=== "\t" || c
=== "\f";
2209 function isWhitespaceOrEOF(c
) {
2210 return isWhitespace(c
) || c
=== SC_EOF_OBJECT
;
2213 function readString() {
2216 var c
= port
.readChar();
2219 return new sc_Token(11/*STRING*/, res
);
2221 var tmp
= port
.readChar();
2223 case '0': res
+= "\0"; break;
2224 case 'a': res
+= "\a"; break;
2225 case 'b': res
+= "\b"; break;
2226 case 'f': res
+= "\f"; break;
2227 case 'n': res
+= "\n"; break;
2228 case 'r': res
+= "\r"; break;
2229 case 't': res
+= "\t"; break;
2230 case 'v': res
+= "\v"; break;
2231 case '"': res
+= '"'; break;
2232 case '\\': res
+= '\\'; break;
2237 var hexC
= port
.peekChar();
2238 if (hexC
>= '0' && hexC
<= '9') {
2240 nb
= nb
* 16 + hexC
.charCodeAt(0) - '0'.charCodeAt(0);
2241 } else if (hexC
>= 'a' && hexC
<= 'f') {
2243 nb
= nb
* 16 + hexC
.charCodeAt(0) - 'a'.charCodeAt(0);
2244 } else if (hexC
>= 'A' && hexC
<= 'F') {
2246 nb
= nb
* 16 + hexC
.charCodeAt(0) - 'A'.charCodeAt(0);
2248 // next char isn't part of hex.
2249 res
+= String
.fromCharCode(nb
);
2255 if (tmp
=== SC_EOF_OBJECT
) {
2256 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res
);
2262 if (c
=== SC_EOF_OBJECT
) {
2263 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res
);
2269 function readIdOrNumber(firstChar
) {
2270 var res
= firstChar
;
2271 while (isIdOrNumberChar(port
.peekChar()))
2272 res
+= port
.readChar();
2274 return new sc_Token(9/*ID*/, res
);
2276 return new sc_Token(12/*NUMBER*/, res
- 0);
2279 function skipWhitespaceAndComments() {
2283 while (isWhitespace(port
.peekChar()))
2285 if (port
.peekChar() === ';') {
2289 curChar
= port
.readChar();
2290 if (curChar
=== SC_EOF_OBJECT
||
2298 function readDot() {
2299 if (isWhitespace(port
.peekChar()))
2300 return new sc_Token(10/*DOT*/);
2302 return readIdOrNumber(".");
2305 function readSharp() {
2306 var c
= port
.readChar();
2307 if (isWhitespace(c
))
2308 return new sc_Token(13/*ERROR*/, "bad #-pattern0.");
2311 if (isNumberChar(c
)) {
2313 while (isNumberChar(port
.peekChar()))
2314 nb
= nb
*10 + (port
.readChar() - 0);
2315 switch (port
.readChar()) {
2317 return new sc_Token(18/*REFERENCE*/, nb
);
2319 return new sc_Token(19/*STORE*/, nb
);
2321 return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb
);
2326 return new sc_Token(14/*VECTOR_BEGIN*/);
2328 if (c
=== "\\") { // character
2330 while (!isWhitespaceOrEOF(port
.peekChar()))
2331 tmp
+= port
.readChar();
2332 switch (tmp
.length
) {
2333 case 0: // it's escaping a whitespace char:
2334 if (sc_isEOFObject(port
.peekChar
))
2335 return new sc_Token(13/*ERROR*/, "bad #-pattern2.");
2337 return new sc_Token(20/*CHAR*/, port
.readChar());
2339 return new sc_Token(20/*CHAR*/, tmp
);
2341 var entry
= sc_Char
.readable2char
[tmp
.toLowerCase()];
2343 return new sc_Token(20/*CHAR*/, entry
);
2345 return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp
);
2349 // some constants (#t, #f, #unspecified)
2353 case 't': res
= new sc_Token(15/*TRUE*/, true); needing
= ""; break;
2354 case 'f': res
= new sc_Token(16/*FALSE*/, false); needing
= ""; break;
2355 case 'u': res
= new sc_Token(17/*UNSPECIFIED*/, undefined); needing
= "nspecified"; break;
2357 return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c
);
2360 c
= port
.peekChar();
2361 if ((isWhitespaceOrEOF(c
) || c
=== ')') &&
2364 else if (isWhitespace(c
) || needing
== "")
2365 return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c
+ " " + needing
);
2366 else if (needing
.charAt(0) == c
) {
2367 port
.readChar(); // consume
2368 needing
= needing
.slice(1);
2370 return new sc_Token(13/*ERROR*/, "bad #-pattern5");
2375 skipWhitespaceAndComments();
2376 var curChar
= port
.readChar();
2377 if (curChar
=== SC_EOF_OBJECT
)
2378 return new sc_Token(0/*EOF*/, curChar
);
2384 return readWhitespace();
2386 return new sc_Token(1/*OPEN_PAR*/);
2388 return new sc_Token(2/*CLOSE_PAR*/);
2390 return new sc_Token(3/*OPEN_BRACE*/);
2392 return new sc_Token(4/*CLOSE_BRACE*/);
2394 return new sc_Token(5/*OPEN_BRACKET*/);
2396 return new sc_Token(6/*CLOSE_BRACKET*/);
2398 return new sc_Token(8/*QUOTE*/);
2404 return readString();
2406 if (isIdOrNumberChar(curChar
))
2407 return readIdOrNumber(curChar
);
2408 throw "unexpected character: " + curChar
;
2412 function sc_Reader(tokenizer
) {
2413 this.tokenizer
= tokenizer
;
2414 this.backref
= new Array();
2416 sc_Reader
.prototype.read = function() {
2417 function readList(listBeginType
) {
2418 function matchesPeer(open
, close
) {
2419 return open
=== 1/*OPEN_PAR*/ && close
=== 2/*CLOSE_PAR*/
2420 || open
=== 3/*OPEN_BRACE*/ && close
=== 4/*CLOSE_BRACE*/
2421 || open
=== 5/*OPEN_BRACKET*/ && close
=== 6/*CLOSE_BRACKET*/;
2426 var token
= tokenizer
.peekToken();
2428 switch (token
.type
) {
2429 case 2/*CLOSE_PAR*/:
2430 case 4/*CLOSE_BRACE*/:
2431 case 6/*CLOSE_BRACKET*/:
2432 if (matchesPeer(listBeginType
, token
.type
)) {
2433 tokenizer
.readToken(); // consume token
2434 return sc_reverseBang(res
);
2436 throw "closing par doesn't match: " + listBeginType
2437 + " " + listEndType
;
2440 throw "unexpected end of file";
2443 tokenizer
.readToken(); // consume token
2444 var cdr
= this.read();
2445 var par
= tokenizer
.readToken();
2446 if (!matchesPeer(listBeginType
, par
.type
))
2447 throw "closing par doesn't match: " + listBeginType
2450 return sc_reverseAppendBang(res
, cdr
);
2454 res
= sc_cons(this.read(), res
);
2458 function readQuote() {
2459 return sc_cons("quote", sc_cons(this.read(), null));
2461 function readVector() {
2462 // opening-parenthesis is already consumed
2463 var a
= new Array();
2465 var token
= tokenizer
.peekToken();
2466 switch (token
.type
) {
2467 case 2/*CLOSE_PAR*/:
2468 tokenizer
.readToken();
2472 a
.push(this.read());
2477 function storeRefence(nb
) {
2478 var tmp
= this.read();
2479 this.backref
[nb
] = tmp
;
2483 function readReference(nb
) {
2484 if (nb
in this.backref
)
2485 return this.backref
[nb
];
2487 throw "bad reference: " + nb
;
2490 var tokenizer
= this.tokenizer
;
2492 var token
= tokenizer
.readToken();
2495 if (token
.type
=== 13/*ERROR*/)
2498 switch (token
.type
) {
2500 case 3/*OPEN_BRACE*/:
2501 case 5/*OPEN_BRACKET*/:
2502 return readList
.call(this, token
.type
);
2504 return readQuote
.call(this);
2506 return sc_jsstring2string(token
.val
);
2508 return new sc_Char(token
.val
);
2509 case 14/*VECTOR_BEGIN*/:
2510 return readVector
.call(this);
2511 case 18/*REFERENCE*/:
2512 return readReference
.call(this, token
.val
);
2514 return storeRefence
.call(this, token
.val
);
2516 return sc_jsstring2symbol(token
.val
);
2521 case 17/*UNSPECIFIED*/:
2524 throw "unexpected token " + token
.type
+ " " + token
.val
;
2528 /*** META ((export #t)) */
2529 function sc_read(port
) {
2530 if (port
=== undefined) // we assume the port hasn't been given.
2531 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2532 var reader
= new sc_Reader(new sc_Tokenizer(port
));
2533 return reader
.read();
2535 /*** META ((export #t)) */
2536 function sc_readChar(port
) {
2537 if (port
=== undefined) // we assume the port hasn't been given.
2538 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2539 var t
= port
.readChar();
2540 return t
=== SC_EOF_OBJECT
? t: new sc_Char(t
);
2542 /*** META ((export #t)) */
2543 function sc_peekChar(port
) {
2544 if (port
=== undefined) // we assume the port hasn't been given.
2545 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2546 var t
= port
.peekChar();
2547 return t
=== SC_EOF_OBJECT
? t: new sc_Char(t
);
2549 /*** META ((export #t)
2552 function sc_isCharReady(port
) {
2553 if (port
=== undefined) // we assume the port hasn't been given.
2554 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2555 return port
.isCharReady();
2557 /*** META ((export #t)
2558 (peephole (postfix ".close()")))
2560 function sc_closeInputPort(p
) {
2564 /*** META ((export #t)
2566 (peephole (postfix " instanceof sc_InputPort")))
2568 function sc_isInputPort(o
) {
2569 return (o
instanceof sc_InputPort
);
2572 /*** META ((export eof-object?)
2574 (peephole (postfix " === SC_EOF_OBJECT")))
2576 function sc_isEOFObject(o
) {
2577 return o
=== SC_EOF_OBJECT
;
2580 /*** META ((export #t)
2581 (peephole (hole 0 "SC_DEFAULT_IN")))
2583 function sc_currentInputPort() {
2584 return SC_DEFAULT_IN
;
2587 /* ------------ file operations are not supported -----------*/
2588 /*** META ((export #t)) */
2589 function sc_callWithInputFile(s
, proc
) {
2590 throw "can't open " + s
;
2593 /*** META ((export #t)) */
2594 function sc_callWithOutputFile(s
, proc
) {
2595 throw "can't open " + s
;
2598 /*** META ((export #t)) */
2599 function sc_withInputFromFile(s
, thunk
) {
2600 throw "can't open " + s
;
2603 /*** META ((export #t)) */
2604 function sc_withOutputToFile(s
, thunk
) {
2605 throw "can't open " + s
;
2608 /*** META ((export #t)) */
2609 function sc_openInputFile(s
) {
2610 throw "can't open " + s
;
2613 /*** META ((export #t)) */
2614 function sc_openOutputFile(s
) {
2615 throw "can't open " + s
;
2618 /* ----------------------------------------------------------------------------*/
2619 /*** META ((export #t)) */
2620 function sc_basename(p
) {
2621 var i
= p
.lastIndexOf('/');
2624 return p
.substring(i
+ 1, p
.length
);
2629 /*** META ((export #t)) */
2630 function sc_dirname(p
) {
2631 var i
= p
.lastIndexOf('/');
2634 return p
.substring(0, i
);
2639 /* ----------------------------------------------------------------------------*/
2641 /*** META ((export #t)) */
2642 function sc_withInputFromPort(p
, thunk
) {
2644 var tmp
= SC_DEFAULT_IN
; // THREAD: shared var.
2648 SC_DEFAULT_IN
= tmp
;
2652 /*** META ((export #t)) */
2653 function sc_withInputFromString(s
, thunk
) {
2654 return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s
)), thunk
);
2657 /*** META ((export #t)) */
2658 function sc_withOutputToPort(p
, thunk
) {
2660 var tmp
= SC_DEFAULT_OUT
; // THREAD: shared var.
2664 SC_DEFAULT_OUT
= tmp
;
2668 /*** META ((export #t)) */
2669 function sc_withOutputToString(thunk
) {
2670 var p
= new sc_StringOutputPort();
2671 sc_withOutputToPort(p
, thunk
);
2675 /*** META ((export #t)) */
2676 function sc_withOutputToProcedure(proc
, thunk
) {
2677 var t = function(s
) { proc(sc_jsstring2string(s
)); };
2678 return sc_withOutputToPort(new sc_GenericOutputPort(t
), thunk
);
2681 /*** META ((export #t)
2682 (peephole (hole 0 "new sc_StringOutputPort()")))
2684 function sc_openOutputString() {
2685 return new sc_StringOutputPort();
2688 /*** META ((export #t)) */
2689 function sc_openInputString(str
) {
2690 return new sc_StringInputPort(sc_string2jsstring(str
));
2693 /* ----------------------------------------------------------------------------*/
2695 function sc_OutputPort() {
2697 sc_OutputPort
.prototype = new sc_Port();
2698 sc_OutputPort
.prototype.appendJSString = function(obj
) {
2701 sc_OutputPort
.prototype.close = function() {
2705 function sc_StringOutputPort() {
2708 sc_StringOutputPort
.prototype = new sc_OutputPort();
2709 sc_StringOutputPort
.prototype.appendJSString = function(s
) {
2712 sc_StringOutputPort
.prototype.close = function() {
2713 return sc_jsstring2string(this.res
);
2716 /*** META ((export #t)) */
2717 function sc_getOutputString(sp
) {
2718 return sc_jsstring2string(sp
.res
);
2722 function sc_ErrorOutputPort() {
2724 sc_ErrorOutputPort
.prototype = new sc_OutputPort();
2725 sc_ErrorOutputPort
.prototype.appendJSString = function(s
) {
2726 throw "don't write on ErrorPort!";
2728 sc_ErrorOutputPort
.prototype.close = function() {
2732 function sc_GenericOutputPort(appendJSString
, close
) {
2733 this.appendJSString
= appendJSString
;
2737 sc_GenericOutputPort
.prototype = new sc_OutputPort();
2739 /*** META ((export #t)
2741 (peephole (postfix " instanceof sc_OutputPort")))
2743 function sc_isOutputPort(o
) {
2744 return (o
instanceof sc_OutputPort
);
2747 /*** META ((export #t)
2748 (peephole (postfix ".close()")))
2750 function sc_closeOutputPort(p
) {
2754 /* ------------------ write ---------------------------------------------------*/
2756 /*** META ((export #t)) */
2757 function sc_write(o
, p
) {
2758 if (p
=== undefined) // we assume not given
2760 p
.appendJSString(sc_toWriteString(o
));
2763 function sc_toWriteString(o
) {
2766 else if (o
=== true)
2768 else if (o
=== false)
2770 else if (o
=== undefined)
2771 return "#unspecified";
2772 else if (typeof o
=== 'function')
2773 return "#<procedure " + sc_hash(o
) + ">";
2774 else if (o
.sc_toWriteString
)
2775 return o
.sc_toWriteString();
2777 return o
.toString();
2780 function sc_escapeWriteString(s
) {
2783 for (i
= 0; i
< s
.length
; i
++) {
2784 switch (s
.charAt(i
)) {
2785 case "\0": res
+= s
.substring(j
, i
) + "\\0"; j
= i
+ 1; break;
2786 case "\b": res
+= s
.substring(j
, i
) + "\\b"; j
= i
+ 1; break;
2787 case "\f": res
+= s
.substring(j
, i
) + "\\f"; j
= i
+ 1; break;
2788 case "\n": res
+= s
.substring(j
, i
) + "\\n"; j
= i
+ 1; break;
2789 case "\r": res
+= s
.substring(j
, i
) + "\\r"; j
= i
+ 1; break;
2790 case "\t": res
+= s
.substring(j
, i
) + "\\t"; j
= i
+ 1; break;
2791 case "\v": res
+= s
.substring(j
, i
) + "\\v"; j
= i
+ 1; break;
2792 case '"': res
+= s
.substring(j
, i
) + '\\"'; j
= i
+ 1; break;
2793 case "\\": res
+= s
.substring(j
, i
) + "\\\\"; j
= i
+ 1; break;
2795 var c
= s
.charAt(i
);
2796 if ("\a" !== "a" && c
== "\a") {
2797 res
+= s
.substring(j
, i
) + "\\a"; j
= i
+ 1; continue;
2799 if ("\v" !== "v" && c
== "\v") {
2800 res
+= s
.substring(j
, i
) + "\\v"; j
= i
+ 1; continue;
2802 //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) {
2803 // CARE: Manuel is this OK with HOP?
2804 if (s
.charAt(i
) < ' ') {
2805 /* non printable character and special chars */
2806 res
+= s
.substring(j
, i
) + "\\x" + s
.charCodeAt(i
).toString(16);
2809 // else just let i increase...
2812 res
+= s
.substring(j
, i
);
2816 /* ------------------ display ---------------------------------------------------*/
2818 /*** META ((export #t)) */
2819 function sc_display(o
, p
) {
2820 if (p
=== undefined) // we assume not given
2822 p
.appendJSString(sc_toDisplayString(o
));
2825 function sc_toDisplayString(o
) {
2828 else if (o
=== true)
2830 else if (o
=== false)
2832 else if (o
=== undefined)
2833 return "#unspecified";
2834 else if (typeof o
=== 'function')
2835 return "#<procedure " + sc_hash(o
) + ">";
2836 else if (o
.sc_toDisplayString
)
2837 return o
.sc_toDisplayString();
2839 return o
.toString();
2842 /* ------------------ newline ---------------------------------------------------*/
2844 /*** META ((export #t)) */
2845 function sc_newline(p
) {
2846 if (p
=== undefined) // we assume not given
2848 p
.appendJSString("\n");
2851 /* ------------------ write-char ---------------------------------------------------*/
2853 /*** META ((export #t)) */
2854 function sc_writeChar(c
, p
) {
2855 if (p
=== undefined) // we assume not given
2857 p
.appendJSString(c
.val
);
2860 /* ------------------ write-circle ---------------------------------------------------*/
2862 /*** META ((export #t)) */
2863 function sc_writeCircle(o
, p
) {
2864 if (p
=== undefined) // we assume not given
2866 p
.appendJSString(sc_toWriteCircleString(o
));
2869 function sc_toWriteCircleString(o
) {
2870 var symb
= sc_gensym("writeCircle");
2871 var nbPointer
= new Object();
2873 sc_prepWriteCircle(o
, symb
, nbPointer
);
2874 return sc_genToWriteCircleString(o
, symb
);
2877 function sc_prepWriteCircle(o
, symb
, nbPointer
) {
2879 if (o
instanceof sc_Pair
||
2880 o
instanceof sc_Vector
) {
2881 if (o
[symb
] !== undefined) {
2882 // not the first visit.
2884 // unless there is already a number, assign one.
2885 if (!o
[symb
+ "nb"]) o
[symb
+ "nb"] = nbPointer
.nb
++;
2889 if (o
instanceof sc_Pair
) {
2890 sc_prepWriteCircle(o
.car
, symb
, nbPointer
);
2891 sc_prepWriteCircle(o
.cdr
, symb
, nbPointer
);
2893 for (var i
= 0; i
< o
.length
; i
++)
2894 sc_prepWriteCircle(o
[i
], symb
, nbPointer
);
2899 function sc_genToWriteCircleString(o
, symb
) {
2900 if (!(o
instanceof sc_Pair
||
2901 o
instanceof sc_Vector
))
2902 return sc_toWriteString(o
);
2903 return o
.sc_toWriteCircleString(symb
);
2905 sc_Pair
.prototype.sc_toWriteCircleString = function(symb
, inList
) {
2906 if (this[symb
+ "use"]) { // use-flag is set. Just use it.
2907 var nb
= this[symb
+ "nb"];
2908 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2910 delete this[symb
+ "nb"];
2911 delete this[symb
+ "use"];
2914 return '. #' + nb
+ '#';
2916 return '#' + nb
+ '#';
2918 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2920 delete this[symb
+ "nb"];
2921 delete this[symb
+ "use"];
2926 if (this[symb
] !== undefined) { // implies > 0
2927 this[symb
+ "use"] = true;
2929 res
+= '. #' + this[symb
+ "nb"] + '=';
2931 res
+= '#' + this[symb
+ "nb"] + '=';
2939 res
+= sc_genToWriteCircleString(this.car
, symb
);
2941 if (sc_isPair(this.cdr
)) {
2942 res
+= " " + this.cdr
.sc_toWriteCircleString(symb
, true);
2943 } else if (this.cdr
!== null) {
2944 res
+= " . " + sc_genToWriteCircleString(this.cdr
, symb
);
2950 sc_Vector
.prototype.sc_toWriteCircleString = function(symb
) {
2951 if (this[symb
+ "use"]) { // use-flag is set. Just use it.
2952 var nb
= this[symb
+ "nb"];
2953 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2955 delete this[symb
+ "nb"];
2956 delete this[symb
+ "use"];
2958 return '#' + nb
+ '#';
2960 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2962 delete this[symb
+ "nb"];
2963 delete this[symb
+ "use"];
2967 if (this[symb
] !== undefined) { // implies > 0
2968 this[symb
+ "use"] = true;
2969 res
+= '#' + this[symb
+ "nb"] + '=';
2972 for (var i
= 0; i
< this.length
; i
++) {
2973 res
+= sc_genToWriteCircleString(this[i
], symb
);
2974 if (i
< this.length
- 1) res
+= " ";
2981 /* ------------------ print ---------------------------------------------------*/
2983 /*** META ((export #t)) */
2984 function sc_print(s
) {
2985 if (arguments
.length
=== 1) {
2990 for (var i
= 0; i
< arguments
.length
; i
++)
2991 sc_display(arguments
[i
]);
2996 /* ------------------ format ---------------------------------------------------*/
2997 /*** META ((export #t)) */
2998 function sc_format(s
, args
) {
3000 var p
= new sc_StringOutputPort();
3004 var i2
= s
.indexOf("~", i
);
3007 p
.appendJSString( s
.substring( i
, len
) );
3011 if (i2
== (len
- 1)) {
3012 p
.appendJSString(s
.substring(i
, len
));
3015 p
.appendJSString(s
.substring(i
, i2
));
3020 switch(s
.charCodeAt(i2
+ 1)) {
3024 sc_display(arguments
[j
], p
);
3031 sc_write(arguments
[j
], p
);
3038 sc_display(arguments
[j
], p
);
3039 p
.appendJSString("\n");
3046 p
.appendJSString(String
.fromCharCode(arguments
[j
]));
3053 p
.appendJSString(arguments
[j
].toString(6));
3060 p
.appendJSString(arguments
[j
].toString(8));
3067 p
.appendJSString(arguments
[j
].toString(2));
3074 p
.appendJSString("\n");
3079 p
.appendJSString("\r");
3084 p
.appendJSString("~");
3088 sc_error( "format: illegal ~"
3089 + String
.fromCharCode(s
.charCodeAt(i2
+ 1))
3099 /* ------------------ global ports ---------------------------------------------------*/
3101 var SC_DEFAULT_IN
= new sc_ErrorInputPort();
3102 var SC_DEFAULT_OUT
= new sc_ErrorOutputPort();
3103 var SC_ERROR_OUT
= new sc_ErrorOutputPort();
3105 var sc_SYMBOL_PREFIX
= "\u1E9C";
3106 var sc_KEYWORD_PREFIX
= "\u1E9D";
3108 /*** META ((export #t)
3110 function sc_jsstring2string(s
) {
3114 /*** META ((export #t)
3115 (peephole (prefix "'\\u1E9C' +")))
3117 function sc_jsstring2symbol(s
) {
3118 return sc_SYMBOL_PREFIX
+ s
;
3121 /*** META ((export #t)
3124 function sc_string2jsstring(s
) {
3128 /*** META ((export #t)
3129 (peephole (symbol2jsstring_immutable)))
3131 function sc_symbol2jsstring(s
) {
3135 /*** META ((export #t)
3136 (peephole (postfix ".slice(1)")))
3138 function sc_keyword2jsstring(k
) {
3142 /*** META ((export #t)
3143 (peephole (prefix "'\\u1E9D' +")))
3145 function sc_jsstring2keyword(s
) {
3146 return sc_KEYWORD_PREFIX
+ s
;
3149 /*** META ((export #t)
3152 function sc_isKeyword(s
) {
3153 return (typeof s
=== "string") &&
3154 (s
.charAt(0) === sc_KEYWORD_PREFIX
);
3158 /*** META ((export #t)) */
3159 var sc_gensym = function() {
3161 return function(sym
) {
3163 if (!sym
) sym
= sc_SYMBOL_PREFIX
;
3164 return sym
+ "s" + counter
+ "~" + "^sC-GeNsYm ";
3169 /*** META ((export #t)
3172 function sc_isEqual(o1
, o2
) {
3173 return ((o1
=== o2
) ||
3174 (sc_isPair(o1
) && sc_isPair(o2
)
3175 && sc_isPairEqual(o1
, o2
, sc_isEqual
)) ||
3176 (sc_isVector(o1
) && sc_isVector(o2
)
3177 && sc_isVectorEqual(o1
, o2
, sc_isEqual
)));
3180 /*** META ((export number->symbol integer->symbol)) */
3181 function sc_number2symbol(x
, radix
) {
3182 return sc_SYMBOL_PREFIX
+ sc_number2jsstring(x
, radix
);
3185 /*** META ((export number->string integer->string)) */
3186 var sc_number2string
= sc_number2jsstring
;
3188 /*** META ((export #t)) */
3189 function sc_symbol2number(s
, radix
) {
3190 return sc_jsstring2number(s
.slice(1), radix
);
3193 /*** META ((export #t)) */
3194 var sc_string2number
= sc_jsstring2number
;
3196 /*** META ((export #t)
3197 (peephole (prefix "+" s)))
3198 ;; peephole will only apply if no radix is given.
3200 function sc_string2integer(s
, radix
) {
3201 if (!radix
) return +s
;
3202 return parseInt(s
, radix
);
3205 /*** META ((export #t)
3206 (peephole (prefix "+")))
3208 function sc_string2real(s
) {
3213 /*** META ((export #t)
3216 function sc_isSymbol(s
) {
3217 return (typeof s
=== "string") &&
3218 (s
.charAt(0) === sc_SYMBOL_PREFIX
);
3221 /*** META ((export #t)
3222 (peephole (symbol2string_immutable)))
3224 function sc_symbol2string(s
) {
3228 /*** META ((export #t)
3229 (peephole (prefix "'\\u1E9C' +")))
3231 function sc_string2symbol(s
) {
3232 return sc_SYMBOL_PREFIX
+ s
;
3235 /*** META ((export symbol-append)
3236 (peephole (symbolAppend_immutable)))
3238 function sc_symbolAppend() {
3239 var res
= sc_SYMBOL_PREFIX
;
3240 for (var i
= 0; i
< arguments
.length
; i
++)
3241 res
+= arguments
[i
].slice(1);
3245 /*** META ((export #t)
3246 (peephole (postfix ".val")))
3248 function sc_char2string(c
) { return c
.val
; }
3250 /*** META ((export #t)
3251 (peephole (hole 1 "'\\u1E9C' + " c ".val")))
3253 function sc_char2symbol(c
) { return sc_SYMBOL_PREFIX
+ c
.val
; }
3255 /*** META ((export #t)
3258 function sc_isString(s
) {
3259 return (typeof s
=== "string") &&
3260 (s
.charAt(0) !== sc_SYMBOL_PREFIX
);
3263 /*** META ((export #t)) */
3264 var sc_makeString
= sc_makejsString
;
3267 /*** META ((export #t)) */
3268 function sc_string() {
3269 for (var i
= 0; i
< arguments
.length
; i
++)
3270 arguments
[i
] = arguments
[i
].val
;
3271 return "".concat
.apply("", arguments
);
3274 /*** META ((export #t)
3275 (peephole (postfix ".length")))
3277 function sc_stringLength(s
) { return s
.length
; }
3279 /*** META ((export #t)) */
3280 function sc_stringRef(s
, k
) {
3281 return new sc_Char(s
.charAt(k
));
3284 /* there's no stringSet in the immutable version
3285 function sc_stringSet(s, k, c)
3289 /*** META ((export string=?)
3291 (peephole (hole 2 str1 " === " str2)))
3293 function sc_isStringEqual(s1
, s2
) {
3296 /*** META ((export string<?)
3298 (peephole (hole 2 str1 " < " str2)))
3300 function sc_isStringLess(s1
, s2
) {
3303 /*** META ((export string>?)
3305 (peephole (hole 2 str1 " > " str2)))
3307 function sc_isStringGreater(s1
, s2
) {
3310 /*** META ((export string<=?)
3312 (peephole (hole 2 str1 " <= " str2)))
3314 function sc_isStringLessEqual(s1
, s2
) {
3317 /*** META ((export string>=?)
3319 (peephole (hole 2 str1 " >= " str2)))
3321 function sc_isStringGreaterEqual(s1
, s2
) {
3324 /*** META ((export string-ci=?)
3326 (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()")))
3328 function sc_isStringCIEqual(s1
, s2
) {
3329 return s1
.toLowerCase() === s2
.toLowerCase();
3331 /*** META ((export string-ci<?)
3333 (peephole (hole 2 str1 ".toLowerCase() < " str2 ".toLowerCase()")))
3335 function sc_isStringCILess(s1
, s2
) {
3336 return s1
.toLowerCase() < s2
.toLowerCase();
3338 /*** META ((export string-ci>?)
3340 (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()")))
3342 function sc_isStringCIGreater(s1
, s2
) {
3343 return s1
.toLowerCase() > s2
.toLowerCase();
3345 /*** META ((export string-ci<=?)
3347 (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()")))
3349 function sc_isStringCILessEqual(s1
, s2
) {
3350 return s1
.toLowerCase() <= s2
.toLowerCase();
3352 /*** META ((export string-ci>=?)
3354 (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()")))
3356 function sc_isStringCIGreaterEqual(s1
, s2
) {
3357 return s1
.toLowerCase() >= s2
.toLowerCase();
3360 /*** META ((export #t)
3361 (peephole (hole 3 s ".substring(" start ", " end ")")))
3363 function sc_substring(s
, start
, end
) {
3364 return s
.substring(start
, end
);
3367 /*** META ((export #t))
3369 function sc_isSubstring_at(s1
, s2
, i
) {
3370 return s2
== s1
.substring(i
, i
+ s2
.length
);
3373 /*** META ((export #t)
3374 (peephole (infix 0 #f "+" "''")))
3376 function sc_stringAppend() {
3377 return "".concat
.apply("", arguments
);
3380 /*** META ((export #t)) */
3381 var sc_string2list
= sc_jsstring2list
;
3383 /*** META ((export #t)) */
3384 var sc_list2string
= sc_list2jsstring
;
3386 /*** META ((export #t)
3389 function sc_stringCopy(s
) {
3393 /* there's no string-fill in the immutable version
3394 function sc_stringFill(s, c)
3397 /*** META ((export #t)
3398 (peephole (postfix ".slice(1)")))
3400 function sc_keyword2string(o
) {
3404 /*** META ((export #t)
3405 (peephole (prefix "'\\u1E9D' +")))
3407 function sc_string2keyword(o
) {
3408 return sc_KEYWORD_PREFIX
+ o
;
3411 String
.prototype.sc_toDisplayString = function() {
3412 if (this.charAt(0) === sc_SYMBOL_PREFIX
)
3413 // TODO: care for symbols with spaces (escape-chars symbols).
3414 return this.slice(1);
3415 else if (this.charAt(0) === sc_KEYWORD_PREFIX
)
3416 return ":" + this.slice(1);
3418 return this.toString();
3421 String
.prototype.sc_toWriteString = function() {
3422 if (this.charAt(0) === sc_SYMBOL_PREFIX
)
3423 // TODO: care for symbols with spaces (escape-chars symbols).
3424 return this.slice(1);
3425 else if (this.charAt(0) === sc_KEYWORD_PREFIX
)
3426 return ":" + this.slice(1);
3428 return '"' + sc_escapeWriteString(this) + '"';
3430 /* Exported Variables */
3431 var BgL_testzd2boyerzd2
;
3432 var BgL_nboyerzd2benchmarkzd2
;
3433 var BgL_setupzd2boyerzd2
;
3436 var translate_term_nboyer
;
3437 var translate_args_nboyer
;
3438 var untranslate_term_nboyer
;
3439 var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer
;
3440 var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
;
3441 var translate_alist_nboyer
;
3442 var apply_subst_nboyer
;
3443 var apply_subst_lst_nboyer
;
3444 var tautologyp_nboyer
;
3445 var if_constructor_nboyer
;
3446 var rewrite_count_nboyer
;
3448 var rewrite_args_nboyer
;
3449 var unify_subst_nboyer
;
3450 var one_way_unify1_nboyer
;
3451 var false_term_nboyer
;
3452 var true_term_nboyer
;
3453 var trans_of_implies1_nboyer
;
3454 var is_term_equal_nboyer
;
3455 var is_term_member_nboyer
;
3457 var sc_const_3_nboyer
;
3458 var sc_const_4_nboyer
;
3460 (sc_const_4_nboyer
= (new sc_Pair("\u1E9Cimplies",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cu",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cw",null)))))),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cw",null)))))),null)))))));
3461 (sc_const_3_nboyer
= sc_list((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccompile",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Ccodegen",(new sc_Pair((new sc_Pair("\u1E9Coptimize",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreaterp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clesseqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cboolean",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ciff",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceven1",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Codd",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccountps-",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccountps-loop",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfact-",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfact-loop",(new sc_Pair("\u1E9Ci",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdivides",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-true",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-false",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctautology-checker",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctautologyp",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfalsify",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfalsify1",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime1",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair("\u1E9Cp",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))))),(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cc",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cplus-fringe",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair("\u1E9Cenvrn",null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmc-flatten",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cintersect",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Ck",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ck",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Csort-lp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus1",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Ci",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cbase",null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cj",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cj",(new sc_Pair((1),null)))))),null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Ci",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cw",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cz",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnlistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csamefringe",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cz",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cw",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair(sc_list("\u1E9Cand", (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Ca",null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cb",null)))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cl",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cl",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdsort",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx1",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx2",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx3",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx4",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx5",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx6",(new sc_Pair("\u1E9Cx7",null)))))),null)))))),null)))))),null)))))),null)))))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((6),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx7",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cy",(new sc_Pair((2),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csigma",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Ci",null)))),null)))))),(new sc_Pair((2),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cz",null)))),null)))))),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Ca",null)))),null)))),(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Cb",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair("\u1E9Cz",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cassignedp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair((new sc_Pair("\u1E9Cset",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cval",(new sc_Pair("\u1E9Cmem",null)))))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair("\u1E9Cval",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cmem",null)))))),null)))))))),null))))))));
3462 (const_nboyer
= (new sc_Pair((new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))))),null)))))))))));
3463 BgL_nboyerzd2benchmarkzd2 = function() {
3465 for (var sc_tmp
= arguments
.length
- 1; sc_tmp
>= 0; sc_tmp
--) {
3466 args
= sc_cons(arguments
[sc_tmp
], args
);
3469 return ((n
= ((args
=== null)?(0):(args
.car
))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n
))), (1), function() {
3470 return (BgL_testzd2boyerzd2(n
));
3471 }, function(rewrites
) {
3472 if ((sc_isNumber(rewrites
)))
3475 return (rewrites
===(95024));
3478 return (rewrites
===(591777));
3481 return (rewrites
===(1813975));
3484 return (rewrites
===(5375678));
3487 return (rewrites
===(16445406));
3490 return (rewrites
===(51507739));
3500 BgL_setupzd2boyerzd2 = function() {
3503 BgL_testzd2boyerzd2 = function() {
3506 translate_term_nboyer = function(term
) {
3508 return (!(term
instanceof sc_Pair
)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term
.car
))), ((lst
= (term
.cdr
)), ((lst
=== null)?null:(new sc_Pair((translate_term_nboyer((lst
.car
))), (translate_args_nboyer((lst
.cdr
))))))))));
3510 translate_args_nboyer = function(lst
) {
3513 return ((lst
=== null)?null:(new sc_Pair(((term
= (lst
.car
)), (!(term
instanceof sc_Pair
)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term
.car
))), (translate_args_nboyer((term
.cdr
))))))), ((sc_lst_5
= (lst
.cdr
)), ((sc_lst_5
=== null)?null:(new sc_Pair((translate_term_nboyer((sc_lst_5
.car
))), (translate_args_nboyer((sc_lst_5
.cdr
))))))))));
3515 untranslate_term_nboyer = function(term
) {
3521 if (!(term
instanceof sc_Pair
))
3525 (falseHead1130
= (new sc_Pair(null, null)));
3526 (L1127
= (term
.cdr
));
3527 (tail1131
= falseHead1130
);
3528 while (!(L1127
=== null)) {
3530 (tail1131
.cdr
= (new sc_Pair((untranslate_term_nboyer((L1127
.car
))), null)));
3531 (tail1131
= (tail1131
.cdr
));
3532 (L1127
= (L1127
.cdr
));
3535 (optrOpnd
= (falseHead1130
.cdr
));
3536 return (new sc_Pair(((symbol_record
= (term
.car
)), (symbol_record
[(0)])), optrOpnd
));
3539 BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym
) {
3542 return ((x
= (sc_assq(sym
, BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
))), ((x
!== false)?(x
.cdr
):((r
= [sym
, null]), (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
= (new sc_Pair((new sc_Pair(sym
, r
)), BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
))), r
)));
3544 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
= null);
3545 translate_alist_nboyer = function(alist
) {
3548 return ((alist
=== null)?null:(new sc_Pair((new sc_Pair((alist
.car
.car
), ((term
= (alist
.car
.cdr
)), (!(term
instanceof sc_Pair
)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term
.car
))), (translate_args_nboyer((term
.cdr
))))))))), ((sc_alist_6
= (alist
.cdr
)), ((sc_alist_6
=== null)?null:(new sc_Pair((new sc_Pair((sc_alist_6
.car
.car
), (translate_term_nboyer((sc_alist_6
.car
.cdr
))))), (translate_alist_nboyer((sc_alist_6
.cdr
))))))))));
3550 apply_subst_nboyer = function(alist
, term
) {
3553 return (!(term
instanceof sc_Pair
)?((temp_temp
= (sc_assq(term
, alist
))), ((temp_temp
!== false)?(temp_temp
.cdr
):term
)):(new sc_Pair((term
.car
), ((lst
= (term
.cdr
)), ((lst
=== null)?null:(new sc_Pair((apply_subst_nboyer(alist
, (lst
.car
))), (apply_subst_lst_nboyer(alist
, (lst
.cdr
))))))))));
3555 apply_subst_lst_nboyer = function(alist
, lst
) {
3557 return ((lst
=== null)?null:(new sc_Pair((apply_subst_nboyer(alist
, (lst
.car
))), ((sc_lst_7
= (lst
.cdr
)), ((sc_lst_7
=== null)?null:(new sc_Pair((apply_subst_nboyer(alist
, (sc_lst_7
.car
))), (apply_subst_lst_nboyer(alist
, (sc_lst_7
.cdr
))))))))));
3559 tautologyp_nboyer = function(sc_x_11
, true_lst
, false_lst
) {
3570 if ((((sc_tmp1126_10
= (is_term_equal_nboyer(sc_x_11
, true_term_nboyer
))), ((sc_tmp1126_10
!== false)?sc_tmp1126_10:(is_term_member_nboyer(sc_x_11
, true_lst
))))!== false))
3573 if ((((sc_tmp1125_9
= (is_term_equal_nboyer(sc_x_11
, false_term_nboyer
))), ((sc_tmp1125_9
!== false)?sc_tmp1125_9:(is_term_member_nboyer(sc_x_11
, false_lst
))))!== false))
3576 if (!(sc_x_11
instanceof sc_Pair
))
3579 if (((sc_x_11
.car
)===if_constructor_nboyer
))
3580 if ((((sc_x_8
= (sc_x_11
.cdr
.car
)), (tmp1126
= (is_term_equal_nboyer(sc_x_8
, true_term_nboyer
))), ((tmp1126
!== false)?tmp1126:(is_term_member_nboyer(sc_x_8
, true_lst
))))!== false))
3581 (sc_x_11
= (sc_x_11
.cdr
.cdr
.car
));
3583 if ((((x
= (sc_x_11
.cdr
.car
)), (tmp1125
= (is_term_equal_nboyer(x
, false_term_nboyer
))), ((tmp1125
!== false)?tmp1125:(is_term_member_nboyer(x
, false_lst
))))!== false))
3584 (sc_x_11
= (sc_x_11
.cdr
.cdr
.cdr
.car
));
3586 if (((tautologyp_nboyer((sc_x_11
.cdr
.cdr
.car
), (new sc_Pair((sc_x_11
.cdr
.car
), true_lst
)), false_lst
))!== false))
3588 (false_lst
= (new sc_Pair((sc_x_11
.cdr
.car
), false_lst
)));
3589 (sc_x_11
= (sc_x_11
.cdr
.cdr
.cdr
.car
));
3597 (if_constructor_nboyer
= "\u1E9C*");
3598 (rewrite_count_nboyer
= (0));
3599 rewrite_nboyer = function(term
) {
3606 (++rewrite_count_nboyer
);
3607 if (!(term
instanceof sc_Pair
))
3611 (sc_term_12
= (new sc_Pair((term
.car
), ((sc_lst_13
= (term
.cdr
)), ((sc_lst_13
=== null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_13
.car
))), (rewrite_args_nboyer((sc_lst_13
.cdr
))))))))));
3612 (lst
= ((symbol_record
= (term
.car
)), (symbol_record
[(1)])));
3617 if ((((term2
= ((lst
.car
).cdr
.car
)), (unify_subst_nboyer
= null), (one_way_unify1_nboyer(sc_term_12
, term2
)))!== false))
3618 return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer
, ((lst
.car
).cdr
.cdr
.car
)))));
3625 rewrite_args_nboyer = function(lst
) {
3627 return ((lst
=== null)?null:(new sc_Pair((rewrite_nboyer((lst
.car
))), ((sc_lst_14
= (lst
.cdr
)), ((sc_lst_14
=== null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_14
.car
))), (rewrite_args_nboyer((sc_lst_14
.cdr
))))))))));
3629 (unify_subst_nboyer
= "\u1E9C*");
3630 one_way_unify1_nboyer = function(term1
, term2
) {
3634 if (!(term2
instanceof sc_Pair
))
3636 (temp_temp
= (sc_assq(term2
, unify_subst_nboyer
)));
3637 if ((temp_temp
!== false))
3638 return (is_term_equal_nboyer(term1
, (temp_temp
.cdr
)));
3640 if ((sc_isNumber(term2
)))
3641 return (sc_isEqual(term1
, term2
));
3644 (unify_subst_nboyer
= (new sc_Pair((new sc_Pair(term2
, term1
)), unify_subst_nboyer
)));
3649 if (!(term1
instanceof sc_Pair
))
3652 if (((term1
.car
)===(term2
.car
)))
3654 (lst1
= (term1
.cdr
));
3655 (lst2
= (term2
.cdr
));
3657 if ((lst1
=== null))
3658 return (lst2
=== null);
3660 if ((lst2
=== null))
3663 if (((one_way_unify1_nboyer((lst1
.car
), (lst2
.car
)))!== false))
3665 (lst1
= (lst1
.cdr
));
3666 (lst2
= (lst2
.cdr
));
3675 (false_term_nboyer
= "\u1E9C*");
3676 (true_term_nboyer
= "\u1E9C*");
3677 trans_of_implies1_nboyer = function(n
) {
3679 return ((sc_isEqual(n
, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (n
-(1)), n
)), ((sc_n_15
= (n
-(1))), ((sc_isEqual(sc_n_15
, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (sc_n_15
-(1)), sc_n_15
)), (trans_of_implies1_nboyer((sc_n_15
-(1)))))))))));
3681 is_term_equal_nboyer = function(x
, y
) {
3686 if ((x
instanceof sc_Pair
))
3687 if ((y
instanceof sc_Pair
))
3688 if ((((r1
= (x
.car
)), (r2
= (y
.car
)), (r1
===r2
))!== false))
3693 if ((lst1
=== null))
3694 return (lst2
=== null);
3696 if ((lst2
=== null))
3699 if (((is_term_equal_nboyer((lst1
.car
), (lst2
.car
)))!== false))
3701 (lst1
= (lst1
.cdr
));
3702 (lst2
= (lst2
.cdr
));
3713 return (sc_isEqual(x
, y
));
3715 is_term_member_nboyer = function(x
, lst
) {
3722 if (((is_term_equal_nboyer(x
, (lst
.car
)))!== false))
3728 BgL_setupzd2boyerzd2 = function() {
3731 var BgL_sc_symbolzd2record_16zd2
;
3739 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
= null);
3740 (if_constructor_nboyer
= (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif")));
3741 (false_term_nboyer
= ((sc_term_19
= (new sc_Pair("\u1E9Cf",null))), (!(sc_term_19
instanceof sc_Pair
)?sc_term_19:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_19
.car
))), (translate_args_nboyer((sc_term_19
.cdr
))))))));
3742 (true_term_nboyer
= ((sc_term_18
= (new sc_Pair("\u1E9Ct",null))), (!(sc_term_18
instanceof sc_Pair
)?sc_term_18:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_18
.car
))), (translate_args_nboyer((sc_term_18
.cdr
))))))));
3743 (lst
= sc_const_3_nboyer
);
3744 while (!(lst
=== null)) {
3747 if (((term
instanceof sc_Pair
)&&(((term
.car
)==="\u1E9Cequal")&&((term
.cdr
.car
) instanceof sc_Pair
))))
3749 (sc_sym_17
= ((term
.cdr
.car
).car
));
3750 (value
= (new sc_Pair((!(term
instanceof sc_Pair
)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term
.car
))), (translate_args_nboyer((term
.cdr
)))))), ((sym
= ((term
.cdr
.car
).car
)), (BgL_sc_symbolzd2record_16zd2
= (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sym
))), (BgL_sc_symbolzd2record_16zd2
[(1)])))));
3751 (symbol_record
= (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17
)));
3752 (symbol_record
[(1)] = value
);
3755 (sc_error("ADD-LEMMA did not like term: ", term
));
3762 BgL_testzd2boyerzd2 = function(n
) {
3770 (rewrite_count_nboyer
= (0));
3771 (term
= sc_const_4_nboyer
);
3773 while (!(sc_n_20
=== 0)) {
3775 (term
= (sc_list("\u1E9Cor", term
, (new sc_Pair("\u1E9Cf",null)))));
3779 (sc_term_22
= term
);
3780 if (!(sc_term_22
instanceof sc_Pair
))
3781 (optrOpnd
= sc_term_22
);
3783 (optrOpnd
= (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22
.car
))), (translate_args_nboyer((sc_term_22
.cdr
))))));
3784 (sc_term_21
= (apply_subst_nboyer(((const_nboyer
=== null)?null:(new sc_Pair((new sc_Pair((const_nboyer
.car
.car
), (translate_term_nboyer((const_nboyer
.car
.cdr
))))), (translate_alist_nboyer((const_nboyer
.cdr
)))))), optrOpnd
)));
3785 (answer
= (tautologyp_nboyer((rewrite_nboyer(sc_term_21
)), null, null)));
3786 (sc_write(rewrite_count_nboyer
));
3787 (sc_display(" rewrites"));
3789 if ((answer
!== false))
3790 return rewrite_count_nboyer
;
3796 /* Exported Variables */
3797 var BgL_parsezd2ze3nbzd2treesze3
;
3798 var BgL_earleyzd2benchmarkzd2
;
3799 var BgL_parsezd2ze3parsedzf3zc2
;
3801 var BgL_parsezd2ze3treesz31
;
3802 var BgL_makezd2parserzd2
;
3807 (const_earley
= (new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair((new sc_Pair("\u1E9Ca",null)),(new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair("\u1E9Cs",null)))),null)))))),null)));
3808 BgL_makezd2parserzd2 = function(grammar
, lexer
) {
3821 var sc_predictors_3
;
3825 var BgL_sc_defzd2loop_6zd2
;
3826 var BgL_sc_nbzd2nts_7zd2
;
3828 var BgL_sc_defzd2loop_9zd2
;
3831 ind = function(nt
, sc_nts_10
) {
3834 (i
= ((sc_nts_10
.length
)-(1)));
3837 if ((sc_isEqual((sc_nts_10
[i
]), nt
)))
3846 (sc_nts_8
= ((BgL_sc_defzd2loop_9zd2 = function(defs
, sc_nts_11
) {
3850 return ((defs
instanceof sc_Pair
)?((def
= (defs
.car
)), (head
= (def
.car
)), (rule_loop = function(rules
, sc_nts_12
) {
3855 if ((rules
instanceof sc_Pair
))
3857 (rule
= (rules
.car
));
3859 (sc_nts_13
= sc_nts_12
);
3860 while ((l
instanceof sc_Pair
)) {
3864 (sc_nts_13
= (((sc_member(nt
, sc_nts_13
))!== false)?sc_nts_13:(new sc_Pair(nt
, sc_nts_13
))));
3867 return (rule_loop((rules
.cdr
), sc_nts_13
));
3870 return (BgL_sc_defzd2loop_9zd2((defs
.cdr
), sc_nts_12
));
3871 }), (rule_loop((def
.cdr
), (((sc_member(head
, sc_nts_11
))!== false)?sc_nts_11:(new sc_Pair(head
, sc_nts_11
)))))):(sc_list2vector((sc_reverse(sc_nts_11
)))));
3872 }), (BgL_sc_defzd2loop_9zd2(grammar
, null))));
3873 (BgL_sc_nbzd2nts_7zd2
= (sc_nts_8
.length
));
3874 (nb_confs
= (((BgL_sc_defzd2loop_6zd2 = function(defs
, BgL_sc_nbzd2confs_14zd2
) {
3877 return ((defs
instanceof sc_Pair
)?((def
= (defs
.car
)), (rule_loop = function(rules
, BgL_sc_nbzd2confs_15zd2
) {
3879 var BgL_sc_nbzd2confs_16zd2
;
3881 if ((rules
instanceof sc_Pair
))
3883 (rule
= (rules
.car
));
3885 (BgL_sc_nbzd2confs_16zd2
= BgL_sc_nbzd2confs_15zd2
);
3886 while ((l
instanceof sc_Pair
)) {
3889 (++BgL_sc_nbzd2confs_16zd2
);
3892 return (rule_loop((rules
.cdr
), (BgL_sc_nbzd2confs_16zd2
+(1))));
3895 return (BgL_sc_defzd2loop_6zd2((defs
.cdr
), BgL_sc_nbzd2confs_15zd2
));
3896 }), (rule_loop((def
.cdr
), BgL_sc_nbzd2confs_14zd2
))):BgL_sc_nbzd2confs_14zd2
);
3897 }), (BgL_sc_defzd2loop_6zd2(grammar
, (0))))+BgL_sc_nbzd2nts_7zd2
));
3898 (sc_starters_5
= (sc_makeVector(BgL_sc_nbzd2nts_7zd2
, null)));
3899 (sc_enders_4
= (sc_makeVector(BgL_sc_nbzd2nts_7zd2
, null)));
3900 (sc_predictors_3
= (sc_makeVector(BgL_sc_nbzd2nts_7zd2
, null)));
3901 (sc_steps_2
= (sc_makeVector(nb_confs
, false)));
3902 (sc_names_1
= (sc_makeVector(nb_confs
, false)));
3904 (starters
= sc_starters_5
);
3905 (enders
= sc_enders_4
);
3906 (predictors
= sc_predictors_3
);
3907 (steps
= sc_steps_2
);
3908 (names
= sc_names_1
);
3909 (nb_nts
= (sc_nts_8
.length
));
3913 (sc_steps_2
[i
] = (i
-nb_nts
));
3914 (sc_names_1
[i
] = (sc_list((sc_nts_8
[i
]), (0))));
3915 (sc_enders_4
[i
] = (sc_list(i
)));
3919 def_loop = function(defs
, conf
) {
3923 return ((defs
instanceof sc_Pair
)?((def
= (defs
.car
)), (head
= (def
.car
)), (rule_loop = function(rules
, conf
, rule_num
) {
3931 if ((rules
instanceof sc_Pair
))
3933 (rule
= (rules
.car
));
3934 (names
[conf
] = (sc_list(head
, rule_num
)));
3935 (sc_i_19
= (ind(head
, nts
)));
3936 (starters
[sc_i_19
] = (new sc_Pair(conf
, (starters
[sc_i_19
]))));
3938 (sc_conf_18
= conf
);
3939 while ((l
instanceof sc_Pair
)) {
3942 (steps
[sc_conf_18
] = (ind(nt
, nts
)));
3943 (sc_i_17
= (ind(nt
, nts
)));
3944 (predictors
[sc_i_17
] = (new sc_Pair(sc_conf_18
, (predictors
[sc_i_17
]))));
3949 (steps
[sc_conf_18
] = ((ind(head
, nts
))-nb_nts
));
3950 (i
= (ind(head
, nts
)));
3951 (enders
[i
] = (new sc_Pair(sc_conf_18
, (enders
[i
]))));
3952 return (rule_loop((rules
.cdr
), (sc_conf_18
+(1)), (rule_num
+(1))));
3955 return (def_loop((defs
.cdr
), conf
));
3956 }), (rule_loop((def
.cdr
), conf
, (1)))):undefined);
3958 (def_loop(grammar
, (sc_nts_8
.length
)));
3959 (parser_descr
= [lexer
, sc_nts_8
, sc_starters_5
, sc_enders_4
, sc_predictors_3
, sc_steps_2
, sc_names_1
]);
3960 return function(input
) {
3966 var BgL_sc_stateza2_23za2
;
3968 var BgL_sc_nbzd2nts_24zd2
;
3972 var BgL_sc_statesza2_27za2
;
3986 var BgL_sc_statesza2_30za2
;
3987 var BgL_sc_nbzd2nts_31zd2
;
3988 var BgL_sc_nbzd2confs_32zd2
;
3992 var BgL_sc_nbzd2confs_34zd2
;
3993 var BgL_sc_nbzd2toks_35zd2
;
3998 var sc_predictors_39
;
4005 var BgL_sc_confzd2setzd2getza2_44za2
;
4006 var conf_set_merge_new_bang
;
4007 var conf_set_adjoin
;
4008 var BgL_sc_confzd2setzd2adjoinza2_45za2
;
4009 var BgL_sc_confzd2setzd2adjoinza2za2_46z00
;
4014 var BgL_sc_derivzd2treesza2_47z70
;
4016 var BgL_sc_nbzd2derivzd2treesza2_48za2
;
4018 sc_ind_43 = function(nt
, sc_nts_49
) {
4021 (i
= ((sc_nts_49
.length
)-(1)));
4024 if ((sc_isEqual((sc_nts_49
[i
]), nt
)))
4033 make_states = function(BgL_sc_nbzd2toks_50zd2
, BgL_sc_nbzd2confs_51zd2
) {
4038 (sc_states_52
= (sc_makeVector((BgL_sc_nbzd2toks_50zd2
+(1)), false)));
4039 (i
= BgL_sc_nbzd2toks_50zd2
);
4042 (v
= (sc_makeVector((BgL_sc_nbzd2confs_51zd2
+(1)), false)));
4044 (sc_states_52
[i
] = v
);
4048 return sc_states_52
;
4051 BgL_sc_confzd2setzd2getza2_44za2 = function(state
, BgL_sc_statezd2num_53zd2
, sc_conf_54
) {
4053 var BgL_sc_confzd2set_55zd2
;
4054 return ((BgL_sc_confzd2set_55zd2
= (state
[(sc_conf_54
+(1))])), ((BgL_sc_confzd2set_55zd2
!== false)?BgL_sc_confzd2set_55zd2:((conf_set
= (sc_makeVector((BgL_sc_statezd2num_53zd2
+(6)), false))), (conf_set
[(1)] = (-3)), (conf_set
[(2)] = (-1)), (conf_set
[(3)] = (-1)), (conf_set
[(4)] = (-1)), (state
[(sc_conf_54
+(1))] = conf_set
), conf_set
)));
4056 conf_set_merge_new_bang = function(conf_set
) {
4057 return ((conf_set
[((conf_set
[(1)])+(5))] = (conf_set
[(4)])), (conf_set
[(1)] = (conf_set
[(3)])), (conf_set
[(3)] = (-1)), (conf_set
[(4)] = (-1)));
4059 conf_set_adjoin = function(state
, conf_set
, sc_conf_56
, i
) {
4061 return ((tail
= (conf_set
[(3)])), (conf_set
[(i
+(5))] = (-1)), (conf_set
[(tail
+(5))] = i
), (conf_set
[(3)] = i
), ((tail
<(0))?((conf_set
[(0)] = (state
[(0)])), (state
[(0)] = sc_conf_56
)):undefined));
4063 BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57
, BgL_sc_statezd2num_58zd2
, l
, i
) {
4069 (state
= (sc_states_57
[BgL_sc_statezd2num_58zd2
]));
4071 while ((l1
instanceof sc_Pair
)) {
4073 (sc_conf_59
= (l1
.car
));
4074 (conf_set
= (BgL_sc_confzd2setzd2getza2_44za2(state
, BgL_sc_statezd2num_58zd2
, sc_conf_59
)));
4075 if (((conf_set
[(i
+(5))])=== false))
4077 (conf_set_adjoin(state
, conf_set
, sc_conf_59
, i
));
4087 BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60
, BgL_sc_statesza2_61za2
, BgL_sc_statezd2num_62zd2
, sc_conf_63
, i
) {
4088 var BgL_sc_confzd2setza2_64z70
;
4089 var BgL_sc_stateza2_65za2
;
4092 return ((state
= (sc_states_60
[BgL_sc_statezd2num_62zd2
])), ((((conf_set
= (state
[(sc_conf_63
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false)?((BgL_sc_stateza2_65za2
= (BgL_sc_statesza2_61za2
[BgL_sc_statezd2num_62zd2
])), (BgL_sc_confzd2setza2_64z70
= (BgL_sc_confzd2setzd2getza2_44za2(BgL_sc_stateza2_65za2
, BgL_sc_statezd2num_62zd2
, sc_conf_63
))), (((BgL_sc_confzd2setza2_64z70
[(i
+(5))])=== false)?(conf_set_adjoin(BgL_sc_stateza2_65za2
, BgL_sc_confzd2setza2_64z70
, sc_conf_63
, i
)):undefined), true):false));
4094 conf_set_union = function(state
, conf_set
, sc_conf_66
, other_set
) {
4097 (i
= (other_set
[(2)]));
4099 if (((conf_set
[(i
+(5))])=== false))
4101 (conf_set_adjoin(state
, conf_set
, sc_conf_66
, i
));
4102 (i
= (other_set
[(i
+(5))]));
4105 (i
= (other_set
[(i
+(5))]));
4110 forw = function(sc_states_67
, BgL_sc_statezd2num_68zd2
, sc_starters_69
, sc_enders_70
, sc_predictors_71
, sc_steps_72
, sc_nts_73
) {
4121 var BgL_sc_confzd2set_76zd2
;
4122 var BgL_sc_statezd2num_77zd2
;
4126 var BgL_sc_confzd2set_79zd2
;
4129 var BgL_sc_nbzd2nts_81zd2
;
4132 (sc_state_82
= (sc_states_67
[BgL_sc_statezd2num_68zd2
]));
4133 (BgL_sc_nbzd2nts_81zd2
= (sc_nts_73
.length
));
4136 (sc_conf_80
= (sc_state_82
[(0)]));
4137 if ((sc_conf_80
>=(0)))
4139 (step
= (sc_steps_72
[sc_conf_80
]));
4140 (BgL_sc_confzd2set_79zd2
= (sc_state_82
[(sc_conf_80
+(1))]));
4141 (head
= (BgL_sc_confzd2set_79zd2
[(4)]));
4142 (sc_state_82
[(0)] = (BgL_sc_confzd2set_79zd2
[(0)]));
4143 (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2
));
4146 (sc_l_74
= (sc_starters_69
[step
]));
4147 while ((sc_l_74
instanceof sc_Pair
)) {
4149 (starter
= (sc_l_74
.car
));
4150 (starter_set
= (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82
, BgL_sc_statezd2num_68zd2
, starter
)));
4151 if (((starter_set
[(BgL_sc_statezd2num_68zd2
+(5))])=== false))
4153 (conf_set_adjoin(sc_state_82
, starter_set
, starter
, BgL_sc_statezd2num_68zd2
));
4154 (sc_l_74
= (sc_l_74
.cdr
));
4157 (sc_l_74
= (sc_l_74
.cdr
));
4160 (l
= (sc_enders_70
[step
]));
4161 while ((l
instanceof sc_Pair
)) {
4164 if ((((conf_set
= (sc_state_82
[(ender
+(1))])), ((conf_set
!== false)?(conf_set
[(BgL_sc_statezd2num_68zd2
+(5))]):false))!== false))
4166 (next
= (sc_conf_80
+(1)));
4167 (next_set
= (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82
, BgL_sc_statezd2num_68zd2
, next
)));
4168 (conf_set_union(sc_state_82
, next_set
, next
, BgL_sc_confzd2set_79zd2
));
4178 (preds
= (sc_predictors_71
[(step
+BgL_sc_nbzd2nts_81zd2
)]));
4179 (sc_states_78
= sc_states_67
);
4180 (state
= sc_state_82
);
4181 (BgL_sc_statezd2num_77zd2
= BgL_sc_statezd2num_68zd2
);
4182 (BgL_sc_confzd2set_76zd2
= BgL_sc_confzd2set_79zd2
);
4183 sc_loop1_75 = function(l
) {
4185 var BgL_sc_nextzd2set_84zd2
;
4190 if ((l
instanceof sc_Pair
))
4196 (pred_set
= ((sc_state_83
= (sc_states_78
[i
])), (sc_state_83
[(pred
+(1))])));
4197 if ((pred_set
!== false))
4199 (sc_next_85
= (pred
+(1)));
4200 (BgL_sc_nextzd2set_84zd2
= (BgL_sc_confzd2setzd2getza2_44za2(state
, BgL_sc_statezd2num_77zd2
, sc_next_85
)));
4201 (conf_set_union(state
, BgL_sc_nextzd2set_84zd2
, sc_next_85
, pred_set
));
4203 (i
= (BgL_sc_confzd2set_76zd2
[(i
+(5))]));
4206 return (sc_loop1_75((l
.cdr
)));
4211 (sc_loop1_75(preds
));
4220 is_parsed = function(nt
, i
, j
, sc_nts_86
, sc_enders_87
, sc_states_88
) {
4225 var BgL_sc_ntza2_90za2
;
4227 (BgL_sc_ntza2_90za2
= (sc_ind_43(nt
, sc_nts_86
)));
4228 if ((BgL_sc_ntza2_90za2
!== false))
4231 (l
= (sc_enders_87
[BgL_sc_ntza2_90za2
]));
4233 if ((l
instanceof sc_Pair
))
4235 (sc_conf_89
= (l
.car
));
4236 if ((((state
= (sc_states_88
[j
])), (conf_set
= (state
[(sc_conf_89
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false))
4249 deriv_trees = function(sc_conf_91
, i
, j
, sc_enders_92
, sc_steps_93
, sc_names_94
, sc_toks_95
, sc_states_96
, BgL_sc_nbzd2nts_97zd2
) {
4253 return ((name
= (sc_names_94
[sc_conf_91
])), ((name
!== false)?((sc_conf_91
<BgL_sc_nbzd2nts_97zd2
)?(sc_list((sc_list(name
, ((sc_toks_95
[i
]).car
))))):(sc_list((sc_list(name
))))):((prev
= (sc_conf_91
-(1))), (sc_loop1_98 = function(l1
, l2
) {
4261 if ((l1
instanceof sc_Pair
))
4264 (ender_set
= ((state
= (sc_states_96
[j
])), (state
[(ender
+(1))])));
4265 if ((ender_set
!== false))
4267 loop2 = function(k
, l2
) {
4277 if (((k
>=i
)&&(((sc_state_99
= (sc_states_96
[k
])), (conf_set
= (sc_state_99
[(prev
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false)))
4279 (prev_trees
= (deriv_trees(prev
, i
, k
, sc_enders_92
, sc_steps_93
, sc_names_94
, sc_toks_95
, sc_states_96
, BgL_sc_nbzd2nts_97zd2
)));
4280 (ender_trees
= (deriv_trees(ender
, k
, j
, sc_enders_92
, sc_steps_93
, sc_names_94
, sc_toks_95
, sc_states_96
, BgL_sc_nbzd2nts_97zd2
)));
4281 loop3 = function(l3
, l2
) {
4285 if ((l3
instanceof sc_Pair
))
4287 (ender_tree
= (sc_list((l3
.car
))));
4290 while ((l4
instanceof sc_Pair
)) {
4292 (sc_l2_100
= (new sc_Pair((sc_append((l4
.car
), ender_tree
)), sc_l2_100
)));
4296 return (loop3((l3
.cdr
), sc_l2_100
));
4299 return (loop2((ender_set
[(k
+(5))]), l2
));
4301 return (loop3(ender_trees
, l2
));
4304 (k
= (ender_set
[(k
+(5))]));
4306 return (sc_loop1_98((l1
.cdr
), l2
));
4309 return (loop2((ender_set
[(2)]), l2
));
4317 }), (sc_loop1_98((sc_enders_92
[(sc_steps_93
[prev
])]), null)))));
4319 BgL_sc_derivzd2treesza2_47z70 = function(nt
, i
, j
, sc_nts_101
, sc_enders_102
, sc_steps_103
, sc_names_104
, sc_toks_105
, sc_states_106
) {
4325 var BgL_sc_nbzd2nts_108zd2
;
4326 var BgL_sc_ntza2_109za2
;
4328 (BgL_sc_ntza2_109za2
= (sc_ind_43(nt
, sc_nts_101
)));
4329 if ((BgL_sc_ntza2_109za2
!== false))
4331 (BgL_sc_nbzd2nts_108zd2
= (sc_nts_101
.length
));
4332 (l
= (sc_enders_102
[BgL_sc_ntza2_109za2
]));
4334 while ((l
instanceof sc_Pair
)) {
4336 (sc_conf_107
= (l
.car
));
4337 if ((((state
= (sc_states_106
[j
])), (conf_set
= (state
[(sc_conf_107
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false))
4340 (trees
= (sc_append((deriv_trees(sc_conf_107
, i
, j
, sc_enders_102
, sc_steps_103
, sc_names_104
, sc_toks_105
, sc_states_106
, BgL_sc_nbzd2nts_108zd2
)), trees
)));
4352 nb_deriv_trees = function(sc_conf_110
, i
, j
, sc_enders_111
, sc_steps_112
, sc_toks_113
, sc_states_114
, BgL_sc_nbzd2nts_115zd2
) {
4356 return ((prev
= (sc_conf_110
-(1))), ((((tmp1124
= (sc_conf_110
<BgL_sc_nbzd2nts_115zd2
)), ((tmp1124
!== false)?tmp1124:((sc_steps_112
[prev
])<(0))))!== false)?(1):((sc_loop1_116 = function(l
, sc_n_118
) {
4369 if ((l
instanceof sc_Pair
))
4372 (ender_set
= ((sc_state_117
= (sc_states_114
[j
])), (sc_state_117
[(ender
+(1))])));
4373 if ((ender_set
!== false))
4375 (k
= (ender_set
[(2)]));
4378 if (((k
>=i
)&&(((state
= (sc_states_114
[k
])), (conf_set
= (state
[(prev
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false)))
4380 (nb_prev_trees
= (nb_deriv_trees(prev
, i
, k
, sc_enders_111
, sc_steps_112
, sc_toks_113
, sc_states_114
, BgL_sc_nbzd2nts_115zd2
)));
4381 (nb_ender_trees
= (nb_deriv_trees(ender
, k
, j
, sc_enders_111
, sc_steps_112
, sc_toks_113
, sc_states_114
, BgL_sc_nbzd2nts_115zd2
)));
4382 (k
= (ender_set
[(k
+(5))]));
4383 (n
+=(nb_prev_trees
*nb_ender_trees
));
4386 (k
= (ender_set
[(k
+(5))]));
4388 return (sc_loop1_116((l
.cdr
), n
));
4396 }), (sc_loop1_116((sc_enders_111
[(sc_steps_112
[prev
])]), (0))))));
4398 BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt
, i
, j
, sc_nts_119
, sc_enders_120
, sc_steps_121
, sc_toks_122
, sc_states_123
) {
4404 var BgL_sc_nbzd2nts_125zd2
;
4405 var BgL_sc_ntza2_126za2
;
4407 (BgL_sc_ntza2_126za2
= (sc_ind_43(nt
, sc_nts_119
)));
4408 if ((BgL_sc_ntza2_126za2
!== false))
4410 (BgL_sc_nbzd2nts_125zd2
= (sc_nts_119
.length
));
4411 (l
= (sc_enders_120
[BgL_sc_ntza2_126za2
]));
4413 while ((l
instanceof sc_Pair
)) {
4415 (sc_conf_124
= (l
.car
));
4416 if ((((state
= (sc_states_123
[j
])), (conf_set
= (state
[(sc_conf_124
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false))
4419 (nb_trees
= ((nb_deriv_trees(sc_conf_124
, i
, j
, sc_enders_120
, sc_steps_121
, sc_toks_122
, sc_states_123
, BgL_sc_nbzd2nts_125zd2
))+nb_trees
));
4431 (lexer
= (parser_descr
[(0)]));
4432 (sc_nts_42
= (parser_descr
[(1)]));
4433 (sc_starters_41
= (parser_descr
[(2)]));
4434 (sc_enders_40
= (parser_descr
[(3)]));
4435 (sc_predictors_39
= (parser_descr
[(4)]));
4436 (sc_steps_38
= (parser_descr
[(5)]));
4437 (sc_names_37
= (parser_descr
[(6)]));
4438 (falseHead1128
= (new sc_Pair(null, null)));
4439 (L1125
= (lexer(input
)));
4440 (tail1129
= falseHead1128
);
4441 while (!(L1125
=== null)) {
4443 (tok
= (L1125
.car
));
4446 while ((l1
instanceof sc_Pair
)) {
4448 (sc_i_29
= (sc_ind_43((l1
.car
), sc_nts_42
)));
4449 if ((sc_i_29
!== false))
4452 (l2
= (new sc_Pair(sc_i_29
, l2
)));
4458 (sc_optrOpnd_22
= (new sc_Pair((tok
.car
), (sc_reverse(l2
)))));
4459 (sc_optrOpnd_21
= (new sc_Pair(sc_optrOpnd_22
, null)));
4460 (tail1129
.cdr
= sc_optrOpnd_21
);
4461 (tail1129
= (tail1129
.cdr
));
4462 (L1125
= (L1125
.cdr
));
4465 (sc_optrOpnd_20
= (falseHead1128
.cdr
));
4466 (sc_toks_36
= (sc_list2vector(sc_optrOpnd_20
)));
4467 (BgL_sc_nbzd2toks_35zd2
= (sc_toks_36
.length
));
4468 (BgL_sc_nbzd2confs_34zd2
= (sc_steps_38
.length
));
4469 (sc_states_33
= (make_states(BgL_sc_nbzd2toks_35zd2
, BgL_sc_nbzd2confs_34zd2
)));
4470 (goal_starters
= (sc_starters_41
[(0)]));
4471 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33
, (0), goal_starters
, (0)));
4472 (forw(sc_states_33
, (0), sc_starters_41
, sc_enders_40
, sc_predictors_39
, sc_steps_38
, sc_nts_42
));
4474 while ((sc_i_28
<BgL_sc_nbzd2toks_35zd2
)) {
4476 (tok_nts
= ((sc_toks_36
[sc_i_28
]).cdr
));
4477 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33
, (sc_i_28
+(1)), tok_nts
, sc_i_28
));
4478 (forw(sc_states_33
, (sc_i_28
+(1)), sc_starters_41
, sc_enders_40
, sc_predictors_39
, sc_steps_38
, sc_nts_42
));
4482 (nb_toks
= (sc_toks_36
.length
));
4483 (BgL_sc_nbzd2confs_32zd2
= (sc_steps_38
.length
));
4484 (BgL_sc_nbzd2nts_31zd2
= (sc_nts_42
.length
));
4485 (BgL_sc_statesza2_30za2
= (make_states(nb_toks
, BgL_sc_nbzd2confs_32zd2
)));
4486 (goal_enders
= (sc_enders_40
[(0)]));
4488 while ((l
instanceof sc_Pair
)) {
4491 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_33
, BgL_sc_statesza2_30za2
, nb_toks
, conf
, (0)));
4498 (states
= sc_states_33
);
4499 (BgL_sc_statesza2_27za2
= BgL_sc_statesza2_30za2
);
4501 (sc_enders_26
= sc_enders_40
);
4502 (sc_steps_25
= sc_steps_38
);
4503 (BgL_sc_nbzd2nts_24zd2
= BgL_sc_nbzd2nts_31zd2
);
4504 (toks
= sc_toks_36
);
4505 (BgL_sc_stateza2_23za2
= (BgL_sc_statesza2_30za2
[i
]));
4506 loop1 = function() {
4509 var BgL_sc_statesza2_128za2
;
4518 (sc_conf_131
= (BgL_sc_stateza2_23za2
[(0)]));
4519 if ((sc_conf_131
>=(0)))
4521 (conf_set
= (BgL_sc_stateza2_23za2
[(sc_conf_131
+(1))]));
4522 (head
= (conf_set
[(4)]));
4523 (BgL_sc_stateza2_23za2
[(0)] = (conf_set
[(0)]));
4524 (conf_set_merge_new_bang(conf_set
));
4526 while ((sc_i_130
>=(0))) {
4530 (sc_states_129
= states
);
4531 (BgL_sc_statesza2_128za2
= BgL_sc_statesza2_27za2
);
4532 (prev
= (sc_conf_131
-(1)));
4533 if (((sc_conf_131
>=BgL_sc_nbzd2nts_24zd2
)&&((sc_steps_25
[prev
])>=(0))))
4535 sc_loop1_127 = function(l
) {
4542 if ((l
instanceof sc_Pair
))
4545 (ender_set
= ((state
= (sc_states_129
[j
])), (state
[(ender
+(1))])));
4546 if ((ender_set
!== false))
4548 (k
= (ender_set
[(2)]));
4552 if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129
, BgL_sc_statesza2_128za2
, k
, prev
, i
))!== false))
4553 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129
, BgL_sc_statesza2_128za2
, j
, ender
, k
));
4554 (k
= (ender_set
[(k
+(5))]));
4557 return (sc_loop1_127((l
.cdr
)));
4566 (sc_loop1_127((sc_enders_26
[(sc_steps_25
[prev
])])));
4568 (sc_i_130
= (conf_set
[(sc_i_130
+(5))]));
4581 (optrOpnd
= BgL_sc_statesza2_30za2
);
4582 return [sc_nts_42
, sc_starters_41
, sc_enders_40
, sc_predictors_39
, sc_steps_38
, sc_names_37
, sc_toks_36
, optrOpnd
, is_parsed
, BgL_sc_derivzd2treesza2_47z70
, BgL_sc_nbzd2derivzd2treesza2_48za2
];
4587 BgL_parsezd2ze3parsedzf3zc2 = function(parse
, nt
, i
, j
) {
4592 return ((nts
= (parse
[(0)])), (enders
= (parse
[(2)])), (states
= (parse
[(7)])), (is_parsed
= (parse
[(8)])), (is_parsed(nt
, i
, j
, nts
, enders
, states
)));
4594 BgL_parsezd2ze3treesz31 = function(parse
, nt
, i
, j
) {
4595 var BgL_sc_derivzd2treesza2_132z70
;
4602 return ((nts
= (parse
[(0)])), (enders
= (parse
[(2)])), (steps
= (parse
[(4)])), (names
= (parse
[(5)])), (toks
= (parse
[(6)])), (states
= (parse
[(7)])), (BgL_sc_derivzd2treesza2_132z70
= (parse
[(9)])), (BgL_sc_derivzd2treesza2_132z70(nt
, i
, j
, nts
, enders
, steps
, names
, toks
, states
)));
4604 BgL_parsezd2ze3nbzd2treesze3 = function(parse
, nt
, i
, j
) {
4605 var BgL_sc_nbzd2derivzd2treesza2_133za2
;
4611 return ((nts
= (parse
[(0)])), (enders
= (parse
[(2)])), (steps
= (parse
[(4)])), (toks
= (parse
[(6)])), (states
= (parse
[(7)])), (BgL_sc_nbzd2derivzd2treesza2_133za2
= (parse
[(10)])), (BgL_sc_nbzd2derivzd2treesza2_133za2(nt
, i
, j
, nts
, enders
, steps
, toks
, states
)));
4613 test = function(k
) {
4616 return ((p
= (BgL_makezd2parserzd2(const_earley
, function(l
) {
4622 (falseHead1133
= (new sc_Pair(null, null)));
4623 (tail1134
= falseHead1133
);
4625 while (!(L1130
=== null)) {
4627 (tail1134
.cdr
= (new sc_Pair(((sc_x_134
= (L1130
.car
)), (sc_list(sc_x_134
, sc_x_134
))), null)));
4628 (tail1134
= (tail1134
.cdr
));
4629 (L1130
= (L1130
.cdr
));
4632 return (falseHead1133
.cdr
);
4634 }))), (x
= (p((sc_vector2list((sc_makeVector(k
, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x
, "\u1E9Cs", (0), k
)))));
4636 BgL_earleyzd2benchmarkzd2 = function() {
4638 for (var sc_tmp
= arguments
.length
- 1; sc_tmp
>= 0; sc_tmp
--) {
4639 args
= sc_cons(arguments
[sc_tmp
], args
);
4642 return ((k
= ((args
=== null)?(7):(args
.car
))), (BgL_runzd2benchmarkzd2("earley", (1), function() {
4644 }, function(result
) {
4645 return ((sc_display(result
)), (sc_newline()), result
== 132);
4651 /************* END OF GENERATED CODE *************/
4652 // Invoke this function to run a benchmark.
4653 // The first argument is a string identifying the benchmark.
4654 // The second argument is the number of times to run the benchmark.
4655 // The third argument is a function that runs the benchmark.
4656 // The fourth argument is a unary function that warns if the result
4657 // returned by the benchmark is incorrect.
4660 // RunBenchmark("new Array()",
4662 // function () { new Array(1000000); }
4664 // return (v instanceof Array) && (v.length == 1000000);
4667 SC_DEFAULT_OUT
= new sc_GenericOutputPort(function(s
) {});
4668 SC_ERROR_OUT
= SC_DEFAULT_OUT
;
4670 function RunBenchmark(name
, count
, run
, warn
) {
4671 for (var n
= 0; n
< count
; ++n
) {
4673 if (!warn(result
)) {
4674 throw new Error("Earley or Boyer did incorrect number of rewrites");
4679 var BgL_runzd2benchmarkzd2
= RunBenchmark
;
4681 for (var i
= 0; i
< 4; ++i
) {
4682 BgL_earleyzd2benchmarkzd2();
4683 BgL_nboyerzd2benchmarkzd2();
4687 print("JSC EXCEPTION FUZZ: Caught exception: " + e
);