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;
42 enableExceptionFuzz();
45 function sc_print_debug() {
46 sc_print
.apply(null, arguments
);
48 /*** META ((export *js*)) */
49 var sc_JS_GLOBALS
= this;
54 /*** META ((export #t)) */
56 var len
= arguments
.length
;
60 for( i
= 0; i
< len
; i
++ ) {
61 s
+= sc_toDisplayString(arguments
[ i
]);
67 /*** META ((export #t)) */
68 function sc_typeof( x
) {
72 /*** META ((export #t)) */
74 var a
= [sc_jsstring2symbol("*error*")];
75 for (var i
= 0; i
< arguments
.length
; i
++) {
76 a
[i
+1] = arguments
[i
];
81 /*** META ((export #t)
82 (peephole (prefix "throw ")))
84 function sc_raise(obj
) {
88 /*** META ((export with-handler-lambda)) */
89 function sc_withHandlerLambda(handler
, body
) {
93 if (!e
._internalException
)
100 var sc_properties
= new Object();
102 /*** META ((export #t)) */
103 function sc_putpropBang(sym
, key
, val
) {
104 var ht
= sc_properties
[sym
];
107 sc_properties
[sym
] = ht
;
112 /*** META ((export #t)) */
113 function sc_getprop(sym
, key
) {
114 var ht
= sc_properties
[sym
];
124 /*** META ((export #t)) */
125 function sc_rempropBang(sym
, key
) {
126 var ht
= sc_properties
[sym
];
131 /*** META ((export #t)) */
132 function sc_any2String(o
) {
133 return jsstring2string(sc_toDisplayString(o
));
136 /*** META ((export #t)
137 (peephole (infix 2 2 "==="))
140 function sc_isEqv(o1
, o2
) {
144 /*** META ((export #t)
145 (peephole (infix 2 2 "==="))
148 function sc_isEq(o1
, o2
) {
152 /*** META ((export #t)
155 function sc_isNumber(n
) {
156 return (typeof n
=== "number");
159 /*** META ((export #t)
162 function sc_isComplex(n
) {
163 return sc_isNumber(n
);
166 /*** META ((export #t)
169 function sc_isReal(n
) {
170 return sc_isNumber(n
);
173 /*** META ((export #t)
176 function sc_isRational(n
) {
180 /*** META ((export #t)
183 function sc_isInteger(n
) {
184 return (parseInt(n
) === n
);
187 /*** META ((export #t)
189 (peephole (postfix ", false")))
191 // we don't have exact numbers...
192 function sc_isExact(n
) {
196 /*** META ((export #t)
197 (peephole (postfix ", true"))
200 function sc_isInexact(n
) {
204 /*** META ((export = =fx =fl)
206 (peephole (infix 2 2 "===")))
208 function sc_equal(x
) {
209 for (var i
= 1; i
< arguments
.length
; i
++)
210 if (x
!== arguments
[i
])
215 /*** META ((export < <fx <fl)
217 (peephole (infix 2 2 "<")))
219 function sc_less(x
) {
220 for (var i
= 1; i
< arguments
.length
; i
++) {
221 if (x
>= arguments
[i
])
228 /*** META ((export > >fx >fl)
230 (peephole (infix 2 2 ">")))
232 function sc_greater(x
, y
) {
233 for (var i
= 1; i
< arguments
.length
; i
++) {
234 if (x
<= arguments
[i
])
241 /*** META ((export <= <=fx <=fl)
243 (peephole (infix 2 2 "<=")))
245 function sc_lessEqual(x
, y
) {
246 for (var i
= 1; i
< arguments
.length
; i
++) {
247 if (x
> arguments
[i
])
254 /*** META ((export >= >=fl >=fx)
256 (peephole (infix 2 2 ">=")))
258 function sc_greaterEqual(x
, y
) {
259 for (var i
= 1; i
< arguments
.length
; i
++) {
260 if (x
< arguments
[i
])
267 /*** META ((export #t)
269 (peephole (postfix "=== 0")))
271 function sc_isZero(x
) {
275 /*** META ((export #t)
277 (peephole (postfix "> 0")))
279 function sc_isPositive(x
) {
283 /*** META ((export #t)
285 (peephole (postfix "< 0")))
287 function sc_isNegative(x
) {
291 /*** META ((export #t)
293 (peephole (postfix "%2===1")))
295 function sc_isOdd(x
) {
296 return (x
% 2 === 1);
299 /*** META ((export #t)
301 (peephole (postfix "%2===0")))
303 function sc_isEven(x
) {
304 return (x
% 2 === 0);
307 /*** META ((export #t)) */
308 var sc_max
= Math
.max
;
309 /*** META ((export #t)) */
310 var sc_min
= Math
.min
;
312 /*** META ((export + +fx +fl)
313 (peephole (infix 0 #f "+" "0")))
317 for (var i
= 0; i
< arguments
.length
; i
++)
322 /*** META ((export * *fx *fl)
323 (peephole (infix 0 #f "*" "1")))
325 function sc_multi() {
327 for (var i
= 0; i
< arguments
.length
; i
++)
328 product
*= arguments
[i
];
332 /*** META ((export - -fx -fl)
335 function sc_minus(x
) {
336 if (arguments
.length
=== 1)
340 for (var i
= 1; i
< arguments
.length
; i
++)
346 /*** META ((export / /fl)
350 if (arguments
.length
=== 1)
354 for (var i
= 1; i
< arguments
.length
; i
++)
360 /*** META ((export #t)) */
361 var sc_abs
= Math
.abs
;
363 /*** META ((export quotient /fx)
364 (peephole (hole 2 "parseInt(" x "/" y ")")))
366 function sc_quotient(x
, y
) {
367 return parseInt(x
/ y
);
370 /*** META ((export #t)
371 (peephole (infix 2 2 "%")))
373 function sc_remainder(x
, y
) {
377 /*** META ((export #t)
380 function sc_modulo(x
, y
) {
381 var remainder
= x
% y
;
382 // if they don't have the same sign
383 if ((remainder
* y
) < 0)
384 return remainder
+ y
;
389 function sc_euclid_gcd(a
, b
) {
391 if (a
=== 0) return b
;
392 if (b
=== 0) return a
;
393 if (a
< 0) {a
= -a
;};
394 if (b
< 0) {b
= -b
;};
395 if (b
> a
) {temp
= a
; a
= b
; b
= temp
;};
398 if(a
=== 0) {return b
;};
400 if(b
=== 0) {return a
;};
405 /*** META ((export #t)) */
408 for (var i
= 0; i
< arguments
.length
; i
++)
409 gcd
= sc_euclid_gcd(gcd
, arguments
[i
]);
413 /*** META ((export #t)) */
416 for (var i
= 0; i
< arguments
.length
; i
++) {
417 var f
= Math
.round(arguments
[i
] / sc_euclid_gcd(arguments
[i
], lcm
));
423 // LIMITATION: numerator and denominator don't make sense in floating point world.
424 //var SC_MAX_DECIMALS = 1000000
426 // function sc_numerator(x) {
427 // var rounded = Math.round(x * SC_MAX_DECIMALS);
428 // return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
431 // function sc_denominator(x) {
432 // var rounded = Math.round(x * SC_MAX_DECIMALS);
433 // return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
436 /*** META ((export #t)) */
437 var sc_floor
= Math
.floor
;
438 /*** META ((export #t)) */
439 var sc_ceiling
= Math
.ceil
;
440 /*** META ((export #t)) */
441 var sc_truncate
= parseInt
;
442 /*** META ((export #t)) */
443 var sc_round
= Math
.round
;
445 // LIMITATION: sc_rationalize doesn't make sense in a floating point world.
447 /*** META ((export #t)) */
448 var sc_exp
= Math
.exp
;
449 /*** META ((export #t)) */
450 var sc_log
= Math
.log
;
451 /*** META ((export #t)) */
452 var sc_sin
= Math
.sin
;
453 /*** META ((export #t)) */
454 var sc_cos
= Math
.cos
;
455 /*** META ((export #t)) */
456 var sc_tan
= Math
.tan
;
457 /*** META ((export #t)) */
458 var sc_asin
= Math
.asin
;
459 /*** META ((export #t)) */
460 var sc_acos
= Math
.acos
;
461 /*** META ((export #t)) */
462 var sc_atan
= Math
.atan
;
464 /*** META ((export #t)) */
465 var sc_sqrt
= Math
.sqrt
;
466 /*** META ((export #t)) */
467 var sc_expt
= Math
.pow
;
469 // LIMITATION: we don't have complex numbers.
470 // LIMITATION: the following functions are hence not implemented.
471 // LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle
472 // LIMITATION: 2 argument atan
474 /*** META ((export #t)
477 function sc_exact2inexact(x
) {
481 /*** META ((export #t)
484 function sc_inexact2exact(x
) {
488 function sc_number2jsstring(x
, radix
) {
490 return x
.toString(radix
);
495 function sc_jsstring2number(s
, radix
) {
496 if (s
=== "") return false;
499 var t
= parseInt(s
, radix
);
500 if (!t
&& t
!== 0) return false;
501 // verify that each char is in range. (parseInt ignores leading
502 // white and trailing chars)
503 var allowedChars
= "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix
+1);
504 if ((new RegExp("^["+allowedChars
+"]*$", "i")).test(s
))
508 var t
= +s
; // does not ignore trailing chars.
509 if (!t
&& t
!== 0) return false;
510 // simply verify that first char is not whitespace.
512 // if +c is 0, but the char is not "0", then we have a whitespace.
513 if (+c
=== 0 && c
!== "0") return false;
518 /*** META ((export #t)
526 /*** META ((export #t)
529 function sc_isBoolean(b
) {
530 return (b
=== true) || (b
=== false);
533 function sc_Pair(car
, cdr
) {
538 sc_Pair
.prototype.toString = function() {
539 return sc_toDisplayString(this);
541 sc_Pair
.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay
) {
547 res
+= writeOrDisplay(current
.car
);
548 if (sc_isPair(current
.cdr
)) {
550 current
= current
.cdr
;
551 } else if (current
.cdr
!== null) {
552 res
+= " . " + writeOrDisplay(current
.cdr
);
554 } else // current.cdr == null
562 sc_Pair
.prototype.sc_toDisplayString = function() {
563 return this.sc_toWriteOrDisplayString(sc_toDisplayString
);
565 sc_Pair
.prototype.sc_toWriteString = function() {
566 return this.sc_toWriteOrDisplayString(sc_toWriteString
);
568 // sc_Pair.prototype.sc_toWriteCircleString in IO.js
570 /*** META ((export #t)
572 (peephole (postfix " instanceof sc_Pair")))
574 function sc_isPair(p
) {
575 return (p
instanceof sc_Pair
);
578 function sc_isPairEqual(p1
, p2
, comp
) {
579 return (comp(p1
.car
, p2
.car
) && comp(p1
.cdr
, p2
.cdr
));
582 /*** META ((export #t)
583 (peephole (hole 2 "new sc_Pair(" car ", " cdr ")")))
585 function sc_cons(car
, cdr
) {
586 return new sc_Pair(car
, cdr
);
589 /*** META ((export cons*)) */
590 function sc_consStar() {
591 var res
= arguments
[arguments
.length
- 1];
592 for (var i
= arguments
.length
-2; i
>= 0; i
--)
593 res
= new sc_Pair(arguments
[i
], res
);
597 /*** META ((export #t)
598 (peephole (postfix ".car")))
604 /*** META ((export #t)
605 (peephole (postfix ".cdr")))
611 /*** META ((export #t)
612 (peephole (hole 2 p ".car = " val)))
614 function sc_setCarBang(p
, val
) {
618 /*** META ((export #t)
619 (peephole (hole 2 p ".cdr = " val)))
621 function sc_setCdrBang(p
, val
) {
625 /*** META ((export #t)
626 (peephole (postfix ".car.car")))
628 function sc_caar(p
) { return p
.car
.car
; }
629 /*** META ((export #t)
630 (peephole (postfix ".cdr.car")))
632 function sc_cadr(p
) { return p
.cdr
.car
; }
633 /*** META ((export #t)
634 (peephole (postfix ".car.cdr")))
636 function sc_cdar(p
) { return p
.car
.cdr
; }
637 /*** META ((export #t)
638 (peephole (postfix ".cdr.cdr")))
640 function sc_cddr(p
) { return p
.cdr
.cdr
; }
641 /*** META ((export #t)
642 (peephole (postfix ".car.car.car")))
644 function sc_caaar(p
) { return p
.car
.car
.car
; }
645 /*** META ((export #t)
646 (peephole (postfix ".car.cdr.car")))
648 function sc_cadar(p
) { return p
.car
.cdr
.car
; }
649 /*** META ((export #t)
650 (peephole (postfix ".cdr.car.car")))
652 function sc_caadr(p
) { return p
.cdr
.car
.car
; }
653 /*** META ((export #t)
654 (peephole (postfix ".cdr.cdr.car")))
656 function sc_caddr(p
) { return p
.cdr
.cdr
.car
; }
657 /*** META ((export #t)
658 (peephole (postfix ".car.car.cdr")))
660 function sc_cdaar(p
) { return p
.car
.car
.cdr
; }
661 /*** META ((export #t)
662 (peephole (postfix ".cdr.car.cdr")))
664 function sc_cdadr(p
) { return p
.cdr
.car
.cdr
; }
665 /*** META ((export #t)
666 (peephole (postfix ".car.cdr.cdr")))
668 function sc_cddar(p
) { return p
.car
.cdr
.cdr
; }
669 /*** META ((export #t)
670 (peephole (postfix ".cdr.cdr.cdr")))
672 function sc_cdddr(p
) { return p
.cdr
.cdr
.cdr
; }
673 /*** META ((export #t)
674 (peephole (postfix ".car.car.car.car")))
676 function sc_caaaar(p
) { return p
.car
.car
.car
.car
; }
677 /*** META ((export #t)
678 (peephole (postfix ".car.cdr.car.car")))
680 function sc_caadar(p
) { return p
.car
.cdr
.car
.car
; }
681 /*** META ((export #t)
682 (peephole (postfix ".cdr.car.car.car")))
684 function sc_caaadr(p
) { return p
.cdr
.car
.car
.car
; }
685 /*** META ((export #t)
686 (peephole (postfix ".cdr.cdr.car.car")))
688 function sc_caaddr(p
) { return p
.cdr
.cdr
.car
.car
; }
689 /*** META ((export #t)
690 (peephole (postfix ".car.car.car.cdr")))
692 function sc_cdaaar(p
) { return p
.car
.car
.car
.cdr
; }
693 /*** META ((export #t)
694 (peephole (postfix ".car.cdr.car.cdr")))
696 function sc_cdadar(p
) { return p
.car
.cdr
.car
.cdr
; }
697 /*** META ((export #t)
698 (peephole (postfix ".cdr.car.car.cdr")))
700 function sc_cdaadr(p
) { return p
.cdr
.car
.car
.cdr
; }
701 /*** META ((export #t)
702 (peephole (postfix ".cdr.cdr.car.cdr")))
704 function sc_cdaddr(p
) { return p
.cdr
.cdr
.car
.cdr
; }
705 /*** META ((export #t)
706 (peephole (postfix ".car.car.cdr.car")))
708 function sc_cadaar(p
) { return p
.car
.car
.cdr
.car
; }
709 /*** META ((export #t)
710 (peephole (postfix ".car.cdr.cdr.car")))
712 function sc_caddar(p
) { return p
.car
.cdr
.cdr
.car
; }
713 /*** META ((export #t)
714 (peephole (postfix ".cdr.car.cdr.car")))
716 function sc_cadadr(p
) { return p
.cdr
.car
.cdr
.car
; }
717 /*** META ((export #t)
718 (peephole (postfix ".cdr.cdr.cdr.car")))
720 function sc_cadddr(p
) { return p
.cdr
.cdr
.cdr
.car
; }
721 /*** META ((export #t)
722 (peephole (postfix ".car.car.cdr.cdr")))
724 function sc_cddaar(p
) { return p
.car
.car
.cdr
.cdr
; }
725 /*** META ((export #t)
726 (peephole (postfix ".car.cdr.cdr.cdr")))
728 function sc_cdddar(p
) { return p
.car
.cdr
.cdr
.cdr
; }
729 /*** META ((export #t)
730 (peephole (postfix ".cdr.car.cdr.cdr")))
732 function sc_cddadr(p
) { return p
.cdr
.car
.cdr
.cdr
; }
733 /*** META ((export #t)
734 (peephole (postfix ".cdr.cdr.cdr.cdr")))
736 function sc_cddddr(p
) { return p
.cdr
.cdr
.cdr
.cdr
; }
738 /*** META ((export #t)) */
739 function sc_lastPair(l
) {
740 if (!sc_isPair(l
)) sc_error("sc_lastPair: pair expected");
743 while (sc_isPair(cdr
)) {
750 /*** META ((export #t)
752 (peephole (postfix " === null")))
754 function sc_isNull(o
) {
758 /*** META ((export #t)
761 function sc_isList(o
) {
768 if (rabbit
=== null ||
769 (rabbit
instanceof sc_Pair
&& rabbit
.cdr
=== null))
770 return true; // end of list
771 else if ((rabbit
instanceof sc_Pair
) &&
772 (rabbit
.cdr
instanceof sc_Pair
)) {
773 rabbit
= rabbit
.cdr
.cdr
;
775 if (rabbit
=== turtle
) return false; // cycle
777 return false; // not pair
781 /*** META ((export #t)) */
785 for (var i
= a
.length
-1; i
>= 0; i
--)
786 res
= new sc_Pair(a
[i
], res
);
790 /*** META ((export #t)) */
791 function sc_iota(num
, init
) {
794 for (var i
= num
- 1; i
>= 0; i
--)
795 res
= new sc_Pair(i
+ init
, res
);
799 /*** META ((export #t)) */
800 function sc_makeList(nbEls
, fill
) {
802 for (var i
= 0; i
< nbEls
; i
++)
803 res
= new sc_Pair(fill
, res
);
807 /*** META ((export #t)) */
808 function sc_length(l
) {
817 /*** META ((export #t)) */
818 function sc_remq(o
, l
) {
819 var dummy
= { cdr : null };
823 tail
.cdr
= sc_cons(l
.car
, null);
831 /*** META ((export #t)) */
832 function sc_remqBang(o
, l
) {
833 var dummy
= { cdr : null };
835 var needsAssig
= true;
852 /*** META ((export #t)) */
853 function sc_delete(o
, l
) {
854 var dummy
= { cdr : null };
857 if (!sc_isEqual(l
.car
, o
)) {
858 tail
.cdr
= sc_cons(l
.car
, null);
866 /*** META ((export #t)) */
867 function sc_deleteBang(o
, l
) {
868 var dummy
= { cdr : null };
870 var needsAssig
= true;
872 if (sc_isEqual(l
.car
, o
)) {
887 function sc_reverseAppendBang(l1
, l2
) {
889 while (l1
!== null) {
898 function sc_dualAppend(l1
, l2
) {
899 if (l1
=== null) return l2
;
900 if (l2
=== null) return l1
;
901 var rev
= sc_reverse(l1
);
902 return sc_reverseAppendBang(rev
, l2
);
905 /*** META ((export #t)) */
906 function sc_append() {
907 if (arguments
.length
=== 0)
909 var res
= arguments
[arguments
.length
- 1];
910 for (var i
= arguments
.length
- 2; i
>= 0; i
--)
911 res
= sc_dualAppend(arguments
[i
], res
);
915 function sc_dualAppendBang(l1
, l2
) {
916 if (l1
=== null) return l2
;
917 if (l2
=== null) return l1
;
919 while (tmp
.cdr
!== null) tmp
=tmp
.cdr
;
924 /*** META ((export #t)) */
925 function sc_appendBang() {
927 for (var i
= 0; i
< arguments
.length
; i
++)
928 res
= sc_dualAppendBang(res
, arguments
[i
]);
932 /*** META ((export #t)) */
933 function sc_reverse(l1
) {
935 while (l1
!== null) {
936 res
= sc_cons(l1
.car
, res
);
942 /*** META ((export #t)) */
943 function sc_reverseBang(l
) {
944 return sc_reverseAppendBang(l
, null);
947 /*** META ((export #t)) */
948 function sc_listTail(l
, k
) {
950 for (var i
= 0; i
< k
; i
++) {
956 /*** META ((export #t)) */
957 function sc_listRef(l
, k
) {
958 return sc_listTail(l
, k
).car
;
961 /* // unoptimized generic versions
962 function sc_memX(o, l, comp) {
970 function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); }
971 function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); }
972 function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); }
975 /* optimized versions */
976 /*** META ((export #t)) */
977 function sc_memq(o
, l
) {
985 /*** META ((export #t)) */
986 function sc_memv(o
, l
) {
994 /*** META ((export #t)) */
995 function sc_member(o
, l
) {
997 if (sc_isEqual(l
.car
,o
))
1004 /* // generic unoptimized versions
1005 function sc_assX(o, al, comp) {
1006 while (al != null) {
1007 if (comp(al.car.car, o))
1013 function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); }
1014 function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); }
1015 function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); }
1017 // optimized versions
1018 /*** META ((export #t)) */
1019 function sc_assq(o
, al
) {
1020 while (al
!== null) {
1021 if (al
.car
.car
=== o
)
1027 /*** META ((export #t)) */
1028 function sc_assv(o
, al
) {
1029 while (al
!== null) {
1030 if (al
.car
.car
=== o
)
1036 /*** META ((export #t)) */
1037 function sc_assoc(o
, al
) {
1038 while (al
!== null) {
1039 if (sc_isEqual(al
.car
.car
, o
))
1046 /* can be used for mutable strings and characters */
1047 function sc_isCharStringEqual(cs1
, cs2
) { return cs1
.val
=== cs2
.val
; }
1048 function sc_isCharStringLess(cs1
, cs2
) { return cs1
.val
< cs2
.val
; }
1049 function sc_isCharStringGreater(cs1
, cs2
) { return cs1
.val
> cs2
.val
; }
1050 function sc_isCharStringLessEqual(cs1
, cs2
) { return cs1
.val
<= cs2
.val
; }
1051 function sc_isCharStringGreaterEqual(cs1
, cs2
) { return cs1
.val
>= cs2
.val
; }
1052 function sc_isCharStringCIEqual(cs1
, cs2
)
1053 { return cs1
.val
.toLowerCase() === cs2
.val
.toLowerCase(); }
1054 function sc_isCharStringCILess(cs1
, cs2
)
1055 { return cs1
.val
.toLowerCase() < cs2
.val
.toLowerCase(); }
1056 function sc_isCharStringCIGreater(cs1
, cs2
)
1057 { return cs1
.val
.toLowerCase() > cs2
.val
.toLowerCase(); }
1058 function sc_isCharStringCILessEqual(cs1
, cs2
)
1059 { return cs1
.val
.toLowerCase() <= cs2
.val
.toLowerCase(); }
1060 function sc_isCharStringCIGreaterEqual(cs1
, cs2
)
1061 { return cs1
.val
.toLowerCase() >= cs2
.val
.toLowerCase(); }
1066 function sc_Char(c
) {
1067 var cached
= sc_Char
.lazy
[c
];
1071 sc_Char
.lazy
[c
] = this;
1072 // add return, so FF does not complain.
1075 sc_Char
.lazy
= new Object();
1077 sc_Char
.char2readable
= {
1080 "\010": "#\\backspace",
1082 "\012": "#\\newline",
1084 "\015": "#\\return",
1085 "\033": "#\\escape",
1087 "\177": "#\\delete",
1089 /* poeticless names */
1119 sc_Char
.readable2char
= {
1122 "backspace": "\010",
1164 sc_Char
.prototype.toString = function() {
1167 // sc_toDisplayString == toString
1168 sc_Char
.prototype.sc_toWriteString = function() {
1169 var entry
= sc_Char
.char2readable
[this.val
];
1173 return "#\\" + this.val
;
1176 /*** META ((export #t)
1178 (peephole (postfix "instanceof sc_Char")))
1180 function sc_isChar(c
) {
1181 return (c
instanceof sc_Char
);
1184 /*** META ((export char=?)
1186 (peephole (hole 2 c1 ".val === " c2 ".val")))
1188 var sc_isCharEqual
= sc_isCharStringEqual
;
1189 /*** META ((export char<?)
1191 (peephole (hole 2 c1 ".val < " c2 ".val")))
1193 var sc_isCharLess
= sc_isCharStringLess
;
1194 /*** META ((export char>?)
1196 (peephole (hole 2 c1 ".val > " c2 ".val")))
1198 var sc_isCharGreater
= sc_isCharStringGreater
;
1199 /*** META ((export char<=?)
1201 (peephole (hole 2 c1 ".val <= " c2 ".val")))
1203 var sc_isCharLessEqual
= sc_isCharStringLessEqual
;
1204 /*** META ((export char>=?)
1206 (peephole (hole 2 c1 ".val >= " c2 ".val")))
1208 var sc_isCharGreaterEqual
= sc_isCharStringGreaterEqual
;
1209 /*** META ((export char-ci=?)
1211 (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()")))
1213 var sc_isCharCIEqual
= sc_isCharStringCIEqual
;
1214 /*** META ((export char-ci<?)
1216 (peephole (hole 2 c1 ".val.toLowerCase() < " c2 ".val.toLowerCase()")))
1218 var sc_isCharCILess
= sc_isCharStringCILess
;
1219 /*** META ((export char-ci>?)
1221 (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()")))
1223 var sc_isCharCIGreater
= sc_isCharStringCIGreater
;
1224 /*** META ((export char-ci<=?)
1226 (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()")))
1228 var sc_isCharCILessEqual
= sc_isCharStringCILessEqual
;
1229 /*** META ((export char-ci>=?)
1231 (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()")))
1233 var sc_isCharCIGreaterEqual
= sc_isCharStringCIGreaterEqual
;
1235 var SC_NUMBER_CLASS
= "0123456789";
1236 var SC_WHITESPACE_CLASS
= ' \r\n\t\f';
1237 var SC_LOWER_CLASS
= 'abcdefghijklmnopqrstuvwxyz';
1238 var SC_UPPER_CLASS
= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
1240 function sc_isCharOfClass(c
, cl
) { return (cl
.indexOf(c
) != -1); }
1241 /*** META ((export #t)
1244 function sc_isCharAlphabetic(c
)
1245 { return sc_isCharOfClass(c
.val
, SC_LOWER_CLASS
) ||
1246 sc_isCharOfClass(c
.val
, SC_UPPER_CLASS
); }
1247 /*** META ((export #t)
1249 (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1")))
1251 function sc_isCharNumeric(c
)
1252 { return sc_isCharOfClass(c
.val
, SC_NUMBER_CLASS
); }
1253 /*** META ((export #t)
1256 function sc_isCharWhitespace(c
) {
1258 return tmp
=== " " || tmp
=== "\r" || tmp
=== "\n" || tmp
=== "\t" || tmp
=== "\f";
1260 /*** META ((export #t)
1262 (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1")))
1264 function sc_isCharUpperCase(c
)
1265 { return sc_isCharOfClass(c
.val
, SC_UPPER_CLASS
); }
1266 /*** META ((export #t)
1268 (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1")))
1270 function sc_isCharLowerCase(c
)
1271 { return sc_isCharOfClass(c
.val
, SC_LOWER_CLASS
); }
1273 /*** META ((export #t)
1274 (peephole (postfix ".val.charCodeAt(0)")))
1276 function sc_char2integer(c
)
1277 { return c
.val
.charCodeAt(0); }
1278 /*** META ((export #t)
1279 (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))")))
1281 function sc_integer2char(n
)
1282 { return new sc_Char(String
.fromCharCode(n
)); }
1284 /*** META ((export #t)
1285 (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())")))
1287 function sc_charUpcase(c
)
1288 { return new sc_Char(c
.val
.toUpperCase()); }
1289 /*** META ((export #t)
1290 (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())")))
1292 function sc_charDowncase(c
)
1293 { return new sc_Char(c
.val
.toLowerCase()); }
1295 function sc_makeJSStringOfLength(k
, c
) {
1297 if (c
=== undefined)
1303 // every round doubles the size of fill.
1306 res
= res
.concat(fill
);
1307 fill
= fill
.concat(fill
);
1313 function sc_makejsString(k
, c
) {
1319 return sc_makeJSStringOfLength(k
, fill
);
1322 function sc_jsstring2list(s
) {
1324 for (var i
= s
.length
- 1; i
>= 0; i
--)
1325 res
= sc_cons(new sc_Char(s
.charAt(i
)), res
);
1329 function sc_list2jsstring(l
) {
1330 var a
= new Array();
1335 return "".concat
.apply("", a
);
1338 var sc_Vector
= Array
;
1340 sc_Vector
.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay
) {
1341 if (this.length
=== 0) return "#()";
1343 var res
= "#(" + writeOrDisplay(this[0]);
1344 for (var i
= 1; i
< this.length
; i
++)
1345 res
+= " " + writeOrDisplay(this[i
]);
1349 sc_Vector
.prototype.sc_toDisplayString = function() {
1350 return this.sc_toWriteOrDisplayString(sc_toDisplayString
);
1352 sc_Vector
.prototype.sc_toWriteString = function() {
1353 return this.sc_toWriteOrDisplayString(sc_toWriteString
);
1356 /*** META ((export vector? array?)
1358 (peephole (postfix " instanceof sc_Vector")))
1360 function sc_isVector(v
) {
1361 return (v
instanceof sc_Vector
);
1364 // only applies to vectors
1365 function sc_isVectorEqual(v1
, v2
, comp
) {
1366 if (v1
.length
!== v2
.length
) return false;
1367 for (var i
= 0; i
< v1
.length
; i
++)
1368 if (!comp(v1
[i
], v2
[i
])) return false;
1372 /*** META ((export make-vector make-array)) */
1373 function sc_makeVector(size
, fill
) {
1374 var a
= new sc_Vector(size
);
1375 if (fill
!== undefined)
1376 sc_vectorFillBang(a
, fill
);
1380 /*** META ((export vector array)
1381 (peephole (vector)))
1383 function sc_vector() {
1384 var a
= new sc_Vector();
1385 for (var i
= 0; i
< arguments
.length
; i
++)
1386 a
.push(arguments
[i
]);
1390 /*** META ((export vector-length array-length)
1391 (peephole (postfix ".length")))
1393 function sc_vectorLength(v
) {
1397 /*** META ((export vector-ref array-ref)
1398 (peephole (hole 2 v "[" pos "]")))
1400 function sc_vectorRef(v
, pos
) {
1404 /*** META ((export vector-set! array-set!)
1405 (peephole (hole 3 v "[" pos "] = " val)))
1407 function sc_vectorSetBang(v
, pos
, val
) {
1411 /*** META ((export vector->list array->list)) */
1412 function sc_vector2list(a
) {
1414 for (var i
= a
.length
-1; i
>= 0; i
--)
1415 res
= sc_cons(a
[i
], res
);
1419 /*** META ((export list->vector list->array)) */
1420 function sc_list2vector(l
) {
1421 var a
= new sc_Vector();
1429 /*** META ((export vector-fill! array-fill!)) */
1430 function sc_vectorFillBang(a
, fill
) {
1431 for (var i
= 0; i
< a
.length
; i
++)
1436 /*** META ((export #t)) */
1437 function sc_copyVector(a
, len
) {
1438 if (len
<= a
.length
)
1439 return a
.slice(0, len
);
1441 var tmp
= a
.concat();
1447 /*** META ((export #t)
1448 (peephole (hole 3 a ".slice(" start "," end ")")))
1450 function sc_vectorCopy(a
, start
, end
) {
1451 return a
.slice(start
, end
);
1454 /*** META ((export #t)) */
1455 function sc_vectorCopyBang(target
, tstart
, source
, sstart
, send
) {
1456 if (!sstart
) sstart
= 0;
1457 if (!send
) send
= source
.length
;
1459 // if target == source we don't want to overwrite not yet copied elements.
1460 if (tstart
<= sstart
) {
1461 for (var i
= tstart
, j
= sstart
; j
< send
; i
++, j
++) {
1462 target
[i
] = source
[j
];
1465 var diff
= send
- sstart
;
1466 for (var i
= tstart
+ diff
- 1, j
= send
- 1;
1469 target
[i
] = source
[j
];
1475 /*** META ((export #t)
1477 (peephole (hole 1 "typeof " o " === 'function'")))
1479 function sc_isProcedure(o
) {
1480 return (typeof o
=== "function");
1483 /*** META ((export #t)) */
1484 function sc_apply(proc
) {
1485 var args
= new Array();
1486 // first part of arguments are not in list-form.
1487 for (var i
= 1; i
< arguments
.length
- 1; i
++)
1488 args
.push(arguments
[i
]);
1489 var l
= arguments
[arguments
.length
- 1];
1490 while (l
!== null) {
1494 return proc
.apply(null, args
);
1497 /*** META ((export #t)) */
1498 function sc_map(proc
, l1
) {
1499 if (l1
=== undefined)
1502 var nbApplyArgs
= arguments
.length
- 1;
1503 var applyArgs
= new Array(nbApplyArgs
);
1505 while (l1
!== null) {
1506 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1507 applyArgs
[i
] = arguments
[i
+ 1].car
;
1508 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1510 revres
= sc_cons(proc
.apply(null, applyArgs
), revres
);
1512 return sc_reverseAppendBang(revres
, null);
1515 /*** META ((export #t)) */
1516 function sc_mapBang(proc
, l1
) {
1517 if (l1
=== undefined)
1521 var nbApplyArgs
= arguments
.length
- 1;
1522 var applyArgs
= new Array(nbApplyArgs
);
1523 while (l1
!== null) {
1525 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1526 applyArgs
[i
] = arguments
[i
+ 1].car
;
1527 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1529 tmp
.car
= proc
.apply(null, applyArgs
);
1534 /*** META ((export #t)) */
1535 function sc_forEach(proc
, l1
) {
1536 if (l1
=== undefined)
1539 var nbApplyArgs
= arguments
.length
- 1;
1540 var applyArgs
= new Array(nbApplyArgs
);
1541 while (l1
!== null) {
1542 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1543 applyArgs
[i
] = arguments
[i
+ 1].car
;
1544 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1546 proc
.apply(null, applyArgs
);
1548 // add return so FF does not complain.
1552 /*** META ((export #t)) */
1553 function sc_filter(proc
, l1
) {
1554 var dummy
= { cdr : null };
1556 while (l1
!== null) {
1557 if (proc(l1
.car
) !== false) {
1558 tail
.cdr
= sc_cons(l1
.car
, null);
1566 /*** META ((export #t)) */
1567 function sc_filterBang(proc
, l1
) {
1568 var head
= sc_cons("dummy", l1
);
1571 while (next
!== null) {
1572 if (proc(next
.car
) !== false) {
1582 function sc_filterMap1(proc
, l1
) {
1584 while (l1
!== null) {
1585 var tmp
= proc(l1
.car
)
1586 if (tmp
!== false) revres
= sc_cons(tmp
, revres
);
1589 return sc_reverseAppendBang(revres
, null);
1591 function sc_filterMap2(proc
, l1
, l2
) {
1593 while (l1
!== null) {
1594 var tmp
= proc(l1
.car
, l2
.car
);
1595 if(tmp
!== false) revres
= sc_cons(tmp
, revres
);
1599 return sc_reverseAppendBang(revres
, null);
1602 /*** META ((export #t)) */
1603 function sc_filterMap(proc
, l1
, l2
, l3
) {
1604 if (l2
=== undefined)
1605 return sc_filterMap1(proc
, l1
);
1606 else if (l3
=== undefined)
1607 return sc_filterMap2(proc
, l1
, l2
);
1609 var nbApplyArgs
= arguments
.length
- 1;
1610 var applyArgs
= new Array(nbApplyArgs
);
1612 while (l1
!== null) {
1613 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1614 applyArgs
[i
] = arguments
[i
+ 1].car
;
1615 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1617 var tmp
= proc
.apply(null, applyArgs
);
1618 if(tmp
!== false) revres
= sc_cons(tmp
, revres
);
1620 return sc_reverseAppendBang(revres
, null);
1623 /*** META ((export #t)) */
1624 function sc_any(proc
, l
) {
1626 while (l
!== null) {
1627 var tmp
= proc(l
.car
);
1628 if(tmp
!== false) return tmp
;
1634 /*** META ((export any?)
1635 (peephole (hole 2 "sc_any(" proc "," l ") !== false")))
1637 function sc_anyPred(proc
, l
) {
1638 return sc_any(proc
, l
)!== false;
1641 /*** META ((export #t)) */
1642 function sc_every(proc
, l
) {
1645 while (l
!== null) {
1647 if (tmp
=== false) return false;
1653 /*** META ((export every?)
1654 (peephole (hole 2 "sc_every(" proc "," l ") !== false")))
1656 function sc_everyPred(proc
, l
) {
1657 var tmp
= sc_every(proc
, l
);
1658 if (tmp
!== false) return true;
1662 /*** META ((export #t)
1663 (peephole (postfix "()")))
1665 function sc_force(o
) {
1669 /*** META ((export #t)) */
1670 function sc_makePromise(proc
) {
1671 var isResultReady
= false;
1672 var result
= undefined;
1674 if (!isResultReady
) {
1676 if (!isResultReady
) {
1677 isResultReady
= true;
1685 function sc_Values(values
) {
1686 this.values
= values
;
1689 /*** META ((export #t)
1690 (peephole (values)))
1692 function sc_values() {
1693 if (arguments
.length
=== 1)
1694 return arguments
[0];
1696 return new sc_Values(arguments
);
1699 /*** META ((export #t)) */
1700 function sc_callWithValues(producer
, consumer
) {
1701 var produced
= producer();
1702 if (produced
instanceof sc_Values
)
1703 return consumer
.apply(null, produced
.values
);
1705 return consumer(produced
);
1708 /*** META ((export #t)) */
1709 function sc_dynamicWind(before
, thunk
, after
) {
1720 // TODO: eval/scheme-report-environment/null-environment/interaction-environment
1722 // LIMITATION: 'load' doesn't exist without files.
1723 // LIMITATION: transcript-on/transcript-off doesn't exist without files.
1726 function sc_Struct(name
) {
1729 sc_Struct
.prototype.sc_toDisplayString = function() {
1730 return "#<struct" + sc_hash(this) + ">";
1732 sc_Struct
.prototype.sc_toWriteString
= sc_Struct
.prototype.sc_toDisplayString
;
1734 /*** META ((export #t)
1735 (peephole (hole 1 "new sc_Struct(" name ")")))
1737 function sc_makeStruct(name
) {
1738 return new sc_Struct(name
);
1741 /*** META ((export #t)
1743 (peephole (postfix " instanceof sc_Struct")))
1745 function sc_isStruct(o
) {
1746 return (o
instanceof sc_Struct
);
1749 /*** META ((export #t)
1751 (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")")))
1753 function sc_isStructNamed(name
, s
) {
1754 return ((s
instanceof sc_Struct
) && (s
.name
=== name
));
1757 /*** META ((export struct-field)
1758 (peephole (hole 3 0 "[" 2 "]")))
1760 function sc_getStructField(s
, name
, field
) {
1764 /*** META ((export struct-field-set!)
1765 (peephole (hole 4 0 "[" 2 "] = " 3)))
1767 function sc_setStructFieldBang(s
, name
, field
, val
) {
1771 /*** META ((export #t)
1772 (peephole (prefix "~")))
1774 function sc_bitNot(x
) {
1778 /*** META ((export #t)
1779 (peephole (infix 2 2 "&")))
1781 function sc_bitAnd(x
, y
) {
1785 /*** META ((export #t)
1786 (peephole (infix 2 2 "|")))
1788 function sc_bitOr(x
, y
) {
1792 /*** META ((export #t)
1793 (peephole (infix 2 2 "^")))
1795 function sc_bitXor(x
, y
) {
1799 /*** META ((export #t)
1800 (peephole (infix 2 2 "<<")))
1802 function sc_bitLsh(x
, y
) {
1806 /*** META ((export #t)
1807 (peephole (infix 2 2 ">>")))
1809 function sc_bitRsh(x
, y
) {
1813 /*** META ((export #t)
1814 (peephole (infix 2 2 ">>>")))
1816 function sc_bitUrsh(x
, y
) {
1820 /*** META ((export js-field js-property)
1821 (peephole (hole 2 o "[" field "]")))
1823 function sc_jsField(o
, field
) {
1827 /*** META ((export js-field-set! js-property-set!)
1828 (peephole (hole 3 o "[" field "] = " val)))
1830 function sc_setJsFieldBang(o
, field
, val
) {
1831 return o
[field
] = val
;
1834 /*** META ((export js-field-delete! js-property-delete!)
1835 (peephole (hole 2 "delete" o "[" field "]")))
1837 function sc_deleteJsFieldBang(o
, field
) {
1841 /*** META ((export #t)
1842 (peephole (jsCall)))
1844 function sc_jsCall(o
, fun
) {
1845 var args
= new Array();
1846 for (var i
= 2; i
< arguments
.length
; i
++)
1847 args
[i
-2] = arguments
[i
];
1848 return fun
.apply(o
, args
);
1851 /*** META ((export #t)
1852 (peephole (jsMethodCall)))
1854 function sc_jsMethodCall(o
, field
) {
1855 var args
= new Array();
1856 for (var i
= 2; i
< arguments
.length
; i
++)
1857 args
[i
-2] = arguments
[i
];
1858 return o
[field
].apply(o
, args
);
1861 /*** META ((export new js-new)
1864 function sc_jsNew(c
) {
1865 var evalStr
= "new c(";
1866 evalStr
+=arguments
.length
> 1? "arguments[1]": "";
1867 for (var i
= 2; i
< arguments
.length
; i
++)
1868 evalStr
+= ", arguments[" + i
+ "]";
1870 return eval(evalStr
);
1873 // ======================== RegExp ====================
1874 /*** META ((export #t)) */
1875 function sc_pregexp(re
) {
1876 return new RegExp(sc_string2jsstring(re
));
1879 /*** META ((export #t)) */
1880 function sc_pregexpMatch(re
, s
) {
1881 var reg
= (re
instanceof RegExp
) ? re : sc_pregexp(re
);
1882 var tmp
= reg
.exec(sc_string2jsstring(s
));
1884 if (tmp
== null) return false;
1887 for (var i
= tmp
.length
-1; i
>= 0; i
--) {
1888 if (tmp
[i
] !== null) {
1889 res
= sc_cons(sc_jsstring2string(tmp
[i
]), res
);
1891 res
= sc_cons(false, res
);
1897 /*** META ((export #t)) */
1898 function sc_pregexpReplace(re
, s1
, s2
) {
1900 var jss1
= sc_string2jsstring(s1
);
1901 var jss2
= sc_string2jsstring(s2
);
1903 if (re
instanceof RegExp
) {
1907 reg
= new RegExp(re
.source
);
1909 reg
= new RegExp(sc_string2jsstring(re
));
1912 return jss1
.replace(reg
, jss2
);
1915 /*** META ((export pregexp-replace*)) */
1916 function sc_pregexpReplaceAll(re
, s1
, s2
) {
1918 var jss1
= sc_string2jsstring(s1
);
1919 var jss2
= sc_string2jsstring(s2
);
1921 if (re
instanceof RegExp
) {
1925 reg
= new RegExp(re
.source
, "g");
1927 reg
= new RegExp(sc_string2jsstring(re
), "g");
1930 return jss1
.replace(reg
, jss2
);
1933 /*** META ((export #t)) */
1934 function sc_pregexpSplit(re
, s
) {
1935 var reg
= ((re
instanceof RegExp
) ?
1937 new RegExp(sc_string2jsstring(re
)));
1938 var jss
= sc_string2jsstring(s
);
1939 var tmp
= jss
.split(reg
);
1941 if (tmp
== null) return false;
1943 return sc_vector2list(tmp
);
1947 /* =========================================================================== */
1948 /* Other library stuff */
1949 /* =========================================================================== */
1951 /*** META ((export #t)
1952 (peephole (hole 1 "Math.floor(Math.random()*" 'n ")")))
1954 function sc_random(n
) {
1955 return Math
.floor(Math
.random()*n
);
1958 /*** META ((export current-date)
1959 (peephole (hole 0 "new Date()")))
1961 function sc_currentDate() {
1965 function sc_Hashtable() {
1967 sc_Hashtable
.prototype.toString = function() {
1968 return "#{%hashtable}";
1970 // sc_toWriteString == sc_toDisplayString == toString
1972 function sc_HashtableElement(key
, val
) {
1977 /*** META ((export #t)
1978 (peephole (hole 0 "new sc_Hashtable()")))
1980 function sc_makeHashtable() {
1981 return new sc_Hashtable();
1984 /*** META ((export #t)) */
1985 function sc_hashtablePutBang(ht
, key
, val
) {
1986 var hash
= sc_hash(key
);
1987 ht
[hash
] = new sc_HashtableElement(key
, val
);
1990 /*** META ((export #t)) */
1991 function sc_hashtableGet(ht
, key
) {
1992 var hash
= sc_hash(key
);
1994 return ht
[hash
].val
;
1999 /*** META ((export #t)) */
2000 function sc_hashtableForEach(ht
, f
) {
2002 if (ht
[v
] instanceof sc_HashtableElement
)
2003 f(ht
[v
].key
, ht
[v
].val
);
2007 /*** META ((export hashtable-contains?)
2008 (peephole (hole 2 "sc_hash(" 1 ") in " 0)))
2010 function sc_hashtableContains(ht
, key
) {
2011 var hash
= sc_hash(key
);
2018 var SC_HASH_COUNTER
= 0;
2020 function sc_hash(o
) {
2023 else if (o
=== undefined)
2025 else if (o
=== true)
2027 else if (o
=== false)
2029 else if (typeof o
=== "number")
2031 else if (typeof o
=== "string")
2032 return "jsstr-" + o
;
2033 else if (o
.sc_getHash
)
2034 return o
.sc_getHash();
2036 return sc_counterHash
.call(o
);
2038 function sc_counterHash() {
2039 if (!this.sc_hash
) {
2040 this.sc_hash
= "hash-" + SC_HASH_COUNTER
;
2043 return this.sc_hash
;
2046 function sc_Trampoline(args
, maxTailCalls
) {
2047 this['__trampoline return__'] = true;
2049 this.MAX_TAIL_CALLs
= maxTailCalls
;
2051 // TODO: call/cc stuff
2052 sc_Trampoline
.prototype.restart = function() {
2055 // set both globals.
2056 SC_TAIL_OBJECT
.calls
= o
.MAX_TAIL_CALLs
-1;
2057 var fun
= o
.args
.callee
;
2058 var res
= fun
.apply(SC_TAIL_OBJECT
, o
.args
);
2059 if (res
instanceof sc_Trampoline
)
2066 /*** META ((export bind-exit-lambda)) */
2067 function sc_bindExitLambda(proc
) {
2068 var escape_obj
= new sc_BindExitException();
2069 var escape = function(res
) {
2070 escape_obj
.res
= res
;
2074 return proc(escape
);
2076 if (e
=== escape_obj
) {
2082 function sc_BindExitException() {
2083 this._internalException
= true;
2086 var SC_SCM2JS_GLOBALS
= new Object();
2088 // default tail-call depth.
2089 // normally the program should set it again. but just in case...
2090 var SC_TAIL_OBJECT
= new Object();
2091 SC_SCM2JS_GLOBALS
.TAIL_OBJECT
= SC_TAIL_OBJECT
;
2092 // ======================== I/O =======================
2094 /*------------------------------------------------------------------*/
2098 var SC_EOF_OBJECT
= new sc_EOF();
2100 function sc_Port() {
2103 /* --------------- Input ports -------------------------------------*/
2105 function sc_InputPort() {
2107 sc_InputPort
.prototype = new sc_Port();
2109 sc_InputPort
.prototype.peekChar = function() {
2110 if (!("peeked" in this))
2111 this.peeked
= this.getNextChar();
2114 sc_InputPort
.prototype.readChar = function() {
2115 var tmp
= this.peekChar();
2119 sc_InputPort
.prototype.isCharReady = function() {
2122 sc_InputPort
.prototype.close = function() {
2126 /* .............. String port ..........................*/
2127 function sc_ErrorInputPort() {
2129 sc_ErrorInputPort
.prototype = new sc_InputPort();
2130 sc_ErrorInputPort
.prototype.getNextChar = function() {
2131 throw "can't read from error-port.";
2133 sc_ErrorInputPort
.prototype.isCharReady = function() {
2138 /* .............. String port ..........................*/
2140 function sc_StringInputPort(jsStr
) {
2141 // we are going to do some charAts on the str.
2142 // instead of recreating all the time a String-object, we
2143 // create one in the beginning. (not sure, if this is really an optim)
2144 this.str
= new String(jsStr
);
2147 sc_StringInputPort
.prototype = new sc_InputPort();
2148 sc_StringInputPort
.prototype.getNextChar = function() {
2149 if (this.pos
>= this.str
.length
)
2150 return SC_EOF_OBJECT
;
2151 return this.str
.charAt(this.pos
++);
2154 /* ------------- Read and other lib-funs -------------------------------*/
2155 function sc_Token(type
, val
, pos
) {
2160 sc_Token
.EOF
= 0/*EOF*/;
2161 sc_Token
.OPEN_PAR
= 1/*OPEN_PAR*/;
2162 sc_Token
.CLOSE_PAR
= 2/*CLOSE_PAR*/;
2163 sc_Token
.OPEN_BRACE
= 3/*OPEN_BRACE*/;
2164 sc_Token
.CLOSE_BRACE
= 4/*CLOSE_BRACE*/;
2165 sc_Token
.OPEN_BRACKET
= 5/*OPEN_BRACKET*/;
2166 sc_Token
.CLOSE_BRACKET
= 6/*CLOSE_BRACKET*/;
2167 sc_Token
.WHITESPACE
= 7/*WHITESPACE*/;
2168 sc_Token
.QUOTE
= 8/*QUOTE*/;
2169 sc_Token
.ID
= 9/*ID*/;
2170 sc_Token
.DOT
= 10/*DOT*/;
2171 sc_Token
.STRING
= 11/*STRING*/;
2172 sc_Token
.NUMBER
= 12/*NUMBER*/;
2173 sc_Token
.ERROR
= 13/*ERROR*/;
2174 sc_Token
.VECTOR_BEGIN
= 14/*VECTOR_BEGIN*/;
2175 sc_Token
.TRUE
= 15/*TRUE*/;
2176 sc_Token
.FALSE
= 16/*FALSE*/;
2177 sc_Token
.UNSPECIFIED
= 17/*UNSPECIFIED*/;
2178 sc_Token
.REFERENCE
= 18/*REFERENCE*/;
2179 sc_Token
.STORE
= 19/*STORE*/;
2180 sc_Token
.CHAR
= 20/*CHAR*/;
2182 var SC_ID_CLASS
= SC_LOWER_CLASS
+ SC_UPPER_CLASS
+ "!$%*+-./:<=>?@^_~";
2183 function sc_Tokenizer(port
) {
2186 sc_Tokenizer
.prototype.peekToken = function() {
2189 var newToken
= this.nextToken();
2190 this.peeked
= newToken
;
2193 sc_Tokenizer
.prototype.readToken = function() {
2194 var tmp
= this.peekToken();
2198 sc_Tokenizer
.prototype.nextToken = function() {
2199 var port
= this.port
;
2201 function isNumberChar(c
) {
2202 return (c
>= "0" && c
<= "9");
2204 function isIdOrNumberChar(c
) {
2205 return SC_ID_CLASS
.indexOf(c
) != -1 || // ID-char
2206 (c
>= "0" && c
<= "9");
2208 function isWhitespace(c
) {
2209 return c
=== " " || c
=== "\r" || c
=== "\n" || c
=== "\t" || c
=== "\f";
2211 function isWhitespaceOrEOF(c
) {
2212 return isWhitespace(c
) || c
=== SC_EOF_OBJECT
;
2215 function readString() {
2218 var c
= port
.readChar();
2221 return new sc_Token(11/*STRING*/, res
);
2223 var tmp
= port
.readChar();
2225 case '0': res
+= "\0"; break;
2226 case 'a': res
+= "\a"; break;
2227 case 'b': res
+= "\b"; break;
2228 case 'f': res
+= "\f"; break;
2229 case 'n': res
+= "\n"; break;
2230 case 'r': res
+= "\r"; break;
2231 case 't': res
+= "\t"; break;
2232 case 'v': res
+= "\v"; break;
2233 case '"': res
+= '"'; break;
2234 case '\\': res
+= '\\'; break;
2239 var hexC
= port
.peekChar();
2240 if (hexC
>= '0' && hexC
<= '9') {
2242 nb
= nb
* 16 + hexC
.charCodeAt(0) - '0'.charCodeAt(0);
2243 } else if (hexC
>= 'a' && hexC
<= 'f') {
2245 nb
= nb
* 16 + hexC
.charCodeAt(0) - 'a'.charCodeAt(0);
2246 } else if (hexC
>= 'A' && hexC
<= 'F') {
2248 nb
= nb
* 16 + hexC
.charCodeAt(0) - 'A'.charCodeAt(0);
2250 // next char isn't part of hex.
2251 res
+= String
.fromCharCode(nb
);
2257 if (tmp
=== SC_EOF_OBJECT
) {
2258 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res
);
2264 if (c
=== SC_EOF_OBJECT
) {
2265 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res
);
2271 function readIdOrNumber(firstChar
) {
2272 var res
= firstChar
;
2273 while (isIdOrNumberChar(port
.peekChar()))
2274 res
+= port
.readChar();
2276 return new sc_Token(9/*ID*/, res
);
2278 return new sc_Token(12/*NUMBER*/, res
- 0);
2281 function skipWhitespaceAndComments() {
2285 while (isWhitespace(port
.peekChar()))
2287 if (port
.peekChar() === ';') {
2291 curChar
= port
.readChar();
2292 if (curChar
=== SC_EOF_OBJECT
||
2300 function readDot() {
2301 if (isWhitespace(port
.peekChar()))
2302 return new sc_Token(10/*DOT*/);
2304 return readIdOrNumber(".");
2307 function readSharp() {
2308 var c
= port
.readChar();
2309 if (isWhitespace(c
))
2310 return new sc_Token(13/*ERROR*/, "bad #-pattern0.");
2313 if (isNumberChar(c
)) {
2315 while (isNumberChar(port
.peekChar()))
2316 nb
= nb
*10 + (port
.readChar() - 0);
2317 switch (port
.readChar()) {
2319 return new sc_Token(18/*REFERENCE*/, nb
);
2321 return new sc_Token(19/*STORE*/, nb
);
2323 return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb
);
2328 return new sc_Token(14/*VECTOR_BEGIN*/);
2330 if (c
=== "\\") { // character
2332 while (!isWhitespaceOrEOF(port
.peekChar()))
2333 tmp
+= port
.readChar();
2334 switch (tmp
.length
) {
2335 case 0: // it's escaping a whitespace char:
2336 if (sc_isEOFObject(port
.peekChar
))
2337 return new sc_Token(13/*ERROR*/, "bad #-pattern2.");
2339 return new sc_Token(20/*CHAR*/, port
.readChar());
2341 return new sc_Token(20/*CHAR*/, tmp
);
2343 var entry
= sc_Char
.readable2char
[tmp
.toLowerCase()];
2345 return new sc_Token(20/*CHAR*/, entry
);
2347 return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp
);
2351 // some constants (#t, #f, #unspecified)
2355 case 't': res
= new sc_Token(15/*TRUE*/, true); needing
= ""; break;
2356 case 'f': res
= new sc_Token(16/*FALSE*/, false); needing
= ""; break;
2357 case 'u': res
= new sc_Token(17/*UNSPECIFIED*/, undefined); needing
= "nspecified"; break;
2359 return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c
);
2362 c
= port
.peekChar();
2363 if ((isWhitespaceOrEOF(c
) || c
=== ')') &&
2366 else if (isWhitespace(c
) || needing
== "")
2367 return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c
+ " " + needing
);
2368 else if (needing
.charAt(0) == c
) {
2369 port
.readChar(); // consume
2370 needing
= needing
.slice(1);
2372 return new sc_Token(13/*ERROR*/, "bad #-pattern5");
2377 skipWhitespaceAndComments();
2378 var curChar
= port
.readChar();
2379 if (curChar
=== SC_EOF_OBJECT
)
2380 return new sc_Token(0/*EOF*/, curChar
);
2386 return readWhitespace();
2388 return new sc_Token(1/*OPEN_PAR*/);
2390 return new sc_Token(2/*CLOSE_PAR*/);
2392 return new sc_Token(3/*OPEN_BRACE*/);
2394 return new sc_Token(4/*CLOSE_BRACE*/);
2396 return new sc_Token(5/*OPEN_BRACKET*/);
2398 return new sc_Token(6/*CLOSE_BRACKET*/);
2400 return new sc_Token(8/*QUOTE*/);
2406 return readString();
2408 if (isIdOrNumberChar(curChar
))
2409 return readIdOrNumber(curChar
);
2410 throw "unexpected character: " + curChar
;
2414 function sc_Reader(tokenizer
) {
2415 this.tokenizer
= tokenizer
;
2416 this.backref
= new Array();
2418 sc_Reader
.prototype.read = function() {
2419 function readList(listBeginType
) {
2420 function matchesPeer(open
, close
) {
2421 return open
=== 1/*OPEN_PAR*/ && close
=== 2/*CLOSE_PAR*/
2422 || open
=== 3/*OPEN_BRACE*/ && close
=== 4/*CLOSE_BRACE*/
2423 || open
=== 5/*OPEN_BRACKET*/ && close
=== 6/*CLOSE_BRACKET*/;
2428 var token
= tokenizer
.peekToken();
2430 switch (token
.type
) {
2431 case 2/*CLOSE_PAR*/:
2432 case 4/*CLOSE_BRACE*/:
2433 case 6/*CLOSE_BRACKET*/:
2434 if (matchesPeer(listBeginType
, token
.type
)) {
2435 tokenizer
.readToken(); // consume token
2436 return sc_reverseBang(res
);
2438 throw "closing par doesn't match: " + listBeginType
2439 + " " + listEndType
;
2442 throw "unexpected end of file";
2445 tokenizer
.readToken(); // consume token
2446 var cdr
= this.read();
2447 var par
= tokenizer
.readToken();
2448 if (!matchesPeer(listBeginType
, par
.type
))
2449 throw "closing par doesn't match: " + listBeginType
2452 return sc_reverseAppendBang(res
, cdr
);
2456 res
= sc_cons(this.read(), res
);
2460 function readQuote() {
2461 return sc_cons("quote", sc_cons(this.read(), null));
2463 function readVector() {
2464 // opening-parenthesis is already consumed
2465 var a
= new Array();
2467 var token
= tokenizer
.peekToken();
2468 switch (token
.type
) {
2469 case 2/*CLOSE_PAR*/:
2470 tokenizer
.readToken();
2474 a
.push(this.read());
2479 function storeRefence(nb
) {
2480 var tmp
= this.read();
2481 this.backref
[nb
] = tmp
;
2485 function readReference(nb
) {
2486 if (nb
in this.backref
)
2487 return this.backref
[nb
];
2489 throw "bad reference: " + nb
;
2492 var tokenizer
= this.tokenizer
;
2494 var token
= tokenizer
.readToken();
2497 if (token
.type
=== 13/*ERROR*/)
2500 switch (token
.type
) {
2502 case 3/*OPEN_BRACE*/:
2503 case 5/*OPEN_BRACKET*/:
2504 return readList
.call(this, token
.type
);
2506 return readQuote
.call(this);
2508 return sc_jsstring2string(token
.val
);
2510 return new sc_Char(token
.val
);
2511 case 14/*VECTOR_BEGIN*/:
2512 return readVector
.call(this);
2513 case 18/*REFERENCE*/:
2514 return readReference
.call(this, token
.val
);
2516 return storeRefence
.call(this, token
.val
);
2518 return sc_jsstring2symbol(token
.val
);
2523 case 17/*UNSPECIFIED*/:
2526 throw "unexpected token " + token
.type
+ " " + token
.val
;
2530 /*** META ((export #t)) */
2531 function sc_read(port
) {
2532 if (port
=== undefined) // we assume the port hasn't been given.
2533 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2534 var reader
= new sc_Reader(new sc_Tokenizer(port
));
2535 return reader
.read();
2537 /*** META ((export #t)) */
2538 function sc_readChar(port
) {
2539 if (port
=== undefined) // we assume the port hasn't been given.
2540 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2541 var t
= port
.readChar();
2542 return t
=== SC_EOF_OBJECT
? t: new sc_Char(t
);
2544 /*** META ((export #t)) */
2545 function sc_peekChar(port
) {
2546 if (port
=== undefined) // we assume the port hasn't been given.
2547 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2548 var t
= port
.peekChar();
2549 return t
=== SC_EOF_OBJECT
? t: new sc_Char(t
);
2551 /*** META ((export #t)
2554 function sc_isCharReady(port
) {
2555 if (port
=== undefined) // we assume the port hasn't been given.
2556 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2557 return port
.isCharReady();
2559 /*** META ((export #t)
2560 (peephole (postfix ".close()")))
2562 function sc_closeInputPort(p
) {
2566 /*** META ((export #t)
2568 (peephole (postfix " instanceof sc_InputPort")))
2570 function sc_isInputPort(o
) {
2571 return (o
instanceof sc_InputPort
);
2574 /*** META ((export eof-object?)
2576 (peephole (postfix " === SC_EOF_OBJECT")))
2578 function sc_isEOFObject(o
) {
2579 return o
=== SC_EOF_OBJECT
;
2582 /*** META ((export #t)
2583 (peephole (hole 0 "SC_DEFAULT_IN")))
2585 function sc_currentInputPort() {
2586 return SC_DEFAULT_IN
;
2589 /* ------------ file operations are not supported -----------*/
2590 /*** META ((export #t)) */
2591 function sc_callWithInputFile(s
, proc
) {
2592 throw "can't open " + s
;
2595 /*** META ((export #t)) */
2596 function sc_callWithOutputFile(s
, proc
) {
2597 throw "can't open " + s
;
2600 /*** META ((export #t)) */
2601 function sc_withInputFromFile(s
, thunk
) {
2602 throw "can't open " + s
;
2605 /*** META ((export #t)) */
2606 function sc_withOutputToFile(s
, thunk
) {
2607 throw "can't open " + s
;
2610 /*** META ((export #t)) */
2611 function sc_openInputFile(s
) {
2612 throw "can't open " + s
;
2615 /*** META ((export #t)) */
2616 function sc_openOutputFile(s
) {
2617 throw "can't open " + s
;
2620 /* ----------------------------------------------------------------------------*/
2621 /*** META ((export #t)) */
2622 function sc_basename(p
) {
2623 var i
= p
.lastIndexOf('/');
2626 return p
.substring(i
+ 1, p
.length
);
2631 /*** META ((export #t)) */
2632 function sc_dirname(p
) {
2633 var i
= p
.lastIndexOf('/');
2636 return p
.substring(0, i
);
2641 /* ----------------------------------------------------------------------------*/
2643 /*** META ((export #t)) */
2644 function sc_withInputFromPort(p
, thunk
) {
2646 var tmp
= SC_DEFAULT_IN
; // THREAD: shared var.
2650 SC_DEFAULT_IN
= tmp
;
2654 /*** META ((export #t)) */
2655 function sc_withInputFromString(s
, thunk
) {
2656 return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s
)), thunk
);
2659 /*** META ((export #t)) */
2660 function sc_withOutputToPort(p
, thunk
) {
2662 var tmp
= SC_DEFAULT_OUT
; // THREAD: shared var.
2666 SC_DEFAULT_OUT
= tmp
;
2670 /*** META ((export #t)) */
2671 function sc_withOutputToString(thunk
) {
2672 var p
= new sc_StringOutputPort();
2673 sc_withOutputToPort(p
, thunk
);
2677 /*** META ((export #t)) */
2678 function sc_withOutputToProcedure(proc
, thunk
) {
2679 var t = function(s
) { proc(sc_jsstring2string(s
)); };
2680 return sc_withOutputToPort(new sc_GenericOutputPort(t
), thunk
);
2683 /*** META ((export #t)
2684 (peephole (hole 0 "new sc_StringOutputPort()")))
2686 function sc_openOutputString() {
2687 return new sc_StringOutputPort();
2690 /*** META ((export #t)) */
2691 function sc_openInputString(str
) {
2692 return new sc_StringInputPort(sc_string2jsstring(str
));
2695 /* ----------------------------------------------------------------------------*/
2697 function sc_OutputPort() {
2699 sc_OutputPort
.prototype = new sc_Port();
2700 sc_OutputPort
.prototype.appendJSString = function(obj
) {
2703 sc_OutputPort
.prototype.close = function() {
2707 function sc_StringOutputPort() {
2710 sc_StringOutputPort
.prototype = new sc_OutputPort();
2711 sc_StringOutputPort
.prototype.appendJSString = function(s
) {
2714 sc_StringOutputPort
.prototype.close = function() {
2715 return sc_jsstring2string(this.res
);
2718 /*** META ((export #t)) */
2719 function sc_getOutputString(sp
) {
2720 return sc_jsstring2string(sp
.res
);
2724 function sc_ErrorOutputPort() {
2726 sc_ErrorOutputPort
.prototype = new sc_OutputPort();
2727 sc_ErrorOutputPort
.prototype.appendJSString = function(s
) {
2728 throw "don't write on ErrorPort!";
2730 sc_ErrorOutputPort
.prototype.close = function() {
2734 function sc_GenericOutputPort(appendJSString
, close
) {
2735 this.appendJSString
= appendJSString
;
2739 sc_GenericOutputPort
.prototype = new sc_OutputPort();
2741 /*** META ((export #t)
2743 (peephole (postfix " instanceof sc_OutputPort")))
2745 function sc_isOutputPort(o
) {
2746 return (o
instanceof sc_OutputPort
);
2749 /*** META ((export #t)
2750 (peephole (postfix ".close()")))
2752 function sc_closeOutputPort(p
) {
2756 /* ------------------ write ---------------------------------------------------*/
2758 /*** META ((export #t)) */
2759 function sc_write(o
, p
) {
2760 if (p
=== undefined) // we assume not given
2762 p
.appendJSString(sc_toWriteString(o
));
2765 function sc_toWriteString(o
) {
2768 else if (o
=== true)
2770 else if (o
=== false)
2772 else if (o
=== undefined)
2773 return "#unspecified";
2774 else if (typeof o
=== 'function')
2775 return "#<procedure " + sc_hash(o
) + ">";
2776 else if (o
.sc_toWriteString
)
2777 return o
.sc_toWriteString();
2779 return o
.toString();
2782 function sc_escapeWriteString(s
) {
2785 for (i
= 0; i
< s
.length
; i
++) {
2786 switch (s
.charAt(i
)) {
2787 case "\0": res
+= s
.substring(j
, i
) + "\\0"; j
= i
+ 1; break;
2788 case "\b": res
+= s
.substring(j
, i
) + "\\b"; j
= i
+ 1; break;
2789 case "\f": res
+= s
.substring(j
, i
) + "\\f"; j
= i
+ 1; break;
2790 case "\n": res
+= s
.substring(j
, i
) + "\\n"; j
= i
+ 1; break;
2791 case "\r": res
+= s
.substring(j
, i
) + "\\r"; j
= i
+ 1; break;
2792 case "\t": res
+= s
.substring(j
, i
) + "\\t"; j
= i
+ 1; break;
2793 case "\v": res
+= s
.substring(j
, i
) + "\\v"; j
= i
+ 1; break;
2794 case '"': res
+= s
.substring(j
, i
) + '\\"'; j
= i
+ 1; break;
2795 case "\\": res
+= s
.substring(j
, i
) + "\\\\"; j
= i
+ 1; break;
2797 var c
= s
.charAt(i
);
2798 if ("\a" !== "a" && c
== "\a") {
2799 res
+= s
.substring(j
, i
) + "\\a"; j
= i
+ 1; continue;
2801 if ("\v" !== "v" && c
== "\v") {
2802 res
+= s
.substring(j
, i
) + "\\v"; j
= i
+ 1; continue;
2804 //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) {
2805 // CARE: Manuel is this OK with HOP?
2806 if (s
.charAt(i
) < ' ') {
2807 /* non printable character and special chars */
2808 res
+= s
.substring(j
, i
) + "\\x" + s
.charCodeAt(i
).toString(16);
2811 // else just let i increase...
2814 res
+= s
.substring(j
, i
);
2818 /* ------------------ display ---------------------------------------------------*/
2820 /*** META ((export #t)) */
2821 function sc_display(o
, p
) {
2822 if (p
=== undefined) // we assume not given
2824 p
.appendJSString(sc_toDisplayString(o
));
2827 function sc_toDisplayString(o
) {
2830 else if (o
=== true)
2832 else if (o
=== false)
2834 else if (o
=== undefined)
2835 return "#unspecified";
2836 else if (typeof o
=== 'function')
2837 return "#<procedure " + sc_hash(o
) + ">";
2838 else if (o
.sc_toDisplayString
)
2839 return o
.sc_toDisplayString();
2841 return o
.toString();
2844 /* ------------------ newline ---------------------------------------------------*/
2846 /*** META ((export #t)) */
2847 function sc_newline(p
) {
2848 if (p
=== undefined) // we assume not given
2850 p
.appendJSString("\n");
2853 /* ------------------ write-char ---------------------------------------------------*/
2855 /*** META ((export #t)) */
2856 function sc_writeChar(c
, p
) {
2857 if (p
=== undefined) // we assume not given
2859 p
.appendJSString(c
.val
);
2862 /* ------------------ write-circle ---------------------------------------------------*/
2864 /*** META ((export #t)) */
2865 function sc_writeCircle(o
, p
) {
2866 if (p
=== undefined) // we assume not given
2868 p
.appendJSString(sc_toWriteCircleString(o
));
2871 function sc_toWriteCircleString(o
) {
2872 var symb
= sc_gensym("writeCircle");
2873 var nbPointer
= new Object();
2875 sc_prepWriteCircle(o
, symb
, nbPointer
);
2876 return sc_genToWriteCircleString(o
, symb
);
2879 function sc_prepWriteCircle(o
, symb
, nbPointer
) {
2881 if (o
instanceof sc_Pair
||
2882 o
instanceof sc_Vector
) {
2883 if (o
[symb
] !== undefined) {
2884 // not the first visit.
2886 // unless there is already a number, assign one.
2887 if (!o
[symb
+ "nb"]) o
[symb
+ "nb"] = nbPointer
.nb
++;
2891 if (o
instanceof sc_Pair
) {
2892 sc_prepWriteCircle(o
.car
, symb
, nbPointer
);
2893 sc_prepWriteCircle(o
.cdr
, symb
, nbPointer
);
2895 for (var i
= 0; i
< o
.length
; i
++)
2896 sc_prepWriteCircle(o
[i
], symb
, nbPointer
);
2901 function sc_genToWriteCircleString(o
, symb
) {
2902 if (!(o
instanceof sc_Pair
||
2903 o
instanceof sc_Vector
))
2904 return sc_toWriteString(o
);
2905 return o
.sc_toWriteCircleString(symb
);
2907 sc_Pair
.prototype.sc_toWriteCircleString = function(symb
, inList
) {
2908 if (this[symb
+ "use"]) { // use-flag is set. Just use it.
2909 var nb
= this[symb
+ "nb"];
2910 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2912 delete this[symb
+ "nb"];
2913 delete this[symb
+ "use"];
2916 return '. #' + nb
+ '#';
2918 return '#' + nb
+ '#';
2920 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2922 delete this[symb
+ "nb"];
2923 delete this[symb
+ "use"];
2928 if (this[symb
] !== undefined) { // implies > 0
2929 this[symb
+ "use"] = true;
2931 res
+= '. #' + this[symb
+ "nb"] + '=';
2933 res
+= '#' + this[symb
+ "nb"] + '=';
2941 res
+= sc_genToWriteCircleString(this.car
, symb
);
2943 if (sc_isPair(this.cdr
)) {
2944 res
+= " " + this.cdr
.sc_toWriteCircleString(symb
, true);
2945 } else if (this.cdr
!== null) {
2946 res
+= " . " + sc_genToWriteCircleString(this.cdr
, symb
);
2952 sc_Vector
.prototype.sc_toWriteCircleString = function(symb
) {
2953 if (this[symb
+ "use"]) { // use-flag is set. Just use it.
2954 var nb
= this[symb
+ "nb"];
2955 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2957 delete this[symb
+ "nb"];
2958 delete this[symb
+ "use"];
2960 return '#' + nb
+ '#';
2962 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2964 delete this[symb
+ "nb"];
2965 delete this[symb
+ "use"];
2969 if (this[symb
] !== undefined) { // implies > 0
2970 this[symb
+ "use"] = true;
2971 res
+= '#' + this[symb
+ "nb"] + '=';
2974 for (var i
= 0; i
< this.length
; i
++) {
2975 res
+= sc_genToWriteCircleString(this[i
], symb
);
2976 if (i
< this.length
- 1) res
+= " ";
2983 /* ------------------ print ---------------------------------------------------*/
2985 /*** META ((export #t)) */
2986 function sc_print(s
) {
2987 if (arguments
.length
=== 1) {
2992 for (var i
= 0; i
< arguments
.length
; i
++)
2993 sc_display(arguments
[i
]);
2998 /* ------------------ format ---------------------------------------------------*/
2999 /*** META ((export #t)) */
3000 function sc_format(s
, args
) {
3002 var p
= new sc_StringOutputPort();
3006 var i2
= s
.indexOf("~", i
);
3009 p
.appendJSString( s
.substring( i
, len
) );
3013 if (i2
== (len
- 1)) {
3014 p
.appendJSString(s
.substring(i
, len
));
3017 p
.appendJSString(s
.substring(i
, i2
));
3022 switch(s
.charCodeAt(i2
+ 1)) {
3026 sc_display(arguments
[j
], p
);
3033 sc_write(arguments
[j
], p
);
3040 sc_display(arguments
[j
], p
);
3041 p
.appendJSString("\n");
3048 p
.appendJSString(String
.fromCharCode(arguments
[j
]));
3055 p
.appendJSString(arguments
[j
].toString(6));
3062 p
.appendJSString(arguments
[j
].toString(8));
3069 p
.appendJSString(arguments
[j
].toString(2));
3076 p
.appendJSString("\n");
3081 p
.appendJSString("\r");
3086 p
.appendJSString("~");
3090 sc_error( "format: illegal ~"
3091 + String
.fromCharCode(s
.charCodeAt(i2
+ 1))
3101 /* ------------------ global ports ---------------------------------------------------*/
3103 var SC_DEFAULT_IN
= new sc_ErrorInputPort();
3104 var SC_DEFAULT_OUT
= new sc_ErrorOutputPort();
3105 var SC_ERROR_OUT
= new sc_ErrorOutputPort();
3107 var sc_SYMBOL_PREFIX
= "\u1E9C";
3108 var sc_KEYWORD_PREFIX
= "\u1E9D";
3110 /*** META ((export #t)
3112 function sc_jsstring2string(s
) {
3116 /*** META ((export #t)
3117 (peephole (prefix "'\\u1E9C' +")))
3119 function sc_jsstring2symbol(s
) {
3120 return sc_SYMBOL_PREFIX
+ s
;
3123 /*** META ((export #t)
3126 function sc_string2jsstring(s
) {
3130 /*** META ((export #t)
3131 (peephole (symbol2jsstring_immutable)))
3133 function sc_symbol2jsstring(s
) {
3137 /*** META ((export #t)
3138 (peephole (postfix ".slice(1)")))
3140 function sc_keyword2jsstring(k
) {
3144 /*** META ((export #t)
3145 (peephole (prefix "'\\u1E9D' +")))
3147 function sc_jsstring2keyword(s
) {
3148 return sc_KEYWORD_PREFIX
+ s
;
3151 /*** META ((export #t)
3154 function sc_isKeyword(s
) {
3155 return (typeof s
=== "string") &&
3156 (s
.charAt(0) === sc_KEYWORD_PREFIX
);
3160 /*** META ((export #t)) */
3161 var sc_gensym = function() {
3163 return function(sym
) {
3165 if (!sym
) sym
= sc_SYMBOL_PREFIX
;
3166 return sym
+ "s" + counter
+ "~" + "^sC-GeNsYm ";
3171 /*** META ((export #t)
3174 function sc_isEqual(o1
, o2
) {
3175 return ((o1
=== o2
) ||
3176 (sc_isPair(o1
) && sc_isPair(o2
)
3177 && sc_isPairEqual(o1
, o2
, sc_isEqual
)) ||
3178 (sc_isVector(o1
) && sc_isVector(o2
)
3179 && sc_isVectorEqual(o1
, o2
, sc_isEqual
)));
3182 /*** META ((export number->symbol integer->symbol)) */
3183 function sc_number2symbol(x
, radix
) {
3184 return sc_SYMBOL_PREFIX
+ sc_number2jsstring(x
, radix
);
3187 /*** META ((export number->string integer->string)) */
3188 var sc_number2string
= sc_number2jsstring
;
3190 /*** META ((export #t)) */
3191 function sc_symbol2number(s
, radix
) {
3192 return sc_jsstring2number(s
.slice(1), radix
);
3195 /*** META ((export #t)) */
3196 var sc_string2number
= sc_jsstring2number
;
3198 /*** META ((export #t)
3199 (peephole (prefix "+" s)))
3200 ;; peephole will only apply if no radix is given.
3202 function sc_string2integer(s
, radix
) {
3203 if (!radix
) return +s
;
3204 return parseInt(s
, radix
);
3207 /*** META ((export #t)
3208 (peephole (prefix "+")))
3210 function sc_string2real(s
) {
3215 /*** META ((export #t)
3218 function sc_isSymbol(s
) {
3219 return (typeof s
=== "string") &&
3220 (s
.charAt(0) === sc_SYMBOL_PREFIX
);
3223 /*** META ((export #t)
3224 (peephole (symbol2string_immutable)))
3226 function sc_symbol2string(s
) {
3230 /*** META ((export #t)
3231 (peephole (prefix "'\\u1E9C' +")))
3233 function sc_string2symbol(s
) {
3234 return sc_SYMBOL_PREFIX
+ s
;
3237 /*** META ((export symbol-append)
3238 (peephole (symbolAppend_immutable)))
3240 function sc_symbolAppend() {
3241 var res
= sc_SYMBOL_PREFIX
;
3242 for (var i
= 0; i
< arguments
.length
; i
++)
3243 res
+= arguments
[i
].slice(1);
3247 /*** META ((export #t)
3248 (peephole (postfix ".val")))
3250 function sc_char2string(c
) { return c
.val
; }
3252 /*** META ((export #t)
3253 (peephole (hole 1 "'\\u1E9C' + " c ".val")))
3255 function sc_char2symbol(c
) { return sc_SYMBOL_PREFIX
+ c
.val
; }
3257 /*** META ((export #t)
3260 function sc_isString(s
) {
3261 return (typeof s
=== "string") &&
3262 (s
.charAt(0) !== sc_SYMBOL_PREFIX
);
3265 /*** META ((export #t)) */
3266 var sc_makeString
= sc_makejsString
;
3269 /*** META ((export #t)) */
3270 function sc_string() {
3271 for (var i
= 0; i
< arguments
.length
; i
++)
3272 arguments
[i
] = arguments
[i
].val
;
3273 return "".concat
.apply("", arguments
);
3276 /*** META ((export #t)
3277 (peephole (postfix ".length")))
3279 function sc_stringLength(s
) { return s
.length
; }
3281 /*** META ((export #t)) */
3282 function sc_stringRef(s
, k
) {
3283 return new sc_Char(s
.charAt(k
));
3286 /* there's no stringSet in the immutable version
3287 function sc_stringSet(s, k, c)
3291 /*** META ((export string=?)
3293 (peephole (hole 2 str1 " === " str2)))
3295 function sc_isStringEqual(s1
, s2
) {
3298 /*** META ((export string<?)
3300 (peephole (hole 2 str1 " < " str2)))
3302 function sc_isStringLess(s1
, s2
) {
3305 /*** META ((export string>?)
3307 (peephole (hole 2 str1 " > " str2)))
3309 function sc_isStringGreater(s1
, s2
) {
3312 /*** META ((export string<=?)
3314 (peephole (hole 2 str1 " <= " str2)))
3316 function sc_isStringLessEqual(s1
, s2
) {
3319 /*** META ((export string>=?)
3321 (peephole (hole 2 str1 " >= " str2)))
3323 function sc_isStringGreaterEqual(s1
, s2
) {
3326 /*** META ((export string-ci=?)
3328 (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()")))
3330 function sc_isStringCIEqual(s1
, s2
) {
3331 return s1
.toLowerCase() === s2
.toLowerCase();
3333 /*** META ((export string-ci<?)
3335 (peephole (hole 2 str1 ".toLowerCase() < " str2 ".toLowerCase()")))
3337 function sc_isStringCILess(s1
, s2
) {
3338 return s1
.toLowerCase() < s2
.toLowerCase();
3340 /*** META ((export string-ci>?)
3342 (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()")))
3344 function sc_isStringCIGreater(s1
, s2
) {
3345 return s1
.toLowerCase() > s2
.toLowerCase();
3347 /*** META ((export string-ci<=?)
3349 (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()")))
3351 function sc_isStringCILessEqual(s1
, s2
) {
3352 return s1
.toLowerCase() <= s2
.toLowerCase();
3354 /*** META ((export string-ci>=?)
3356 (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()")))
3358 function sc_isStringCIGreaterEqual(s1
, s2
) {
3359 return s1
.toLowerCase() >= s2
.toLowerCase();
3362 /*** META ((export #t)
3363 (peephole (hole 3 s ".substring(" start ", " end ")")))
3365 function sc_substring(s
, start
, end
) {
3366 return s
.substring(start
, end
);
3369 /*** META ((export #t))
3371 function sc_isSubstring_at(s1
, s2
, i
) {
3372 return s2
== s1
.substring(i
, i
+ s2
.length
);
3375 /*** META ((export #t)
3376 (peephole (infix 0 #f "+" "''")))
3378 function sc_stringAppend() {
3379 return "".concat
.apply("", arguments
);
3382 /*** META ((export #t)) */
3383 var sc_string2list
= sc_jsstring2list
;
3385 /*** META ((export #t)) */
3386 var sc_list2string
= sc_list2jsstring
;
3388 /*** META ((export #t)
3391 function sc_stringCopy(s
) {
3395 /* there's no string-fill in the immutable version
3396 function sc_stringFill(s, c)
3399 /*** META ((export #t)
3400 (peephole (postfix ".slice(1)")))
3402 function sc_keyword2string(o
) {
3406 /*** META ((export #t)
3407 (peephole (prefix "'\\u1E9D' +")))
3409 function sc_string2keyword(o
) {
3410 return sc_KEYWORD_PREFIX
+ o
;
3413 String
.prototype.sc_toDisplayString = function() {
3414 if (this.charAt(0) === sc_SYMBOL_PREFIX
)
3415 // TODO: care for symbols with spaces (escape-chars symbols).
3416 return this.slice(1);
3417 else if (this.charAt(0) === sc_KEYWORD_PREFIX
)
3418 return ":" + this.slice(1);
3420 return this.toString();
3423 String
.prototype.sc_toWriteString = function() {
3424 if (this.charAt(0) === sc_SYMBOL_PREFIX
)
3425 // TODO: care for symbols with spaces (escape-chars symbols).
3426 return this.slice(1);
3427 else if (this.charAt(0) === sc_KEYWORD_PREFIX
)
3428 return ":" + this.slice(1);
3430 return '"' + sc_escapeWriteString(this) + '"';
3432 /* Exported Variables */
3433 var BgL_testzd2boyerzd2
;
3434 var BgL_nboyerzd2benchmarkzd2
;
3435 var BgL_setupzd2boyerzd2
;
3438 var translate_term_nboyer
;
3439 var translate_args_nboyer
;
3440 var untranslate_term_nboyer
;
3441 var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer
;
3442 var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
;
3443 var translate_alist_nboyer
;
3444 var apply_subst_nboyer
;
3445 var apply_subst_lst_nboyer
;
3446 var tautologyp_nboyer
;
3447 var if_constructor_nboyer
;
3448 var rewrite_count_nboyer
;
3450 var rewrite_args_nboyer
;
3451 var unify_subst_nboyer
;
3452 var one_way_unify1_nboyer
;
3453 var false_term_nboyer
;
3454 var true_term_nboyer
;
3455 var trans_of_implies1_nboyer
;
3456 var is_term_equal_nboyer
;
3457 var is_term_member_nboyer
;
3459 var sc_const_3_nboyer
;
3460 var sc_const_4_nboyer
;
3462 (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)))))));
3463 (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))))))));
3464 (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)))))))))));
3465 BgL_nboyerzd2benchmarkzd2 = function() {
3467 for (var sc_tmp
= arguments
.length
- 1; sc_tmp
>= 0; sc_tmp
--) {
3468 args
= sc_cons(arguments
[sc_tmp
], args
);
3471 return ((n
= ((args
=== null)?(0):(args
.car
))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n
))), (1), function() {
3472 return (BgL_testzd2boyerzd2(n
));
3473 }, function(rewrites
) {
3474 if ((sc_isNumber(rewrites
)))
3477 return (rewrites
===(95024));
3480 return (rewrites
===(591777));
3483 return (rewrites
===(1813975));
3486 return (rewrites
===(5375678));
3489 return (rewrites
===(16445406));
3492 return (rewrites
===(51507739));
3502 BgL_setupzd2boyerzd2 = function() {
3505 BgL_testzd2boyerzd2 = function() {
3508 translate_term_nboyer = function(term
) {
3510 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
))))))))));
3512 translate_args_nboyer = function(lst
) {
3515 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
))))))))));
3517 untranslate_term_nboyer = function(term
) {
3523 if (!(term
instanceof sc_Pair
))
3527 (falseHead1130
= (new sc_Pair(null, null)));
3528 (L1127
= (term
.cdr
));
3529 (tail1131
= falseHead1130
);
3530 while (!(L1127
=== null)) {
3532 (tail1131
.cdr
= (new sc_Pair((untranslate_term_nboyer((L1127
.car
))), null)));
3533 (tail1131
= (tail1131
.cdr
));
3534 (L1127
= (L1127
.cdr
));
3537 (optrOpnd
= (falseHead1130
.cdr
));
3538 return (new sc_Pair(((symbol_record
= (term
.car
)), (symbol_record
[(0)])), optrOpnd
));
3541 BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym
) {
3544 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
)));
3546 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
= null);
3547 translate_alist_nboyer = function(alist
) {
3550 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
))))))))));
3552 apply_subst_nboyer = function(alist
, term
) {
3555 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
))))))))));
3557 apply_subst_lst_nboyer = function(alist
, lst
) {
3559 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
))))))))));
3561 tautologyp_nboyer = function(sc_x_11
, true_lst
, false_lst
) {
3572 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))
3575 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))
3578 if (!(sc_x_11
instanceof sc_Pair
))
3581 if (((sc_x_11
.car
)===if_constructor_nboyer
))
3582 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))
3583 (sc_x_11
= (sc_x_11
.cdr
.cdr
.car
));
3585 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))
3586 (sc_x_11
= (sc_x_11
.cdr
.cdr
.cdr
.car
));
3588 if (((tautologyp_nboyer((sc_x_11
.cdr
.cdr
.car
), (new sc_Pair((sc_x_11
.cdr
.car
), true_lst
)), false_lst
))!== false))
3590 (false_lst
= (new sc_Pair((sc_x_11
.cdr
.car
), false_lst
)));
3591 (sc_x_11
= (sc_x_11
.cdr
.cdr
.cdr
.car
));
3599 (if_constructor_nboyer
= "\u1E9C*");
3600 (rewrite_count_nboyer
= (0));
3601 rewrite_nboyer = function(term
) {
3608 (++rewrite_count_nboyer
);
3609 if (!(term
instanceof sc_Pair
))
3613 (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
))))))))));
3614 (lst
= ((symbol_record
= (term
.car
)), (symbol_record
[(1)])));
3619 if ((((term2
= ((lst
.car
).cdr
.car
)), (unify_subst_nboyer
= null), (one_way_unify1_nboyer(sc_term_12
, term2
)))!== false))
3620 return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer
, ((lst
.car
).cdr
.cdr
.car
)))));
3627 rewrite_args_nboyer = function(lst
) {
3629 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
))))))))));
3631 (unify_subst_nboyer
= "\u1E9C*");
3632 one_way_unify1_nboyer = function(term1
, term2
) {
3636 if (!(term2
instanceof sc_Pair
))
3638 (temp_temp
= (sc_assq(term2
, unify_subst_nboyer
)));
3639 if ((temp_temp
!== false))
3640 return (is_term_equal_nboyer(term1
, (temp_temp
.cdr
)));
3642 if ((sc_isNumber(term2
)))
3643 return (sc_isEqual(term1
, term2
));
3646 (unify_subst_nboyer
= (new sc_Pair((new sc_Pair(term2
, term1
)), unify_subst_nboyer
)));
3651 if (!(term1
instanceof sc_Pair
))
3654 if (((term1
.car
)===(term2
.car
)))
3656 (lst1
= (term1
.cdr
));
3657 (lst2
= (term2
.cdr
));
3659 if ((lst1
=== null))
3660 return (lst2
=== null);
3662 if ((lst2
=== null))
3665 if (((one_way_unify1_nboyer((lst1
.car
), (lst2
.car
)))!== false))
3667 (lst1
= (lst1
.cdr
));
3668 (lst2
= (lst2
.cdr
));
3677 (false_term_nboyer
= "\u1E9C*");
3678 (true_term_nboyer
= "\u1E9C*");
3679 trans_of_implies1_nboyer = function(n
) {
3681 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)))))))))));
3683 is_term_equal_nboyer = function(x
, y
) {
3688 if ((x
instanceof sc_Pair
))
3689 if ((y
instanceof sc_Pair
))
3690 if ((((r1
= (x
.car
)), (r2
= (y
.car
)), (r1
===r2
))!== false))
3695 if ((lst1
=== null))
3696 return (lst2
=== null);
3698 if ((lst2
=== null))
3701 if (((is_term_equal_nboyer((lst1
.car
), (lst2
.car
)))!== false))
3703 (lst1
= (lst1
.cdr
));
3704 (lst2
= (lst2
.cdr
));
3715 return (sc_isEqual(x
, y
));
3717 is_term_member_nboyer = function(x
, lst
) {
3724 if (((is_term_equal_nboyer(x
, (lst
.car
)))!== false))
3730 BgL_setupzd2boyerzd2 = function() {
3733 var BgL_sc_symbolzd2record_16zd2
;
3741 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
= null);
3742 (if_constructor_nboyer
= (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif")));
3743 (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
))))))));
3744 (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
))))))));
3745 (lst
= sc_const_3_nboyer
);
3746 while (!(lst
=== null)) {
3749 if (((term
instanceof sc_Pair
)&&(((term
.car
)==="\u1E9Cequal")&&((term
.cdr
.car
) instanceof sc_Pair
))))
3751 (sc_sym_17
= ((term
.cdr
.car
).car
));
3752 (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)])))));
3753 (symbol_record
= (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17
)));
3754 (symbol_record
[(1)] = value
);
3757 (sc_error("ADD-LEMMA did not like term: ", term
));
3764 BgL_testzd2boyerzd2 = function(n
) {
3772 (rewrite_count_nboyer
= (0));
3773 (term
= sc_const_4_nboyer
);
3775 while (!(sc_n_20
=== 0)) {
3777 (term
= (sc_list("\u1E9Cor", term
, (new sc_Pair("\u1E9Cf",null)))));
3781 (sc_term_22
= term
);
3782 if (!(sc_term_22
instanceof sc_Pair
))
3783 (optrOpnd
= sc_term_22
);
3785 (optrOpnd
= (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22
.car
))), (translate_args_nboyer((sc_term_22
.cdr
))))));
3786 (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
)));
3787 (answer
= (tautologyp_nboyer((rewrite_nboyer(sc_term_21
)), null, null)));
3788 (sc_write(rewrite_count_nboyer
));
3789 (sc_display(" rewrites"));
3791 if ((answer
!== false))
3792 return rewrite_count_nboyer
;
3798 /* Exported Variables */
3799 var BgL_parsezd2ze3nbzd2treesze3
;
3800 var BgL_earleyzd2benchmarkzd2
;
3801 var BgL_parsezd2ze3parsedzf3zc2
;
3803 var BgL_parsezd2ze3treesz31
;
3804 var BgL_makezd2parserzd2
;
3809 (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)));
3810 BgL_makezd2parserzd2 = function(grammar
, lexer
) {
3823 var sc_predictors_3
;
3827 var BgL_sc_defzd2loop_6zd2
;
3828 var BgL_sc_nbzd2nts_7zd2
;
3830 var BgL_sc_defzd2loop_9zd2
;
3833 ind = function(nt
, sc_nts_10
) {
3836 (i
= ((sc_nts_10
.length
)-(1)));
3839 if ((sc_isEqual((sc_nts_10
[i
]), nt
)))
3848 (sc_nts_8
= ((BgL_sc_defzd2loop_9zd2 = function(defs
, sc_nts_11
) {
3852 return ((defs
instanceof sc_Pair
)?((def
= (defs
.car
)), (head
= (def
.car
)), (rule_loop = function(rules
, sc_nts_12
) {
3857 if ((rules
instanceof sc_Pair
))
3859 (rule
= (rules
.car
));
3861 (sc_nts_13
= sc_nts_12
);
3862 while ((l
instanceof sc_Pair
)) {
3866 (sc_nts_13
= (((sc_member(nt
, sc_nts_13
))!== false)?sc_nts_13:(new sc_Pair(nt
, sc_nts_13
))));
3869 return (rule_loop((rules
.cdr
), sc_nts_13
));
3872 return (BgL_sc_defzd2loop_9zd2((defs
.cdr
), sc_nts_12
));
3873 }), (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
)))));
3874 }), (BgL_sc_defzd2loop_9zd2(grammar
, null))));
3875 (BgL_sc_nbzd2nts_7zd2
= (sc_nts_8
.length
));
3876 (nb_confs
= (((BgL_sc_defzd2loop_6zd2 = function(defs
, BgL_sc_nbzd2confs_14zd2
) {
3879 return ((defs
instanceof sc_Pair
)?((def
= (defs
.car
)), (rule_loop = function(rules
, BgL_sc_nbzd2confs_15zd2
) {
3881 var BgL_sc_nbzd2confs_16zd2
;
3883 if ((rules
instanceof sc_Pair
))
3885 (rule
= (rules
.car
));
3887 (BgL_sc_nbzd2confs_16zd2
= BgL_sc_nbzd2confs_15zd2
);
3888 while ((l
instanceof sc_Pair
)) {
3891 (++BgL_sc_nbzd2confs_16zd2
);
3894 return (rule_loop((rules
.cdr
), (BgL_sc_nbzd2confs_16zd2
+(1))));
3897 return (BgL_sc_defzd2loop_6zd2((defs
.cdr
), BgL_sc_nbzd2confs_15zd2
));
3898 }), (rule_loop((def
.cdr
), BgL_sc_nbzd2confs_14zd2
))):BgL_sc_nbzd2confs_14zd2
);
3899 }), (BgL_sc_defzd2loop_6zd2(grammar
, (0))))+BgL_sc_nbzd2nts_7zd2
));
3900 (sc_starters_5
= (sc_makeVector(BgL_sc_nbzd2nts_7zd2
, null)));
3901 (sc_enders_4
= (sc_makeVector(BgL_sc_nbzd2nts_7zd2
, null)));
3902 (sc_predictors_3
= (sc_makeVector(BgL_sc_nbzd2nts_7zd2
, null)));
3903 (sc_steps_2
= (sc_makeVector(nb_confs
, false)));
3904 (sc_names_1
= (sc_makeVector(nb_confs
, false)));
3906 (starters
= sc_starters_5
);
3907 (enders
= sc_enders_4
);
3908 (predictors
= sc_predictors_3
);
3909 (steps
= sc_steps_2
);
3910 (names
= sc_names_1
);
3911 (nb_nts
= (sc_nts_8
.length
));
3915 (sc_steps_2
[i
] = (i
-nb_nts
));
3916 (sc_names_1
[i
] = (sc_list((sc_nts_8
[i
]), (0))));
3917 (sc_enders_4
[i
] = (sc_list(i
)));
3921 def_loop = function(defs
, conf
) {
3925 return ((defs
instanceof sc_Pair
)?((def
= (defs
.car
)), (head
= (def
.car
)), (rule_loop = function(rules
, conf
, rule_num
) {
3933 if ((rules
instanceof sc_Pair
))
3935 (rule
= (rules
.car
));
3936 (names
[conf
] = (sc_list(head
, rule_num
)));
3937 (sc_i_19
= (ind(head
, nts
)));
3938 (starters
[sc_i_19
] = (new sc_Pair(conf
, (starters
[sc_i_19
]))));
3940 (sc_conf_18
= conf
);
3941 while ((l
instanceof sc_Pair
)) {
3944 (steps
[sc_conf_18
] = (ind(nt
, nts
)));
3945 (sc_i_17
= (ind(nt
, nts
)));
3946 (predictors
[sc_i_17
] = (new sc_Pair(sc_conf_18
, (predictors
[sc_i_17
]))));
3951 (steps
[sc_conf_18
] = ((ind(head
, nts
))-nb_nts
));
3952 (i
= (ind(head
, nts
)));
3953 (enders
[i
] = (new sc_Pair(sc_conf_18
, (enders
[i
]))));
3954 return (rule_loop((rules
.cdr
), (sc_conf_18
+(1)), (rule_num
+(1))));
3957 return (def_loop((defs
.cdr
), conf
));
3958 }), (rule_loop((def
.cdr
), conf
, (1)))):undefined);
3960 (def_loop(grammar
, (sc_nts_8
.length
)));
3961 (parser_descr
= [lexer
, sc_nts_8
, sc_starters_5
, sc_enders_4
, sc_predictors_3
, sc_steps_2
, sc_names_1
]);
3962 return function(input
) {
3968 var BgL_sc_stateza2_23za2
;
3970 var BgL_sc_nbzd2nts_24zd2
;
3974 var BgL_sc_statesza2_27za2
;
3988 var BgL_sc_statesza2_30za2
;
3989 var BgL_sc_nbzd2nts_31zd2
;
3990 var BgL_sc_nbzd2confs_32zd2
;
3994 var BgL_sc_nbzd2confs_34zd2
;
3995 var BgL_sc_nbzd2toks_35zd2
;
4000 var sc_predictors_39
;
4007 var BgL_sc_confzd2setzd2getza2_44za2
;
4008 var conf_set_merge_new_bang
;
4009 var conf_set_adjoin
;
4010 var BgL_sc_confzd2setzd2adjoinza2_45za2
;
4011 var BgL_sc_confzd2setzd2adjoinza2za2_46z00
;
4016 var BgL_sc_derivzd2treesza2_47z70
;
4018 var BgL_sc_nbzd2derivzd2treesza2_48za2
;
4020 sc_ind_43 = function(nt
, sc_nts_49
) {
4023 (i
= ((sc_nts_49
.length
)-(1)));
4026 if ((sc_isEqual((sc_nts_49
[i
]), nt
)))
4035 make_states = function(BgL_sc_nbzd2toks_50zd2
, BgL_sc_nbzd2confs_51zd2
) {
4040 (sc_states_52
= (sc_makeVector((BgL_sc_nbzd2toks_50zd2
+(1)), false)));
4041 (i
= BgL_sc_nbzd2toks_50zd2
);
4044 (v
= (sc_makeVector((BgL_sc_nbzd2confs_51zd2
+(1)), false)));
4046 (sc_states_52
[i
] = v
);
4050 return sc_states_52
;
4053 BgL_sc_confzd2setzd2getza2_44za2 = function(state
, BgL_sc_statezd2num_53zd2
, sc_conf_54
) {
4055 var BgL_sc_confzd2set_55zd2
;
4056 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
)));
4058 conf_set_merge_new_bang = function(conf_set
) {
4059 return ((conf_set
[((conf_set
[(1)])+(5))] = (conf_set
[(4)])), (conf_set
[(1)] = (conf_set
[(3)])), (conf_set
[(3)] = (-1)), (conf_set
[(4)] = (-1)));
4061 conf_set_adjoin = function(state
, conf_set
, sc_conf_56
, i
) {
4063 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));
4065 BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57
, BgL_sc_statezd2num_58zd2
, l
, i
) {
4071 (state
= (sc_states_57
[BgL_sc_statezd2num_58zd2
]));
4073 while ((l1
instanceof sc_Pair
)) {
4075 (sc_conf_59
= (l1
.car
));
4076 (conf_set
= (BgL_sc_confzd2setzd2getza2_44za2(state
, BgL_sc_statezd2num_58zd2
, sc_conf_59
)));
4077 if (((conf_set
[(i
+(5))])=== false))
4079 (conf_set_adjoin(state
, conf_set
, sc_conf_59
, i
));
4089 BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60
, BgL_sc_statesza2_61za2
, BgL_sc_statezd2num_62zd2
, sc_conf_63
, i
) {
4090 var BgL_sc_confzd2setza2_64z70
;
4091 var BgL_sc_stateza2_65za2
;
4094 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));
4096 conf_set_union = function(state
, conf_set
, sc_conf_66
, other_set
) {
4099 (i
= (other_set
[(2)]));
4101 if (((conf_set
[(i
+(5))])=== false))
4103 (conf_set_adjoin(state
, conf_set
, sc_conf_66
, i
));
4104 (i
= (other_set
[(i
+(5))]));
4107 (i
= (other_set
[(i
+(5))]));
4112 forw = function(sc_states_67
, BgL_sc_statezd2num_68zd2
, sc_starters_69
, sc_enders_70
, sc_predictors_71
, sc_steps_72
, sc_nts_73
) {
4123 var BgL_sc_confzd2set_76zd2
;
4124 var BgL_sc_statezd2num_77zd2
;
4128 var BgL_sc_confzd2set_79zd2
;
4131 var BgL_sc_nbzd2nts_81zd2
;
4134 (sc_state_82
= (sc_states_67
[BgL_sc_statezd2num_68zd2
]));
4135 (BgL_sc_nbzd2nts_81zd2
= (sc_nts_73
.length
));
4138 (sc_conf_80
= (sc_state_82
[(0)]));
4139 if ((sc_conf_80
>=(0)))
4141 (step
= (sc_steps_72
[sc_conf_80
]));
4142 (BgL_sc_confzd2set_79zd2
= (sc_state_82
[(sc_conf_80
+(1))]));
4143 (head
= (BgL_sc_confzd2set_79zd2
[(4)]));
4144 (sc_state_82
[(0)] = (BgL_sc_confzd2set_79zd2
[(0)]));
4145 (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2
));
4148 (sc_l_74
= (sc_starters_69
[step
]));
4149 while ((sc_l_74
instanceof sc_Pair
)) {
4151 (starter
= (sc_l_74
.car
));
4152 (starter_set
= (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82
, BgL_sc_statezd2num_68zd2
, starter
)));
4153 if (((starter_set
[(BgL_sc_statezd2num_68zd2
+(5))])=== false))
4155 (conf_set_adjoin(sc_state_82
, starter_set
, starter
, BgL_sc_statezd2num_68zd2
));
4156 (sc_l_74
= (sc_l_74
.cdr
));
4159 (sc_l_74
= (sc_l_74
.cdr
));
4162 (l
= (sc_enders_70
[step
]));
4163 while ((l
instanceof sc_Pair
)) {
4166 if ((((conf_set
= (sc_state_82
[(ender
+(1))])), ((conf_set
!== false)?(conf_set
[(BgL_sc_statezd2num_68zd2
+(5))]):false))!== false))
4168 (next
= (sc_conf_80
+(1)));
4169 (next_set
= (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82
, BgL_sc_statezd2num_68zd2
, next
)));
4170 (conf_set_union(sc_state_82
, next_set
, next
, BgL_sc_confzd2set_79zd2
));
4180 (preds
= (sc_predictors_71
[(step
+BgL_sc_nbzd2nts_81zd2
)]));
4181 (sc_states_78
= sc_states_67
);
4182 (state
= sc_state_82
);
4183 (BgL_sc_statezd2num_77zd2
= BgL_sc_statezd2num_68zd2
);
4184 (BgL_sc_confzd2set_76zd2
= BgL_sc_confzd2set_79zd2
);
4185 sc_loop1_75 = function(l
) {
4187 var BgL_sc_nextzd2set_84zd2
;
4192 if ((l
instanceof sc_Pair
))
4198 (pred_set
= ((sc_state_83
= (sc_states_78
[i
])), (sc_state_83
[(pred
+(1))])));
4199 if ((pred_set
!== false))
4201 (sc_next_85
= (pred
+(1)));
4202 (BgL_sc_nextzd2set_84zd2
= (BgL_sc_confzd2setzd2getza2_44za2(state
, BgL_sc_statezd2num_77zd2
, sc_next_85
)));
4203 (conf_set_union(state
, BgL_sc_nextzd2set_84zd2
, sc_next_85
, pred_set
));
4205 (i
= (BgL_sc_confzd2set_76zd2
[(i
+(5))]));
4208 return (sc_loop1_75((l
.cdr
)));
4213 (sc_loop1_75(preds
));
4222 is_parsed = function(nt
, i
, j
, sc_nts_86
, sc_enders_87
, sc_states_88
) {
4227 var BgL_sc_ntza2_90za2
;
4229 (BgL_sc_ntza2_90za2
= (sc_ind_43(nt
, sc_nts_86
)));
4230 if ((BgL_sc_ntza2_90za2
!== false))
4233 (l
= (sc_enders_87
[BgL_sc_ntza2_90za2
]));
4235 if ((l
instanceof sc_Pair
))
4237 (sc_conf_89
= (l
.car
));
4238 if ((((state
= (sc_states_88
[j
])), (conf_set
= (state
[(sc_conf_89
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false))
4251 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
) {
4255 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
) {
4263 if ((l1
instanceof sc_Pair
))
4266 (ender_set
= ((state
= (sc_states_96
[j
])), (state
[(ender
+(1))])));
4267 if ((ender_set
!== false))
4269 loop2 = function(k
, l2
) {
4279 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)))
4281 (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
)));
4282 (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
)));
4283 loop3 = function(l3
, l2
) {
4287 if ((l3
instanceof sc_Pair
))
4289 (ender_tree
= (sc_list((l3
.car
))));
4292 while ((l4
instanceof sc_Pair
)) {
4294 (sc_l2_100
= (new sc_Pair((sc_append((l4
.car
), ender_tree
)), sc_l2_100
)));
4298 return (loop3((l3
.cdr
), sc_l2_100
));
4301 return (loop2((ender_set
[(k
+(5))]), l2
));
4303 return (loop3(ender_trees
, l2
));
4306 (k
= (ender_set
[(k
+(5))]));
4308 return (sc_loop1_98((l1
.cdr
), l2
));
4311 return (loop2((ender_set
[(2)]), l2
));
4319 }), (sc_loop1_98((sc_enders_92
[(sc_steps_93
[prev
])]), null)))));
4321 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
) {
4327 var BgL_sc_nbzd2nts_108zd2
;
4328 var BgL_sc_ntza2_109za2
;
4330 (BgL_sc_ntza2_109za2
= (sc_ind_43(nt
, sc_nts_101
)));
4331 if ((BgL_sc_ntza2_109za2
!== false))
4333 (BgL_sc_nbzd2nts_108zd2
= (sc_nts_101
.length
));
4334 (l
= (sc_enders_102
[BgL_sc_ntza2_109za2
]));
4336 while ((l
instanceof sc_Pair
)) {
4338 (sc_conf_107
= (l
.car
));
4339 if ((((state
= (sc_states_106
[j
])), (conf_set
= (state
[(sc_conf_107
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false))
4342 (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
)));
4354 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
) {
4358 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
) {
4371 if ((l
instanceof sc_Pair
))
4374 (ender_set
= ((sc_state_117
= (sc_states_114
[j
])), (sc_state_117
[(ender
+(1))])));
4375 if ((ender_set
!== false))
4377 (k
= (ender_set
[(2)]));
4380 if (((k
>=i
)&&(((state
= (sc_states_114
[k
])), (conf_set
= (state
[(prev
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false)))
4382 (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
)));
4383 (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
)));
4384 (k
= (ender_set
[(k
+(5))]));
4385 (n
+=(nb_prev_trees
*nb_ender_trees
));
4388 (k
= (ender_set
[(k
+(5))]));
4390 return (sc_loop1_116((l
.cdr
), n
));
4398 }), (sc_loop1_116((sc_enders_111
[(sc_steps_112
[prev
])]), (0))))));
4400 BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt
, i
, j
, sc_nts_119
, sc_enders_120
, sc_steps_121
, sc_toks_122
, sc_states_123
) {
4406 var BgL_sc_nbzd2nts_125zd2
;
4407 var BgL_sc_ntza2_126za2
;
4409 (BgL_sc_ntza2_126za2
= (sc_ind_43(nt
, sc_nts_119
)));
4410 if ((BgL_sc_ntza2_126za2
!== false))
4412 (BgL_sc_nbzd2nts_125zd2
= (sc_nts_119
.length
));
4413 (l
= (sc_enders_120
[BgL_sc_ntza2_126za2
]));
4415 while ((l
instanceof sc_Pair
)) {
4417 (sc_conf_124
= (l
.car
));
4418 if ((((state
= (sc_states_123
[j
])), (conf_set
= (state
[(sc_conf_124
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false))
4421 (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
));
4433 (lexer
= (parser_descr
[(0)]));
4434 (sc_nts_42
= (parser_descr
[(1)]));
4435 (sc_starters_41
= (parser_descr
[(2)]));
4436 (sc_enders_40
= (parser_descr
[(3)]));
4437 (sc_predictors_39
= (parser_descr
[(4)]));
4438 (sc_steps_38
= (parser_descr
[(5)]));
4439 (sc_names_37
= (parser_descr
[(6)]));
4440 (falseHead1128
= (new sc_Pair(null, null)));
4441 (L1125
= (lexer(input
)));
4442 (tail1129
= falseHead1128
);
4443 while (!(L1125
=== null)) {
4445 (tok
= (L1125
.car
));
4448 while ((l1
instanceof sc_Pair
)) {
4450 (sc_i_29
= (sc_ind_43((l1
.car
), sc_nts_42
)));
4451 if ((sc_i_29
!== false))
4454 (l2
= (new sc_Pair(sc_i_29
, l2
)));
4460 (sc_optrOpnd_22
= (new sc_Pair((tok
.car
), (sc_reverse(l2
)))));
4461 (sc_optrOpnd_21
= (new sc_Pair(sc_optrOpnd_22
, null)));
4462 (tail1129
.cdr
= sc_optrOpnd_21
);
4463 (tail1129
= (tail1129
.cdr
));
4464 (L1125
= (L1125
.cdr
));
4467 (sc_optrOpnd_20
= (falseHead1128
.cdr
));
4468 (sc_toks_36
= (sc_list2vector(sc_optrOpnd_20
)));
4469 (BgL_sc_nbzd2toks_35zd2
= (sc_toks_36
.length
));
4470 (BgL_sc_nbzd2confs_34zd2
= (sc_steps_38
.length
));
4471 (sc_states_33
= (make_states(BgL_sc_nbzd2toks_35zd2
, BgL_sc_nbzd2confs_34zd2
)));
4472 (goal_starters
= (sc_starters_41
[(0)]));
4473 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33
, (0), goal_starters
, (0)));
4474 (forw(sc_states_33
, (0), sc_starters_41
, sc_enders_40
, sc_predictors_39
, sc_steps_38
, sc_nts_42
));
4476 while ((sc_i_28
<BgL_sc_nbzd2toks_35zd2
)) {
4478 (tok_nts
= ((sc_toks_36
[sc_i_28
]).cdr
));
4479 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33
, (sc_i_28
+(1)), tok_nts
, sc_i_28
));
4480 (forw(sc_states_33
, (sc_i_28
+(1)), sc_starters_41
, sc_enders_40
, sc_predictors_39
, sc_steps_38
, sc_nts_42
));
4484 (nb_toks
= (sc_toks_36
.length
));
4485 (BgL_sc_nbzd2confs_32zd2
= (sc_steps_38
.length
));
4486 (BgL_sc_nbzd2nts_31zd2
= (sc_nts_42
.length
));
4487 (BgL_sc_statesza2_30za2
= (make_states(nb_toks
, BgL_sc_nbzd2confs_32zd2
)));
4488 (goal_enders
= (sc_enders_40
[(0)]));
4490 while ((l
instanceof sc_Pair
)) {
4493 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_33
, BgL_sc_statesza2_30za2
, nb_toks
, conf
, (0)));
4500 (states
= sc_states_33
);
4501 (BgL_sc_statesza2_27za2
= BgL_sc_statesza2_30za2
);
4503 (sc_enders_26
= sc_enders_40
);
4504 (sc_steps_25
= sc_steps_38
);
4505 (BgL_sc_nbzd2nts_24zd2
= BgL_sc_nbzd2nts_31zd2
);
4506 (toks
= sc_toks_36
);
4507 (BgL_sc_stateza2_23za2
= (BgL_sc_statesza2_30za2
[i
]));
4508 loop1 = function() {
4511 var BgL_sc_statesza2_128za2
;
4520 (sc_conf_131
= (BgL_sc_stateza2_23za2
[(0)]));
4521 if ((sc_conf_131
>=(0)))
4523 (conf_set
= (BgL_sc_stateza2_23za2
[(sc_conf_131
+(1))]));
4524 (head
= (conf_set
[(4)]));
4525 (BgL_sc_stateza2_23za2
[(0)] = (conf_set
[(0)]));
4526 (conf_set_merge_new_bang(conf_set
));
4528 while ((sc_i_130
>=(0))) {
4532 (sc_states_129
= states
);
4533 (BgL_sc_statesza2_128za2
= BgL_sc_statesza2_27za2
);
4534 (prev
= (sc_conf_131
-(1)));
4535 if (((sc_conf_131
>=BgL_sc_nbzd2nts_24zd2
)&&((sc_steps_25
[prev
])>=(0))))
4537 sc_loop1_127 = function(l
) {
4544 if ((l
instanceof sc_Pair
))
4547 (ender_set
= ((state
= (sc_states_129
[j
])), (state
[(ender
+(1))])));
4548 if ((ender_set
!== false))
4550 (k
= (ender_set
[(2)]));
4554 if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129
, BgL_sc_statesza2_128za2
, k
, prev
, i
))!== false))
4555 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129
, BgL_sc_statesza2_128za2
, j
, ender
, k
));
4556 (k
= (ender_set
[(k
+(5))]));
4559 return (sc_loop1_127((l
.cdr
)));
4568 (sc_loop1_127((sc_enders_26
[(sc_steps_25
[prev
])])));
4570 (sc_i_130
= (conf_set
[(sc_i_130
+(5))]));
4583 (optrOpnd
= BgL_sc_statesza2_30za2
);
4584 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
];
4589 BgL_parsezd2ze3parsedzf3zc2 = function(parse
, nt
, i
, j
) {
4594 return ((nts
= (parse
[(0)])), (enders
= (parse
[(2)])), (states
= (parse
[(7)])), (is_parsed
= (parse
[(8)])), (is_parsed(nt
, i
, j
, nts
, enders
, states
)));
4596 BgL_parsezd2ze3treesz31 = function(parse
, nt
, i
, j
) {
4597 var BgL_sc_derivzd2treesza2_132z70
;
4604 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
)));
4606 BgL_parsezd2ze3nbzd2treesze3 = function(parse
, nt
, i
, j
) {
4607 var BgL_sc_nbzd2derivzd2treesza2_133za2
;
4613 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
)));
4615 test = function(k
) {
4618 return ((p
= (BgL_makezd2parserzd2(const_earley
, function(l
) {
4624 (falseHead1133
= (new sc_Pair(null, null)));
4625 (tail1134
= falseHead1133
);
4627 while (!(L1130
=== null)) {
4629 (tail1134
.cdr
= (new sc_Pair(((sc_x_134
= (L1130
.car
)), (sc_list(sc_x_134
, sc_x_134
))), null)));
4630 (tail1134
= (tail1134
.cdr
));
4631 (L1130
= (L1130
.cdr
));
4634 return (falseHead1133
.cdr
);
4636 }))), (x
= (p((sc_vector2list((sc_makeVector(k
, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x
, "\u1E9Cs", (0), k
)))));
4638 BgL_earleyzd2benchmarkzd2 = function() {
4640 for (var sc_tmp
= arguments
.length
- 1; sc_tmp
>= 0; sc_tmp
--) {
4641 args
= sc_cons(arguments
[sc_tmp
], args
);
4644 return ((k
= ((args
=== null)?(7):(args
.car
))), (BgL_runzd2benchmarkzd2("earley", (1), function() {
4646 }, function(result
) {
4647 return ((sc_display(result
)), (sc_newline()), result
== 132);
4653 /************* END OF GENERATED CODE *************/
4654 // Invoke this function to run a benchmark.
4655 // The first argument is a string identifying the benchmark.
4656 // The second argument is the number of times to run the benchmark.
4657 // The third argument is a function that runs the benchmark.
4658 // The fourth argument is a unary function that warns if the result
4659 // returned by the benchmark is incorrect.
4662 // RunBenchmark("new Array()",
4664 // function () { new Array(1000000); }
4666 // return (v instanceof Array) && (v.length == 1000000);
4669 SC_DEFAULT_OUT
= new sc_GenericOutputPort(function(s
) {});
4670 SC_ERROR_OUT
= SC_DEFAULT_OUT
;
4672 function RunBenchmark(name
, count
, run
, warn
) {
4673 for (var n
= 0; n
< count
; ++n
) {
4675 if (!warn(result
)) {
4676 throw new Error("Earley or Boyer did incorrect number of rewrites");
4681 var BgL_runzd2benchmarkzd2
= RunBenchmark
;
4683 for (var i
= 0; i
< 4; ++i
) {
4684 BgL_earleyzd2benchmarkzd2();
4685 BgL_nboyerzd2benchmarkzd2();
4689 print("JSC EXCEPTION FUZZ: Caught exception: " + e
);