3 <script src=
"../htmlrunner.js"></script>
5 // This file is automatically generated by scheme2js, except for the
6 // benchmark harness code at the beginning and end of the file.
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 *************/
13 /************* GENERATED FILE - DO NOT EDIT *************/
14 /************* GENERATED FILE - DO NOT EDIT *************/
15 /************* GENERATED FILE - DO NOT EDIT *************/
17 * To use write/prints/... the default-output port has to be set first.
18 * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values
19 * should do the trick.
20 * In the following example the std-out and error-port are redirected to
22 function initRuntime() {
23 function escapeHTML(s) {
25 tmp = tmp.replace(/&/g, "&");
26 tmp = tmp.replace(/</g, "<");
27 tmp = tmp.replace(/>/g, ">");
28 tmp = tmp.replace(/ /g, " ");
29 tmp = tmp.replace(/\n/g, "<br />");
30 tmp = tmp.replace(/\t/g, "  ");
35 document.write("<div id='stdout'></div>");
36 SC_DEFAULT_OUT = new sc_GenericOutputPort(
38 var stdout = document.getElementById('stdout');
39 stdout.innerHTML = stdout.innerHTML + escapeHTML(s);
41 SC_ERROR_OUT = SC_DEFAULT_OUT;
46 function sc_print_debug() {
47 sc_print
.apply(null, arguments
);
49 /*** META ((export *js*)) */
50 var sc_JS_GLOBALS
= this;
55 /*** META ((export #t)) */
57 var len
= arguments
.length
;
61 for( i
= 0; i
< len
; i
++ ) {
62 s
+= sc_toDisplayString(arguments
[ i
]);
68 /*** META ((export #t)) */
69 function sc_typeof( x
) {
73 /*** META ((export #t)) */
75 var a
= [sc_jsstring2symbol("*error*")];
76 for (var i
= 0; i
< arguments
.length
; i
++) {
77 a
[i
+1] = arguments
[i
];
82 /*** META ((export #t)
83 (peephole (prefix "throw ")))
85 function sc_raise(obj
) {
89 /*** META ((export with-handler-lambda)) */
90 function sc_withHandlerLambda(handler
, body
) {
94 if (!e
._internalException
)
101 var sc_properties
= new Object();
103 /*** META ((export #t)) */
104 function sc_putpropBang(sym
, key
, val
) {
105 var ht
= sc_properties
[sym
];
108 sc_properties
[sym
] = ht
;
113 /*** META ((export #t)) */
114 function sc_getprop(sym
, key
) {
115 var ht
= sc_properties
[sym
];
125 /*** META ((export #t)) */
126 function sc_rempropBang(sym
, key
) {
127 var ht
= sc_properties
[sym
];
132 /*** META ((export #t)) */
133 function sc_any2String(o
) {
134 return jsstring2string(sc_toDisplayString(o
));
137 /*** META ((export #t)
138 (peephole (infix 2 2 "==="))
141 function sc_isEqv(o1
, o2
) {
145 /*** META ((export #t)
146 (peephole (infix 2 2 "==="))
149 function sc_isEq(o1
, o2
) {
153 /*** META ((export #t)
156 function sc_isNumber(n
) {
157 return (typeof n
=== "number");
160 /*** META ((export #t)
163 function sc_isComplex(n
) {
164 return sc_isNumber(n
);
167 /*** META ((export #t)
170 function sc_isReal(n
) {
171 return sc_isNumber(n
);
174 /*** META ((export #t)
177 function sc_isRational(n
) {
181 /*** META ((export #t)
184 function sc_isInteger(n
) {
185 return (parseInt(n
) === n
);
188 /*** META ((export #t)
190 (peephole (postfix ", false")))
192 // we don't have exact numbers...
193 function sc_isExact(n
) {
197 /*** META ((export #t)
198 (peephole (postfix ", true"))
201 function sc_isInexact(n
) {
205 /*** META ((export = =fx =fl)
207 (peephole (infix 2 2 "===")))
209 function sc_equal(x
) {
210 for (var i
= 1; i
< arguments
.length
; i
++)
211 if (x
!== arguments
[i
])
216 /*** META ((export < <fx <fl)
218 (peephole (infix 2 2 "<")))
220 function sc_less(x
) {
221 for (var i
= 1; i
< arguments
.length
; i
++) {
222 if (x
>= arguments
[i
])
229 /*** META ((export > >fx >fl)
231 (peephole (infix 2 2 ">")))
233 function sc_greater(x
, y
) {
234 for (var i
= 1; i
< arguments
.length
; i
++) {
235 if (x
<= arguments
[i
])
242 /*** META ((export <= <=fx <=fl)
244 (peephole (infix 2 2 "<=")))
246 function sc_lessEqual(x
, y
) {
247 for (var i
= 1; i
< arguments
.length
; i
++) {
248 if (x
> arguments
[i
])
255 /*** META ((export >= >=fl >=fx)
257 (peephole (infix 2 2 ">=")))
259 function sc_greaterEqual(x
, y
) {
260 for (var i
= 1; i
< arguments
.length
; i
++) {
261 if (x
< arguments
[i
])
268 /*** META ((export #t)
270 (peephole (postfix "=== 0")))
272 function sc_isZero(x
) {
276 /*** META ((export #t)
278 (peephole (postfix "> 0")))
280 function sc_isPositive(x
) {
284 /*** META ((export #t)
286 (peephole (postfix "< 0")))
288 function sc_isNegative(x
) {
292 /*** META ((export #t)
294 (peephole (postfix "%2===1")))
296 function sc_isOdd(x
) {
297 return (x
% 2 === 1);
300 /*** META ((export #t)
302 (peephole (postfix "%2===0")))
304 function sc_isEven(x
) {
305 return (x
% 2 === 0);
308 /*** META ((export #t)) */
309 var sc_max
= Math
.max
;
310 /*** META ((export #t)) */
311 var sc_min
= Math
.min
;
313 /*** META ((export + +fx +fl)
314 (peephole (infix 0 #f "+" "0")))
318 for (var i
= 0; i
< arguments
.length
; i
++)
323 /*** META ((export * *fx *fl)
324 (peephole (infix 0 #f "*" "1")))
326 function sc_multi() {
328 for (var i
= 0; i
< arguments
.length
; i
++)
329 product
*= arguments
[i
];
333 /*** META ((export - -fx -fl)
336 function sc_minus(x
) {
337 if (arguments
.length
=== 1)
341 for (var i
= 1; i
< arguments
.length
; i
++)
347 /*** META ((export / /fl)
351 if (arguments
.length
=== 1)
355 for (var i
= 1; i
< arguments
.length
; i
++)
361 /*** META ((export #t)) */
362 var sc_abs
= Math
.abs
;
364 /*** META ((export quotient /fx)
365 (peephole (hole 2 "parseInt(" x "/" y ")")))
367 function sc_quotient(x
, y
) {
368 return parseInt(x
/ y
);
371 /*** META ((export #t)
372 (peephole (infix 2 2 "%")))
374 function sc_remainder(x
, y
) {
378 /*** META ((export #t)
381 function sc_modulo(x
, y
) {
382 var remainder
= x
% y
;
383 // if they don't have the same sign
384 if ((remainder
* y
) < 0)
385 return remainder
+ y
;
390 function sc_euclid_gcd(a
, b
) {
392 if (a
=== 0) return b
;
393 if (b
=== 0) return a
;
394 if (a
< 0) {a
= -a
;};
395 if (b
< 0) {b
= -b
;};
396 if (b
> a
) {temp
= a
; a
= b
; b
= temp
;};
399 if(a
=== 0) {return b
;};
401 if(b
=== 0) {return a
;};
406 /*** META ((export #t)) */
409 for (var i
= 0; i
< arguments
.length
; i
++)
410 gcd
= sc_euclid_gcd(gcd
, arguments
[i
]);
414 /*** META ((export #t)) */
417 for (var i
= 0; i
< arguments
.length
; i
++) {
418 var f
= Math
.round(arguments
[i
] / sc_euclid_gcd(arguments
[i
], lcm
));
424 // LIMITATION: numerator and denominator don't make sense in floating point world.
425 //var SC_MAX_DECIMALS = 1000000
427 // function sc_numerator(x) {
428 // var rounded = Math.round(x * SC_MAX_DECIMALS);
429 // return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
432 // function sc_denominator(x) {
433 // var rounded = Math.round(x * SC_MAX_DECIMALS);
434 // return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS));
437 /*** META ((export #t)) */
438 var sc_floor
= Math
.floor
;
439 /*** META ((export #t)) */
440 var sc_ceiling
= Math
.ceil
;
441 /*** META ((export #t)) */
442 var sc_truncate
= parseInt
;
443 /*** META ((export #t)) */
444 var sc_round
= Math
.round
;
446 // LIMITATION: sc_rationalize doesn't make sense in a floating point world.
448 /*** META ((export #t)) */
449 var sc_exp
= Math
.exp
;
450 /*** META ((export #t)) */
451 var sc_log
= Math
.log
;
452 /*** META ((export #t)) */
453 var sc_sin
= Math
.sin
;
454 /*** META ((export #t)) */
455 var sc_cos
= Math
.cos
;
456 /*** META ((export #t)) */
457 var sc_tan
= Math
.tan
;
458 /*** META ((export #t)) */
459 var sc_asin
= Math
.asin
;
460 /*** META ((export #t)) */
461 var sc_acos
= Math
.acos
;
462 /*** META ((export #t)) */
463 var sc_atan
= Math
.atan
;
465 /*** META ((export #t)) */
466 var sc_sqrt
= Math
.sqrt
;
467 /*** META ((export #t)) */
468 var sc_expt
= Math
.pow
;
470 // LIMITATION: we don't have complex numbers.
471 // LIMITATION: the following functions are hence not implemented.
472 // LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle
473 // LIMITATION: 2 argument atan
475 /*** META ((export #t)
478 function sc_exact2inexact(x
) {
482 /*** META ((export #t)
485 function sc_inexact2exact(x
) {
489 function sc_number2jsstring(x
, radix
) {
491 return x
.toString(radix
);
496 function sc_jsstring2number(s
, radix
) {
497 if (s
=== "") return false;
500 var t
= parseInt(s
, radix
);
501 if (!t
&& t
!== 0) return false;
502 // verify that each char is in range. (parseInt ignores leading
503 // white and trailing chars)
504 var allowedChars
= "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix
+1);
505 if ((new RegExp("^["+allowedChars
+"]*$", "i")).test(s
))
509 var t
= +s
; // does not ignore trailing chars.
510 if (!t
&& t
!== 0) return false;
511 // simply verify that first char is not whitespace.
513 // if +c is 0, but the char is not "0", then we have a whitespace.
514 if (+c
=== 0 && c
!== "0") return false;
519 /*** META ((export #t)
527 /*** META ((export #t)
530 function sc_isBoolean(b
) {
531 return (b
=== true) || (b
=== false);
534 function sc_Pair(car
, cdr
) {
539 sc_Pair
.prototype.toString = function() {
540 return sc_toDisplayString(this);
542 sc_Pair
.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay
) {
548 res
+= writeOrDisplay(current
.car
);
549 if (sc_isPair(current
.cdr
)) {
551 current
= current
.cdr
;
552 } else if (current
.cdr
!== null) {
553 res
+= " . " + writeOrDisplay(current
.cdr
);
555 } else // current.cdr == null
563 sc_Pair
.prototype.sc_toDisplayString = function() {
564 return this.sc_toWriteOrDisplayString(sc_toDisplayString
);
566 sc_Pair
.prototype.sc_toWriteString = function() {
567 return this.sc_toWriteOrDisplayString(sc_toWriteString
);
569 // sc_Pair.prototype.sc_toWriteCircleString in IO.js
571 /*** META ((export #t)
573 (peephole (postfix " instanceof sc_Pair")))
575 function sc_isPair(p
) {
576 return (p
instanceof sc_Pair
);
579 function sc_isPairEqual(p1
, p2
, comp
) {
580 return (comp(p1
.car
, p2
.car
) && comp(p1
.cdr
, p2
.cdr
));
583 /*** META ((export #t)
584 (peephole (hole 2 "new sc_Pair(" car ", " cdr ")")))
586 function sc_cons(car
, cdr
) {
587 return new sc_Pair(car
, cdr
);
590 /*** META ((export cons*)) */
591 function sc_consStar() {
592 var res
= arguments
[arguments
.length
- 1];
593 for (var i
= arguments
.length
-2; i
>= 0; i
--)
594 res
= new sc_Pair(arguments
[i
], res
);
598 /*** META ((export #t)
599 (peephole (postfix ".car")))
605 /*** META ((export #t)
606 (peephole (postfix ".cdr")))
612 /*** META ((export #t)
613 (peephole (hole 2 p ".car = " val)))
615 function sc_setCarBang(p
, val
) {
619 /*** META ((export #t)
620 (peephole (hole 2 p ".cdr = " val)))
622 function sc_setCdrBang(p
, val
) {
626 /*** META ((export #t)
627 (peephole (postfix ".car.car")))
629 function sc_caar(p
) { return p
.car
.car
; }
630 /*** META ((export #t)
631 (peephole (postfix ".cdr.car")))
633 function sc_cadr(p
) { return p
.cdr
.car
; }
634 /*** META ((export #t)
635 (peephole (postfix ".car.cdr")))
637 function sc_cdar(p
) { return p
.car
.cdr
; }
638 /*** META ((export #t)
639 (peephole (postfix ".cdr.cdr")))
641 function sc_cddr(p
) { return p
.cdr
.cdr
; }
642 /*** META ((export #t)
643 (peephole (postfix ".car.car.car")))
645 function sc_caaar(p
) { return p
.car
.car
.car
; }
646 /*** META ((export #t)
647 (peephole (postfix ".car.cdr.car")))
649 function sc_cadar(p
) { return p
.car
.cdr
.car
; }
650 /*** META ((export #t)
651 (peephole (postfix ".cdr.car.car")))
653 function sc_caadr(p
) { return p
.cdr
.car
.car
; }
654 /*** META ((export #t)
655 (peephole (postfix ".cdr.cdr.car")))
657 function sc_caddr(p
) { return p
.cdr
.cdr
.car
; }
658 /*** META ((export #t)
659 (peephole (postfix ".car.car.cdr")))
661 function sc_cdaar(p
) { return p
.car
.car
.cdr
; }
662 /*** META ((export #t)
663 (peephole (postfix ".cdr.car.cdr")))
665 function sc_cdadr(p
) { return p
.cdr
.car
.cdr
; }
666 /*** META ((export #t)
667 (peephole (postfix ".car.cdr.cdr")))
669 function sc_cddar(p
) { return p
.car
.cdr
.cdr
; }
670 /*** META ((export #t)
671 (peephole (postfix ".cdr.cdr.cdr")))
673 function sc_cdddr(p
) { return p
.cdr
.cdr
.cdr
; }
674 /*** META ((export #t)
675 (peephole (postfix ".car.car.car.car")))
677 function sc_caaaar(p
) { return p
.car
.car
.car
.car
; }
678 /*** META ((export #t)
679 (peephole (postfix ".car.cdr.car.car")))
681 function sc_caadar(p
) { return p
.car
.cdr
.car
.car
; }
682 /*** META ((export #t)
683 (peephole (postfix ".cdr.car.car.car")))
685 function sc_caaadr(p
) { return p
.cdr
.car
.car
.car
; }
686 /*** META ((export #t)
687 (peephole (postfix ".cdr.cdr.car.car")))
689 function sc_caaddr(p
) { return p
.cdr
.cdr
.car
.car
; }
690 /*** META ((export #t)
691 (peephole (postfix ".car.car.car.cdr")))
693 function sc_cdaaar(p
) { return p
.car
.car
.car
.cdr
; }
694 /*** META ((export #t)
695 (peephole (postfix ".car.cdr.car.cdr")))
697 function sc_cdadar(p
) { return p
.car
.cdr
.car
.cdr
; }
698 /*** META ((export #t)
699 (peephole (postfix ".cdr.car.car.cdr")))
701 function sc_cdaadr(p
) { return p
.cdr
.car
.car
.cdr
; }
702 /*** META ((export #t)
703 (peephole (postfix ".cdr.cdr.car.cdr")))
705 function sc_cdaddr(p
) { return p
.cdr
.cdr
.car
.cdr
; }
706 /*** META ((export #t)
707 (peephole (postfix ".car.car.cdr.car")))
709 function sc_cadaar(p
) { return p
.car
.car
.cdr
.car
; }
710 /*** META ((export #t)
711 (peephole (postfix ".car.cdr.cdr.car")))
713 function sc_caddar(p
) { return p
.car
.cdr
.cdr
.car
; }
714 /*** META ((export #t)
715 (peephole (postfix ".cdr.car.cdr.car")))
717 function sc_cadadr(p
) { return p
.cdr
.car
.cdr
.car
; }
718 /*** META ((export #t)
719 (peephole (postfix ".cdr.cdr.cdr.car")))
721 function sc_cadddr(p
) { return p
.cdr
.cdr
.cdr
.car
; }
722 /*** META ((export #t)
723 (peephole (postfix ".car.car.cdr.cdr")))
725 function sc_cddaar(p
) { return p
.car
.car
.cdr
.cdr
; }
726 /*** META ((export #t)
727 (peephole (postfix ".car.cdr.cdr.cdr")))
729 function sc_cdddar(p
) { return p
.car
.cdr
.cdr
.cdr
; }
730 /*** META ((export #t)
731 (peephole (postfix ".cdr.car.cdr.cdr")))
733 function sc_cddadr(p
) { return p
.cdr
.car
.cdr
.cdr
; }
734 /*** META ((export #t)
735 (peephole (postfix ".cdr.cdr.cdr.cdr")))
737 function sc_cddddr(p
) { return p
.cdr
.cdr
.cdr
.cdr
; }
739 /*** META ((export #t)) */
740 function sc_lastPair(l
) {
741 if (!sc_isPair(l
)) sc_error("sc_lastPair: pair expected");
744 while (sc_isPair(cdr
)) {
751 /*** META ((export #t)
753 (peephole (postfix " === null")))
755 function sc_isNull(o
) {
759 /*** META ((export #t)
762 function sc_isList(o
) {
769 if (rabbit
=== null ||
770 (rabbit
instanceof sc_Pair
&& rabbit
.cdr
=== null))
771 return true; // end of list
772 else if ((rabbit
instanceof sc_Pair
) &&
773 (rabbit
.cdr
instanceof sc_Pair
)) {
774 rabbit
= rabbit
.cdr
.cdr
;
776 if (rabbit
=== turtle
) return false; // cycle
778 return false; // not pair
782 /*** META ((export #t)) */
786 for (var i
= a
.length
-1; i
>= 0; i
--)
787 res
= new sc_Pair(a
[i
], res
);
791 /*** META ((export #t)) */
792 function sc_iota(num
, init
) {
795 for (var i
= num
- 1; i
>= 0; i
--)
796 res
= new sc_Pair(i
+ init
, res
);
800 /*** META ((export #t)) */
801 function sc_makeList(nbEls
, fill
) {
803 for (var i
= 0; i
< nbEls
; i
++)
804 res
= new sc_Pair(fill
, res
);
808 /*** META ((export #t)) */
809 function sc_length(l
) {
818 /*** META ((export #t)) */
819 function sc_remq(o
, l
) {
820 var dummy
= { cdr
: null };
824 tail
.cdr
= sc_cons(l
.car
, null);
832 /*** META ((export #t)) */
833 function sc_remqBang(o
, l
) {
834 var dummy
= { cdr
: null };
836 var needsAssig
= true;
853 /*** META ((export #t)) */
854 function sc_delete(o
, l
) {
855 var dummy
= { cdr
: null };
858 if (!sc_isEqual(l
.car
, o
)) {
859 tail
.cdr
= sc_cons(l
.car
, null);
867 /*** META ((export #t)) */
868 function sc_deleteBang(o
, l
) {
869 var dummy
= { cdr
: null };
871 var needsAssig
= true;
873 if (sc_isEqual(l
.car
, o
)) {
888 function sc_reverseAppendBang(l1
, l2
) {
890 while (l1
!== null) {
899 function sc_dualAppend(l1
, l2
) {
900 if (l1
=== null) return l2
;
901 if (l2
=== null) return l1
;
902 var rev
= sc_reverse(l1
);
903 return sc_reverseAppendBang(rev
, l2
);
906 /*** META ((export #t)) */
907 function sc_append() {
908 if (arguments
.length
=== 0)
910 var res
= arguments
[arguments
.length
- 1];
911 for (var i
= arguments
.length
- 2; i
>= 0; i
--)
912 res
= sc_dualAppend(arguments
[i
], res
);
916 function sc_dualAppendBang(l1
, l2
) {
917 if (l1
=== null) return l2
;
918 if (l2
=== null) return l1
;
920 while (tmp
.cdr
!== null) tmp
=tmp
.cdr
;
925 /*** META ((export #t)) */
926 function sc_appendBang() {
928 for (var i
= 0; i
< arguments
.length
; i
++)
929 res
= sc_dualAppendBang(res
, arguments
[i
]);
933 /*** META ((export #t)) */
934 function sc_reverse(l1
) {
936 while (l1
!== null) {
937 res
= sc_cons(l1
.car
, res
);
943 /*** META ((export #t)) */
944 function sc_reverseBang(l
) {
945 return sc_reverseAppendBang(l
, null);
948 /*** META ((export #t)) */
949 function sc_listTail(l
, k
) {
951 for (var i
= 0; i
< k
; i
++) {
957 /*** META ((export #t)) */
958 function sc_listRef(l
, k
) {
959 return sc_listTail(l
, k
).car
;
962 /* // unoptimized generic versions
963 function sc_memX(o, l, comp) {
971 function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); }
972 function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); }
973 function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); }
976 /* optimized versions */
977 /*** META ((export #t)) */
978 function sc_memq(o
, l
) {
986 /*** META ((export #t)) */
987 function sc_memv(o
, l
) {
995 /*** META ((export #t)) */
996 function sc_member(o
, l
) {
998 if (sc_isEqual(l
.car
,o
))
1005 /* // generic unoptimized versions
1006 function sc_assX(o, al, comp) {
1007 while (al != null) {
1008 if (comp(al.car.car, o))
1014 function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); }
1015 function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); }
1016 function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); }
1018 // optimized versions
1019 /*** META ((export #t)) */
1020 function sc_assq(o
, al
) {
1021 while (al
!== null) {
1022 if (al
.car
.car
=== o
)
1028 /*** META ((export #t)) */
1029 function sc_assv(o
, al
) {
1030 while (al
!== null) {
1031 if (al
.car
.car
=== o
)
1037 /*** META ((export #t)) */
1038 function sc_assoc(o
, al
) {
1039 while (al
!== null) {
1040 if (sc_isEqual(al
.car
.car
, o
))
1047 /* can be used for mutable strings and characters */
1048 function sc_isCharStringEqual(cs1
, cs2
) { return cs1
.val
=== cs2
.val
; }
1049 function sc_isCharStringLess(cs1
, cs2
) { return cs1
.val
< cs2
.val
; }
1050 function sc_isCharStringGreater(cs1
, cs2
) { return cs1
.val
> cs2
.val
; }
1051 function sc_isCharStringLessEqual(cs1
, cs2
) { return cs1
.val
<= cs2
.val
; }
1052 function sc_isCharStringGreaterEqual(cs1
, cs2
) { return cs1
.val
>= cs2
.val
; }
1053 function sc_isCharStringCIEqual(cs1
, cs2
)
1054 { return cs1
.val
.toLowerCase() === cs2
.val
.toLowerCase(); }
1055 function sc_isCharStringCILess(cs1
, cs2
)
1056 { return cs1
.val
.toLowerCase() < cs2
.val
.toLowerCase(); }
1057 function sc_isCharStringCIGreater(cs1
, cs2
)
1058 { return cs1
.val
.toLowerCase() > cs2
.val
.toLowerCase(); }
1059 function sc_isCharStringCILessEqual(cs1
, cs2
)
1060 { return cs1
.val
.toLowerCase() <= cs2
.val
.toLowerCase(); }
1061 function sc_isCharStringCIGreaterEqual(cs1
, cs2
)
1062 { return cs1
.val
.toLowerCase() >= cs2
.val
.toLowerCase(); }
1067 function sc_Char(c
) {
1068 var cached
= sc_Char
.lazy
[c
];
1072 sc_Char
.lazy
[c
] = this;
1073 // add return, so FF does not complain.
1076 sc_Char
.lazy
= new Object();
1078 sc_Char
.char2readable
= {
1081 "\010": "#\\backspace",
1083 "\012": "#\\newline",
1085 "\015": "#\\return",
1086 "\033": "#\\escape",
1088 "\177": "#\\delete",
1090 /* poeticless names */
1120 sc_Char
.readable2char
= {
1123 "backspace": "\010",
1165 sc_Char
.prototype.toString = function() {
1168 // sc_toDisplayString == toString
1169 sc_Char
.prototype.sc_toWriteString = function() {
1170 var entry
= sc_Char
.char2readable
[this.val
];
1174 return "#\\" + this.val
;
1177 /*** META ((export #t)
1179 (peephole (postfix "instanceof sc_Char")))
1181 function sc_isChar(c
) {
1182 return (c
instanceof sc_Char
);
1185 /*** META ((export char=?)
1187 (peephole (hole 2 c1 ".val === " c2 ".val")))
1189 var sc_isCharEqual
= sc_isCharStringEqual
;
1190 /*** META ((export char<?)
1192 (peephole (hole 2 c1 ".val < " c2 ".val")))
1194 var sc_isCharLess
= sc_isCharStringLess
;
1195 /*** META ((export char>?)
1197 (peephole (hole 2 c1 ".val > " c2 ".val")))
1199 var sc_isCharGreater
= sc_isCharStringGreater
;
1200 /*** META ((export char<=?)
1202 (peephole (hole 2 c1 ".val <= " c2 ".val")))
1204 var sc_isCharLessEqual
= sc_isCharStringLessEqual
;
1205 /*** META ((export char>=?)
1207 (peephole (hole 2 c1 ".val >= " c2 ".val")))
1209 var sc_isCharGreaterEqual
= sc_isCharStringGreaterEqual
;
1210 /*** META ((export char-ci=?)
1212 (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()")))
1214 var sc_isCharCIEqual
= sc_isCharStringCIEqual
;
1215 /*** META ((export char-ci<?)
1217 (peephole (hole 2 c1 ".val.toLowerCase() < " c2 ".val.toLowerCase()")))
1219 var sc_isCharCILess
= sc_isCharStringCILess
;
1220 /*** META ((export char-ci>?)
1222 (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()")))
1224 var sc_isCharCIGreater
= sc_isCharStringCIGreater
;
1225 /*** META ((export char-ci<=?)
1227 (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()")))
1229 var sc_isCharCILessEqual
= sc_isCharStringCILessEqual
;
1230 /*** META ((export char-ci>=?)
1232 (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()")))
1234 var sc_isCharCIGreaterEqual
= sc_isCharStringCIGreaterEqual
;
1236 var SC_NUMBER_CLASS
= "0123456789";
1237 var SC_WHITESPACE_CLASS
= ' \r\n\t\f';
1238 var SC_LOWER_CLASS
= 'abcdefghijklmnopqrstuvwxyz';
1239 var SC_UPPER_CLASS
= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
1241 function sc_isCharOfClass(c
, cl
) { return (cl
.indexOf(c
) != -1); }
1242 /*** META ((export #t)
1245 function sc_isCharAlphabetic(c
)
1246 { return sc_isCharOfClass(c
.val
, SC_LOWER_CLASS
) ||
1247 sc_isCharOfClass(c
.val
, SC_UPPER_CLASS
); }
1248 /*** META ((export #t)
1250 (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1")))
1252 function sc_isCharNumeric(c
)
1253 { return sc_isCharOfClass(c
.val
, SC_NUMBER_CLASS
); }
1254 /*** META ((export #t)
1257 function sc_isCharWhitespace(c
) {
1259 return tmp
=== " " || tmp
=== "\r" || tmp
=== "\n" || tmp
=== "\t" || tmp
=== "\f";
1261 /*** META ((export #t)
1263 (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1")))
1265 function sc_isCharUpperCase(c
)
1266 { return sc_isCharOfClass(c
.val
, SC_UPPER_CLASS
); }
1267 /*** META ((export #t)
1269 (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1")))
1271 function sc_isCharLowerCase(c
)
1272 { return sc_isCharOfClass(c
.val
, SC_LOWER_CLASS
); }
1274 /*** META ((export #t)
1275 (peephole (postfix ".val.charCodeAt(0)")))
1277 function sc_char2integer(c
)
1278 { return c
.val
.charCodeAt(0); }
1279 /*** META ((export #t)
1280 (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))")))
1282 function sc_integer2char(n
)
1283 { return new sc_Char(String
.fromCharCode(n
)); }
1285 /*** META ((export #t)
1286 (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())")))
1288 function sc_charUpcase(c
)
1289 { return new sc_Char(c
.val
.toUpperCase()); }
1290 /*** META ((export #t)
1291 (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())")))
1293 function sc_charDowncase(c
)
1294 { return new sc_Char(c
.val
.toLowerCase()); }
1296 function sc_makeJSStringOfLength(k
, c
) {
1298 if (c
=== undefined)
1304 // every round doubles the size of fill.
1307 res
= res
.concat(fill
);
1308 fill
= fill
.concat(fill
);
1314 function sc_makejsString(k
, c
) {
1320 return sc_makeJSStringOfLength(k
, fill
);
1323 function sc_jsstring2list(s
) {
1325 for (var i
= s
.length
- 1; i
>= 0; i
--)
1326 res
= sc_cons(new sc_Char(s
.charAt(i
)), res
);
1330 function sc_list2jsstring(l
) {
1331 var a
= new Array();
1336 return "".concat
.apply("", a
);
1339 var sc_Vector
= Array
;
1341 sc_Vector
.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay
) {
1342 if (this.length
=== 0) return "#()";
1344 var res
= "#(" + writeOrDisplay(this[0]);
1345 for (var i
= 1; i
< this.length
; i
++)
1346 res
+= " " + writeOrDisplay(this[i
]);
1350 sc_Vector
.prototype.sc_toDisplayString = function() {
1351 return this.sc_toWriteOrDisplayString(sc_toDisplayString
);
1353 sc_Vector
.prototype.sc_toWriteString = function() {
1354 return this.sc_toWriteOrDisplayString(sc_toWriteString
);
1357 /*** META ((export vector? array?)
1359 (peephole (postfix " instanceof sc_Vector")))
1361 function sc_isVector(v
) {
1362 return (v
instanceof sc_Vector
);
1365 // only applies to vectors
1366 function sc_isVectorEqual(v1
, v2
, comp
) {
1367 if (v1
.length
!== v2
.length
) return false;
1368 for (var i
= 0; i
< v1
.length
; i
++)
1369 if (!comp(v1
[i
], v2
[i
])) return false;
1373 /*** META ((export make-vector make-array)) */
1374 function sc_makeVector(size
, fill
) {
1375 var a
= new sc_Vector(size
);
1376 if (fill
!== undefined)
1377 sc_vectorFillBang(a
, fill
);
1381 /*** META ((export vector array)
1382 (peephole (vector)))
1384 function sc_vector() {
1385 var a
= new sc_Vector();
1386 for (var i
= 0; i
< arguments
.length
; i
++)
1387 a
.push(arguments
[i
]);
1391 /*** META ((export vector-length array-length)
1392 (peephole (postfix ".length")))
1394 function sc_vectorLength(v
) {
1398 /*** META ((export vector-ref array-ref)
1399 (peephole (hole 2 v "[" pos "]")))
1401 function sc_vectorRef(v
, pos
) {
1405 /*** META ((export vector-set! array-set!)
1406 (peephole (hole 3 v "[" pos "] = " val)))
1408 function sc_vectorSetBang(v
, pos
, val
) {
1412 /*** META ((export vector->list array->list)) */
1413 function sc_vector2list(a
) {
1415 for (var i
= a
.length
-1; i
>= 0; i
--)
1416 res
= sc_cons(a
[i
], res
);
1420 /*** META ((export list->vector list->array)) */
1421 function sc_list2vector(l
) {
1422 var a
= new sc_Vector();
1430 /*** META ((export vector-fill! array-fill!)) */
1431 function sc_vectorFillBang(a
, fill
) {
1432 for (var i
= 0; i
< a
.length
; i
++)
1437 /*** META ((export #t)) */
1438 function sc_copyVector(a
, len
) {
1439 if (len
<= a
.length
)
1440 return a
.slice(0, len
);
1442 var tmp
= a
.concat();
1448 /*** META ((export #t)
1449 (peephole (hole 3 a ".slice(" start "," end ")")))
1451 function sc_vectorCopy(a
, start
, end
) {
1452 return a
.slice(start
, end
);
1455 /*** META ((export #t)) */
1456 function sc_vectorCopyBang(target
, tstart
, source
, sstart
, send
) {
1457 if (!sstart
) sstart
= 0;
1458 if (!send
) send
= source
.length
;
1460 // if target == source we don't want to overwrite not yet copied elements.
1461 if (tstart
<= sstart
) {
1462 for (var i
= tstart
, j
= sstart
; j
< send
; i
++, j
++) {
1463 target
[i
] = source
[j
];
1466 var diff
= send
- sstart
;
1467 for (var i
= tstart
+ diff
- 1, j
= send
- 1;
1470 target
[i
] = source
[j
];
1476 /*** META ((export #t)
1478 (peephole (hole 1 "typeof " o " === 'function'")))
1480 function sc_isProcedure(o
) {
1481 return (typeof o
=== "function");
1484 /*** META ((export #t)) */
1485 function sc_apply(proc
) {
1486 var args
= new Array();
1487 // first part of arguments are not in list-form.
1488 for (var i
= 1; i
< arguments
.length
- 1; i
++)
1489 args
.push(arguments
[i
]);
1490 var l
= arguments
[arguments
.length
- 1];
1491 while (l
!== null) {
1495 return proc
.apply(null, args
);
1498 /*** META ((export #t)) */
1499 function sc_map(proc
, l1
) {
1500 if (l1
=== undefined)
1503 var nbApplyArgs
= arguments
.length
- 1;
1504 var applyArgs
= new Array(nbApplyArgs
);
1506 while (l1
!== null) {
1507 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1508 applyArgs
[i
] = arguments
[i
+ 1].car
;
1509 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1511 revres
= sc_cons(proc
.apply(null, applyArgs
), revres
);
1513 return sc_reverseAppendBang(revres
, null);
1516 /*** META ((export #t)) */
1517 function sc_mapBang(proc
, l1
) {
1518 if (l1
=== undefined)
1522 var nbApplyArgs
= arguments
.length
- 1;
1523 var applyArgs
= new Array(nbApplyArgs
);
1524 while (l1
!== null) {
1526 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1527 applyArgs
[i
] = arguments
[i
+ 1].car
;
1528 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1530 tmp
.car
= proc
.apply(null, applyArgs
);
1535 /*** META ((export #t)) */
1536 function sc_forEach(proc
, l1
) {
1537 if (l1
=== undefined)
1540 var nbApplyArgs
= arguments
.length
- 1;
1541 var applyArgs
= new Array(nbApplyArgs
);
1542 while (l1
!== null) {
1543 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1544 applyArgs
[i
] = arguments
[i
+ 1].car
;
1545 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1547 proc
.apply(null, applyArgs
);
1549 // add return so FF does not complain.
1553 /*** META ((export #t)) */
1554 function sc_filter(proc
, l1
) {
1555 var dummy
= { cdr
: null };
1557 while (l1
!== null) {
1558 if (proc(l1
.car
) !== false) {
1559 tail
.cdr
= sc_cons(l1
.car
, null);
1567 /*** META ((export #t)) */
1568 function sc_filterBang(proc
, l1
) {
1569 var head
= sc_cons("dummy", l1
);
1572 while (next
!== null) {
1573 if (proc(next
.car
) !== false) {
1583 function sc_filterMap1(proc
, l1
) {
1585 while (l1
!== null) {
1586 var tmp
= proc(l1
.car
)
1587 if (tmp
!== false) revres
= sc_cons(tmp
, revres
);
1590 return sc_reverseAppendBang(revres
, null);
1592 function sc_filterMap2(proc
, l1
, l2
) {
1594 while (l1
!== null) {
1595 var tmp
= proc(l1
.car
, l2
.car
);
1596 if(tmp
!== false) revres
= sc_cons(tmp
, revres
);
1600 return sc_reverseAppendBang(revres
, null);
1603 /*** META ((export #t)) */
1604 function sc_filterMap(proc
, l1
, l2
, l3
) {
1605 if (l2
=== undefined)
1606 return sc_filterMap1(proc
, l1
);
1607 else if (l3
=== undefined)
1608 return sc_filterMap2(proc
, l1
, l2
);
1610 var nbApplyArgs
= arguments
.length
- 1;
1611 var applyArgs
= new Array(nbApplyArgs
);
1613 while (l1
!== null) {
1614 for (var i
= 0; i
< nbApplyArgs
; i
++) {
1615 applyArgs
[i
] = arguments
[i
+ 1].car
;
1616 arguments
[i
+ 1] = arguments
[i
+ 1].cdr
;
1618 var tmp
= proc
.apply(null, applyArgs
);
1619 if(tmp
!== false) revres
= sc_cons(tmp
, revres
);
1621 return sc_reverseAppendBang(revres
, null);
1624 /*** META ((export #t)) */
1625 function sc_any(proc
, l
) {
1627 while (l
!== null) {
1628 var tmp
= proc(l
.car
);
1629 if(tmp
!== false) return tmp
;
1635 /*** META ((export any?)
1636 (peephole (hole 2 "sc_any(" proc "," l ") !== false")))
1638 function sc_anyPred(proc
, l
) {
1639 return sc_any(proc
, l
)!== false;
1642 /*** META ((export #t)) */
1643 function sc_every(proc
, l
) {
1646 while (l
!== null) {
1648 if (tmp
=== false) return false;
1654 /*** META ((export every?)
1655 (peephole (hole 2 "sc_every(" proc "," l ") !== false")))
1657 function sc_everyPred(proc
, l
) {
1658 var tmp
= sc_every(proc
, l
);
1659 if (tmp
!== false) return true;
1663 /*** META ((export #t)
1664 (peephole (postfix "()")))
1666 function sc_force(o
) {
1670 /*** META ((export #t)) */
1671 function sc_makePromise(proc
) {
1672 var isResultReady
= false;
1673 var result
= undefined;
1675 if (!isResultReady
) {
1677 if (!isResultReady
) {
1678 isResultReady
= true;
1686 function sc_Values(values
) {
1687 this.values
= values
;
1690 /*** META ((export #t)
1691 (peephole (values)))
1693 function sc_values() {
1694 if (arguments
.length
=== 1)
1695 return arguments
[0];
1697 return new sc_Values(arguments
);
1700 /*** META ((export #t)) */
1701 function sc_callWithValues(producer
, consumer
) {
1702 var produced
= producer();
1703 if (produced
instanceof sc_Values
)
1704 return consumer
.apply(null, produced
.values
);
1706 return consumer(produced
);
1709 /*** META ((export #t)) */
1710 function sc_dynamicWind(before
, thunk
, after
) {
1721 // TODO: eval/scheme-report-environment/null-environment/interaction-environment
1723 // LIMITATION: 'load' doesn't exist without files.
1724 // LIMITATION: transcript-on/transcript-off doesn't exist without files.
1727 function sc_Struct(name
) {
1730 sc_Struct
.prototype.sc_toDisplayString = function() {
1731 return "#<struct" + sc_hash(this) + ">";
1733 sc_Struct
.prototype.sc_toWriteString
= sc_Struct
.prototype.sc_toDisplayString
;
1735 /*** META ((export #t)
1736 (peephole (hole 1 "new sc_Struct(" name ")")))
1738 function sc_makeStruct(name
) {
1739 return new sc_Struct(name
);
1742 /*** META ((export #t)
1744 (peephole (postfix " instanceof sc_Struct")))
1746 function sc_isStruct(o
) {
1747 return (o
instanceof sc_Struct
);
1750 /*** META ((export #t)
1752 (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")")))
1754 function sc_isStructNamed(name
, s
) {
1755 return ((s
instanceof sc_Struct
) && (s
.name
=== name
));
1758 /*** META ((export struct-field)
1759 (peephole (hole 3 0 "[" 2 "]")))
1761 function sc_getStructField(s
, name
, field
) {
1765 /*** META ((export struct-field-set!)
1766 (peephole (hole 4 0 "[" 2 "] = " 3)))
1768 function sc_setStructFieldBang(s
, name
, field
, val
) {
1772 /*** META ((export #t)
1773 (peephole (prefix "~")))
1775 function sc_bitNot(x
) {
1779 /*** META ((export #t)
1780 (peephole (infix 2 2 "&")))
1782 function sc_bitAnd(x
, y
) {
1786 /*** META ((export #t)
1787 (peephole (infix 2 2 "|")))
1789 function sc_bitOr(x
, y
) {
1793 /*** META ((export #t)
1794 (peephole (infix 2 2 "^")))
1796 function sc_bitXor(x
, y
) {
1800 /*** META ((export #t)
1801 (peephole (infix 2 2 "<<")))
1803 function sc_bitLsh(x
, y
) {
1807 /*** META ((export #t)
1808 (peephole (infix 2 2 ">>")))
1810 function sc_bitRsh(x
, y
) {
1814 /*** META ((export #t)
1815 (peephole (infix 2 2 ">>>")))
1817 function sc_bitUrsh(x
, y
) {
1821 /*** META ((export js-field js-property)
1822 (peephole (hole 2 o "[" field "]")))
1824 function sc_jsField(o
, field
) {
1828 /*** META ((export js-field-set! js-property-set!)
1829 (peephole (hole 3 o "[" field "] = " val)))
1831 function sc_setJsFieldBang(o
, field
, val
) {
1832 return o
[field
] = val
;
1835 /*** META ((export js-field-delete! js-property-delete!)
1836 (peephole (hole 2 "delete" o "[" field "]")))
1838 function sc_deleteJsFieldBang(o
, field
) {
1842 /*** META ((export #t)
1843 (peephole (jsCall)))
1845 function sc_jsCall(o
, fun
) {
1846 var args
= new Array();
1847 for (var i
= 2; i
< arguments
.length
; i
++)
1848 args
[i
-2] = arguments
[i
];
1849 return fun
.apply(o
, args
);
1852 /*** META ((export #t)
1853 (peephole (jsMethodCall)))
1855 function sc_jsMethodCall(o
, field
) {
1856 var args
= new Array();
1857 for (var i
= 2; i
< arguments
.length
; i
++)
1858 args
[i
-2] = arguments
[i
];
1859 return o
[field
].apply(o
, args
);
1862 /*** META ((export new js-new)
1865 function sc_jsNew(c
) {
1866 var evalStr
= "new c(";
1867 evalStr
+=arguments
.length
> 1? "arguments[1]": "";
1868 for (var i
= 2; i
< arguments
.length
; i
++)
1869 evalStr
+= ", arguments[" + i
+ "]";
1871 return eval(evalStr
);
1874 // ======================== RegExp ====================
1875 /*** META ((export #t)) */
1876 function sc_pregexp(re
) {
1877 return new RegExp(sc_string2jsstring(re
));
1880 /*** META ((export #t)) */
1881 function sc_pregexpMatch(re
, s
) {
1882 var reg
= (re
instanceof RegExp
) ? re
: sc_pregexp(re
);
1883 var tmp
= reg
.exec(sc_string2jsstring(s
));
1885 if (tmp
== null) return false;
1888 for (var i
= tmp
.length
-1; i
>= 0; i
--) {
1889 if (tmp
[i
] !== null) {
1890 res
= sc_cons(sc_jsstring2string(tmp
[i
]), res
);
1892 res
= sc_cons(false, res
);
1898 /*** META ((export #t)) */
1899 function sc_pregexpReplace(re
, s1
, s2
) {
1901 var jss1
= sc_string2jsstring(s1
);
1902 var jss2
= sc_string2jsstring(s2
);
1904 if (re
instanceof RegExp
) {
1908 reg
= new RegExp(re
.source
);
1910 reg
= new RegExp(sc_string2jsstring(re
));
1913 return jss1
.replace(reg
, jss2
);
1916 /*** META ((export pregexp-replace*)) */
1917 function sc_pregexpReplaceAll(re
, s1
, s2
) {
1919 var jss1
= sc_string2jsstring(s1
);
1920 var jss2
= sc_string2jsstring(s2
);
1922 if (re
instanceof RegExp
) {
1926 reg
= new RegExp(re
.source
, "g");
1928 reg
= new RegExp(sc_string2jsstring(re
), "g");
1931 return jss1
.replace(reg
, jss2
);
1934 /*** META ((export #t)) */
1935 function sc_pregexpSplit(re
, s
) {
1936 var reg
= ((re
instanceof RegExp
) ?
1938 new RegExp(sc_string2jsstring(re
)));
1939 var jss
= sc_string2jsstring(s
);
1940 var tmp
= jss
.split(reg
);
1942 if (tmp
== null) return false;
1944 return sc_vector2list(tmp
);
1948 /* =========================================================================== */
1949 /* Other library stuff */
1950 /* =========================================================================== */
1952 /*** META ((export #t)
1953 (peephole (hole 1 "Math.floor(Math.random()*" 'n ")")))
1955 function sc_random(n
) {
1956 return Math
.floor(Math
.random()*n
);
1959 /*** META ((export current-date)
1960 (peephole (hole 0 "new Date()")))
1962 function sc_currentDate() {
1966 function sc_Hashtable() {
1968 sc_Hashtable
.prototype.toString = function() {
1969 return "#{%hashtable}";
1971 // sc_toWriteString == sc_toDisplayString == toString
1973 function sc_HashtableElement(key
, val
) {
1978 /*** META ((export #t)
1979 (peephole (hole 0 "new sc_Hashtable()")))
1981 function sc_makeHashtable() {
1982 return new sc_Hashtable();
1985 /*** META ((export #t)) */
1986 function sc_hashtablePutBang(ht
, key
, val
) {
1987 var hash
= sc_hash(key
);
1988 ht
[hash
] = new sc_HashtableElement(key
, val
);
1991 /*** META ((export #t)) */
1992 function sc_hashtableGet(ht
, key
) {
1993 var hash
= sc_hash(key
);
1995 return ht
[hash
].val
;
2000 /*** META ((export #t)) */
2001 function sc_hashtableForEach(ht
, f
) {
2003 if (ht
[v
] instanceof sc_HashtableElement
)
2004 f(ht
[v
].key
, ht
[v
].val
);
2008 /*** META ((export hashtable-contains?)
2009 (peephole (hole 2 "sc_hash(" 1 ") in " 0)))
2011 function sc_hashtableContains(ht
, key
) {
2012 var hash
= sc_hash(key
);
2019 var SC_HASH_COUNTER
= 0;
2021 function sc_hash(o
) {
2024 else if (o
=== undefined)
2026 else if (o
=== true)
2028 else if (o
=== false)
2030 else if (typeof o
=== "number")
2032 else if (typeof o
=== "string")
2033 return "jsstr-" + o
;
2034 else if (o
.sc_getHash
)
2035 return o
.sc_getHash();
2037 return sc_counterHash
.call(o
);
2039 function sc_counterHash() {
2040 if (!this.sc_hash
) {
2041 this.sc_hash
= "hash-" + SC_HASH_COUNTER
;
2044 return this.sc_hash
;
2047 function sc_Trampoline(args
, maxTailCalls
) {
2048 this['__trampoline return__'] = true;
2050 this.MAX_TAIL_CALLs
= maxTailCalls
;
2052 // TODO: call/cc stuff
2053 sc_Trampoline
.prototype.restart = function() {
2056 // set both globals.
2057 SC_TAIL_OBJECT
.calls
= o
.MAX_TAIL_CALLs
-1;
2058 var fun
= o
.args
.callee
;
2059 var res
= fun
.apply(SC_TAIL_OBJECT
, o
.args
);
2060 if (res
instanceof sc_Trampoline
)
2067 /*** META ((export bind-exit-lambda)) */
2068 function sc_bindExitLambda(proc
) {
2069 var escape_obj
= new sc_BindExitException();
2070 var escape = function(res
) {
2071 escape_obj
.res
= res
;
2075 return proc(escape
);
2077 if (e
=== escape_obj
) {
2083 function sc_BindExitException() {
2084 this._internalException
= true;
2087 var SC_SCM2JS_GLOBALS
= new Object();
2089 // default tail-call depth.
2090 // normally the program should set it again. but just in case...
2091 var SC_TAIL_OBJECT
= new Object();
2092 SC_SCM2JS_GLOBALS
.TAIL_OBJECT
= SC_TAIL_OBJECT
;
2093 // ======================== I/O =======================
2095 /*------------------------------------------------------------------*/
2099 var SC_EOF_OBJECT
= new sc_EOF();
2101 function sc_Port() {
2104 /* --------------- Input ports -------------------------------------*/
2106 function sc_InputPort() {
2108 sc_InputPort
.prototype = new sc_Port();
2110 sc_InputPort
.prototype.peekChar = function() {
2111 if (!("peeked" in this))
2112 this.peeked
= this.getNextChar();
2115 sc_InputPort
.prototype.readChar = function() {
2116 var tmp
= this.peekChar();
2120 sc_InputPort
.prototype.isCharReady = function() {
2123 sc_InputPort
.prototype.close = function() {
2127 /* .............. String port ..........................*/
2128 function sc_ErrorInputPort() {
2130 sc_ErrorInputPort
.prototype = new sc_InputPort();
2131 sc_ErrorInputPort
.prototype.getNextChar = function() {
2132 throw "can't read from error-port.";
2134 sc_ErrorInputPort
.prototype.isCharReady = function() {
2139 /* .............. String port ..........................*/
2141 function sc_StringInputPort(jsStr
) {
2142 // we are going to do some charAts on the str.
2143 // instead of recreating all the time a String-object, we
2144 // create one in the beginning. (not sure, if this is really an optim)
2145 this.str
= new String(jsStr
);
2148 sc_StringInputPort
.prototype = new sc_InputPort();
2149 sc_StringInputPort
.prototype.getNextChar = function() {
2150 if (this.pos
>= this.str
.length
)
2151 return SC_EOF_OBJECT
;
2152 return this.str
.charAt(this.pos
++);
2155 /* ------------- Read and other lib-funs -------------------------------*/
2156 function sc_Token(type
, val
, pos
) {
2161 sc_Token
.EOF
= 0/*EOF*/;
2162 sc_Token
.OPEN_PAR
= 1/*OPEN_PAR*/;
2163 sc_Token
.CLOSE_PAR
= 2/*CLOSE_PAR*/;
2164 sc_Token
.OPEN_BRACE
= 3/*OPEN_BRACE*/;
2165 sc_Token
.CLOSE_BRACE
= 4/*CLOSE_BRACE*/;
2166 sc_Token
.OPEN_BRACKET
= 5/*OPEN_BRACKET*/;
2167 sc_Token
.CLOSE_BRACKET
= 6/*CLOSE_BRACKET*/;
2168 sc_Token
.WHITESPACE
= 7/*WHITESPACE*/;
2169 sc_Token
.QUOTE
= 8/*QUOTE*/;
2170 sc_Token
.ID
= 9/*ID*/;
2171 sc_Token
.DOT
= 10/*DOT*/;
2172 sc_Token
.STRING
= 11/*STRING*/;
2173 sc_Token
.NUMBER
= 12/*NUMBER*/;
2174 sc_Token
.ERROR
= 13/*ERROR*/;
2175 sc_Token
.VECTOR_BEGIN
= 14/*VECTOR_BEGIN*/;
2176 sc_Token
.TRUE
= 15/*TRUE*/;
2177 sc_Token
.FALSE
= 16/*FALSE*/;
2178 sc_Token
.UNSPECIFIED
= 17/*UNSPECIFIED*/;
2179 sc_Token
.REFERENCE
= 18/*REFERENCE*/;
2180 sc_Token
.STORE
= 19/*STORE*/;
2181 sc_Token
.CHAR
= 20/*CHAR*/;
2183 var SC_ID_CLASS
= SC_LOWER_CLASS
+ SC_UPPER_CLASS
+ "!$%*+-./:<=>?@^_~";
2184 function sc_Tokenizer(port
) {
2187 sc_Tokenizer
.prototype.peekToken = function() {
2190 var newToken
= this.nextToken();
2191 this.peeked
= newToken
;
2194 sc_Tokenizer
.prototype.readToken = function() {
2195 var tmp
= this.peekToken();
2199 sc_Tokenizer
.prototype.nextToken = function() {
2200 var port
= this.port
;
2202 function isNumberChar(c
) {
2203 return (c
>= "0" && c
<= "9");
2205 function isIdOrNumberChar(c
) {
2206 return SC_ID_CLASS
.indexOf(c
) != -1 || // ID-char
2207 (c
>= "0" && c
<= "9");
2209 function isWhitespace(c
) {
2210 return c
=== " " || c
=== "\r" || c
=== "\n" || c
=== "\t" || c
=== "\f";
2212 function isWhitespaceOrEOF(c
) {
2213 return isWhitespace(c
) || c
=== SC_EOF_OBJECT
;
2216 function readString() {
2219 var c
= port
.readChar();
2222 return new sc_Token(11/*STRING*/, res
);
2224 var tmp
= port
.readChar();
2226 case '0': res
+= "\0"; break;
2227 case 'a': res
+= "\a"; break;
2228 case 'b': res
+= "\b"; break;
2229 case 'f': res
+= "\f"; break;
2230 case 'n': res
+= "\n"; break;
2231 case 'r': res
+= "\r"; break;
2232 case 't': res
+= "\t"; break;
2233 case 'v': res
+= "\v"; break;
2234 case '"': res
+= '"'; break;
2235 case '\\': res
+= '\\'; break;
2240 var hexC
= port
.peekChar();
2241 if (hexC
>= '0' && hexC
<= '9') {
2243 nb
= nb
* 16 + hexC
.charCodeAt(0) - '0'.charCodeAt(0);
2244 } else if (hexC
>= 'a' && hexC
<= 'f') {
2246 nb
= nb
* 16 + hexC
.charCodeAt(0) - 'a'.charCodeAt(0);
2247 } else if (hexC
>= 'A' && hexC
<= 'F') {
2249 nb
= nb
* 16 + hexC
.charCodeAt(0) - 'A'.charCodeAt(0);
2251 // next char isn't part of hex.
2252 res
+= String
.fromCharCode(nb
);
2258 if (tmp
=== SC_EOF_OBJECT
) {
2259 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res
);
2265 if (c
=== SC_EOF_OBJECT
) {
2266 return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res
);
2272 function readIdOrNumber(firstChar
) {
2273 var res
= firstChar
;
2274 while (isIdOrNumberChar(port
.peekChar()))
2275 res
+= port
.readChar();
2277 return new sc_Token(9/*ID*/, res
);
2279 return new sc_Token(12/*NUMBER*/, res
- 0);
2282 function skipWhitespaceAndComments() {
2286 while (isWhitespace(port
.peekChar()))
2288 if (port
.peekChar() === ';') {
2292 curChar
= port
.readChar();
2293 if (curChar
=== SC_EOF_OBJECT
||
2301 function readDot() {
2302 if (isWhitespace(port
.peekChar()))
2303 return new sc_Token(10/*DOT*/);
2305 return readIdOrNumber(".");
2308 function readSharp() {
2309 var c
= port
.readChar();
2310 if (isWhitespace(c
))
2311 return new sc_Token(13/*ERROR*/, "bad #-pattern0.");
2314 if (isNumberChar(c
)) {
2316 while (isNumberChar(port
.peekChar()))
2317 nb
= nb
*10 + (port
.readChar() - 0);
2318 switch (port
.readChar()) {
2320 return new sc_Token(18/*REFERENCE*/, nb
);
2322 return new sc_Token(19/*STORE*/, nb
);
2324 return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb
);
2329 return new sc_Token(14/*VECTOR_BEGIN*/);
2331 if (c
=== "\\") { // character
2333 while (!isWhitespaceOrEOF(port
.peekChar()))
2334 tmp
+= port
.readChar();
2335 switch (tmp
.length
) {
2336 case 0: // it's escaping a whitespace char:
2337 if (sc_isEOFObject(port
.peekChar
))
2338 return new sc_Token(13/*ERROR*/, "bad #-pattern2.");
2340 return new sc_Token(20/*CHAR*/, port
.readChar());
2342 return new sc_Token(20/*CHAR*/, tmp
);
2344 var entry
= sc_Char
.readable2char
[tmp
.toLowerCase()];
2346 return new sc_Token(20/*CHAR*/, entry
);
2348 return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp
);
2352 // some constants (#t, #f, #unspecified)
2356 case 't': res
= new sc_Token(15/*TRUE*/, true); needing
= ""; break;
2357 case 'f': res
= new sc_Token(16/*FALSE*/, false); needing
= ""; break;
2358 case 'u': res
= new sc_Token(17/*UNSPECIFIED*/, undefined); needing
= "nspecified"; break;
2360 return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c
);
2363 c
= port
.peekChar();
2364 if ((isWhitespaceOrEOF(c
) || c
=== ')') &&
2367 else if (isWhitespace(c
) || needing
== "")
2368 return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c
+ " " + needing
);
2369 else if (needing
.charAt(0) == c
) {
2370 port
.readChar(); // consume
2371 needing
= needing
.slice(1);
2373 return new sc_Token(13/*ERROR*/, "bad #-pattern5");
2378 skipWhitespaceAndComments();
2379 var curChar
= port
.readChar();
2380 if (curChar
=== SC_EOF_OBJECT
)
2381 return new sc_Token(0/*EOF*/, curChar
);
2387 return readWhitespace();
2389 return new sc_Token(1/*OPEN_PAR*/);
2391 return new sc_Token(2/*CLOSE_PAR*/);
2393 return new sc_Token(3/*OPEN_BRACE*/);
2395 return new sc_Token(4/*CLOSE_BRACE*/);
2397 return new sc_Token(5/*OPEN_BRACKET*/);
2399 return new sc_Token(6/*CLOSE_BRACKET*/);
2401 return new sc_Token(8/*QUOTE*/);
2407 return readString();
2409 if (isIdOrNumberChar(curChar
))
2410 return readIdOrNumber(curChar
);
2411 throw "unexpected character: " + curChar
;
2415 function sc_Reader(tokenizer
) {
2416 this.tokenizer
= tokenizer
;
2417 this.backref
= new Array();
2419 sc_Reader
.prototype.read = function() {
2420 function readList(listBeginType
) {
2421 function matchesPeer(open
, close
) {
2422 return open
=== 1/*OPEN_PAR*/ && close
=== 2/*CLOSE_PAR*/
2423 || open
=== 3/*OPEN_BRACE*/ && close
=== 4/*CLOSE_BRACE*/
2424 || open
=== 5/*OPEN_BRACKET*/ && close
=== 6/*CLOSE_BRACKET*/;
2429 var token
= tokenizer
.peekToken();
2431 switch (token
.type
) {
2432 case 2/*CLOSE_PAR*/:
2433 case 4/*CLOSE_BRACE*/:
2434 case 6/*CLOSE_BRACKET*/:
2435 if (matchesPeer(listBeginType
, token
.type
)) {
2436 tokenizer
.readToken(); // consume token
2437 return sc_reverseBang(res
);
2439 throw "closing par doesn't match: " + listBeginType
2440 + " " + listEndType
;
2443 throw "unexpected end of file";
2446 tokenizer
.readToken(); // consume token
2447 var cdr
= this.read();
2448 var par
= tokenizer
.readToken();
2449 if (!matchesPeer(listBeginType
, par
.type
))
2450 throw "closing par doesn't match: " + listBeginType
2453 return sc_reverseAppendBang(res
, cdr
);
2457 res
= sc_cons(this.read(), res
);
2461 function readQuote() {
2462 return sc_cons("quote", sc_cons(this.read(), null));
2464 function readVector() {
2465 // opening-parenthesis is already consumed
2466 var a
= new Array();
2468 var token
= tokenizer
.peekToken();
2469 switch (token
.type
) {
2470 case 2/*CLOSE_PAR*/:
2471 tokenizer
.readToken();
2475 a
.push(this.read());
2480 function storeRefence(nb
) {
2481 var tmp
= this.read();
2482 this.backref
[nb
] = tmp
;
2486 function readReference(nb
) {
2487 if (nb
in this.backref
)
2488 return this.backref
[nb
];
2490 throw "bad reference: " + nb
;
2493 var tokenizer
= this.tokenizer
;
2495 var token
= tokenizer
.readToken();
2498 if (token
.type
=== 13/*ERROR*/)
2501 switch (token
.type
) {
2503 case 3/*OPEN_BRACE*/:
2504 case 5/*OPEN_BRACKET*/:
2505 return readList
.call(this, token
.type
);
2507 return readQuote
.call(this);
2509 return sc_jsstring2string(token
.val
);
2511 return new sc_Char(token
.val
);
2512 case 14/*VECTOR_BEGIN*/:
2513 return readVector
.call(this);
2514 case 18/*REFERENCE*/:
2515 return readReference
.call(this, token
.val
);
2517 return storeRefence
.call(this, token
.val
);
2519 return sc_jsstring2symbol(token
.val
);
2524 case 17/*UNSPECIFIED*/:
2527 throw "unexpected token " + token
.type
+ " " + token
.val
;
2531 /*** META ((export #t)) */
2532 function sc_read(port
) {
2533 if (port
=== undefined) // we assume the port hasn't been given.
2534 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2535 var reader
= new sc_Reader(new sc_Tokenizer(port
));
2536 return reader
.read();
2538 /*** META ((export #t)) */
2539 function sc_readChar(port
) {
2540 if (port
=== undefined) // we assume the port hasn't been given.
2541 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2542 var t
= port
.readChar();
2543 return t
=== SC_EOF_OBJECT
? t
: new sc_Char(t
);
2545 /*** META ((export #t)) */
2546 function sc_peekChar(port
) {
2547 if (port
=== undefined) // we assume the port hasn't been given.
2548 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2549 var t
= port
.peekChar();
2550 return t
=== SC_EOF_OBJECT
? t
: new sc_Char(t
);
2552 /*** META ((export #t)
2555 function sc_isCharReady(port
) {
2556 if (port
=== undefined) // we assume the port hasn't been given.
2557 port
= SC_DEFAULT_IN
; // THREAD: shared var...
2558 return port
.isCharReady();
2560 /*** META ((export #t)
2561 (peephole (postfix ".close()")))
2563 function sc_closeInputPort(p
) {
2567 /*** META ((export #t)
2569 (peephole (postfix " instanceof sc_InputPort")))
2571 function sc_isInputPort(o
) {
2572 return (o
instanceof sc_InputPort
);
2575 /*** META ((export eof-object?)
2577 (peephole (postfix " === SC_EOF_OBJECT")))
2579 function sc_isEOFObject(o
) {
2580 return o
=== SC_EOF_OBJECT
;
2583 /*** META ((export #t)
2584 (peephole (hole 0 "SC_DEFAULT_IN")))
2586 function sc_currentInputPort() {
2587 return SC_DEFAULT_IN
;
2590 /* ------------ file operations are not supported -----------*/
2591 /*** META ((export #t)) */
2592 function sc_callWithInputFile(s
, proc
) {
2593 throw "can't open " + s
;
2596 /*** META ((export #t)) */
2597 function sc_callWithOutputFile(s
, proc
) {
2598 throw "can't open " + s
;
2601 /*** META ((export #t)) */
2602 function sc_withInputFromFile(s
, thunk
) {
2603 throw "can't open " + s
;
2606 /*** META ((export #t)) */
2607 function sc_withOutputToFile(s
, thunk
) {
2608 throw "can't open " + s
;
2611 /*** META ((export #t)) */
2612 function sc_openInputFile(s
) {
2613 throw "can't open " + s
;
2616 /*** META ((export #t)) */
2617 function sc_openOutputFile(s
) {
2618 throw "can't open " + s
;
2621 /* ----------------------------------------------------------------------------*/
2622 /*** META ((export #t)) */
2623 function sc_basename(p
) {
2624 var i
= p
.lastIndexOf('/');
2627 return p
.substring(i
+ 1, p
.length
);
2632 /*** META ((export #t)) */
2633 function sc_dirname(p
) {
2634 var i
= p
.lastIndexOf('/');
2637 return p
.substring(0, i
);
2642 /* ----------------------------------------------------------------------------*/
2644 /*** META ((export #t)) */
2645 function sc_withInputFromPort(p
, thunk
) {
2647 var tmp
= SC_DEFAULT_IN
; // THREAD: shared var.
2651 SC_DEFAULT_IN
= tmp
;
2655 /*** META ((export #t)) */
2656 function sc_withInputFromString(s
, thunk
) {
2657 return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s
)), thunk
);
2660 /*** META ((export #t)) */
2661 function sc_withOutputToPort(p
, thunk
) {
2663 var tmp
= SC_DEFAULT_OUT
; // THREAD: shared var.
2667 SC_DEFAULT_OUT
= tmp
;
2671 /*** META ((export #t)) */
2672 function sc_withOutputToString(thunk
) {
2673 var p
= new sc_StringOutputPort();
2674 sc_withOutputToPort(p
, thunk
);
2678 /*** META ((export #t)) */
2679 function sc_withOutputToProcedure(proc
, thunk
) {
2680 var t = function(s
) { proc(sc_jsstring2string(s
)); };
2681 return sc_withOutputToPort(new sc_GenericOutputPort(t
), thunk
);
2684 /*** META ((export #t)
2685 (peephole (hole 0 "new sc_StringOutputPort()")))
2687 function sc_openOutputString() {
2688 return new sc_StringOutputPort();
2691 /*** META ((export #t)) */
2692 function sc_openInputString(str
) {
2693 return new sc_StringInputPort(sc_string2jsstring(str
));
2696 /* ----------------------------------------------------------------------------*/
2698 function sc_OutputPort() {
2700 sc_OutputPort
.prototype = new sc_Port();
2701 sc_OutputPort
.prototype.appendJSString = function(obj
) {
2704 sc_OutputPort
.prototype.close = function() {
2708 function sc_StringOutputPort() {
2711 sc_StringOutputPort
.prototype = new sc_OutputPort();
2712 sc_StringOutputPort
.prototype.appendJSString = function(s
) {
2715 sc_StringOutputPort
.prototype.close = function() {
2716 return sc_jsstring2string(this.res
);
2719 /*** META ((export #t)) */
2720 function sc_getOutputString(sp
) {
2721 return sc_jsstring2string(sp
.res
);
2725 function sc_ErrorOutputPort() {
2727 sc_ErrorOutputPort
.prototype = new sc_OutputPort();
2728 sc_ErrorOutputPort
.prototype.appendJSString = function(s
) {
2729 throw "don't write on ErrorPort!";
2731 sc_ErrorOutputPort
.prototype.close = function() {
2735 function sc_GenericOutputPort(appendJSString
, close
) {
2736 this.appendJSString
= appendJSString
;
2740 sc_GenericOutputPort
.prototype = new sc_OutputPort();
2742 /*** META ((export #t)
2744 (peephole (postfix " instanceof sc_OutputPort")))
2746 function sc_isOutputPort(o
) {
2747 return (o
instanceof sc_OutputPort
);
2750 /*** META ((export #t)
2751 (peephole (postfix ".close()")))
2753 function sc_closeOutputPort(p
) {
2757 /* ------------------ write ---------------------------------------------------*/
2759 /*** META ((export #t)) */
2760 function sc_write(o
, p
) {
2761 if (p
=== undefined) // we assume not given
2763 p
.appendJSString(sc_toWriteString(o
));
2766 function sc_toWriteString(o
) {
2769 else if (o
=== true)
2771 else if (o
=== false)
2773 else if (o
=== undefined)
2774 return "#unspecified";
2775 else if (typeof o
=== 'function')
2776 return "#<procedure " + sc_hash(o
) + ">";
2777 else if (o
.sc_toWriteString
)
2778 return o
.sc_toWriteString();
2780 return o
.toString();
2783 function sc_escapeWriteString(s
) {
2786 for (i
= 0; i
< s
.length
; i
++) {
2787 switch (s
.charAt(i
)) {
2788 case "\0": res
+= s
.substring(j
, i
) + "\\0"; j
= i
+ 1; break;
2789 case "\b": res
+= s
.substring(j
, i
) + "\\b"; j
= i
+ 1; break;
2790 case "\f": res
+= s
.substring(j
, i
) + "\\f"; j
= i
+ 1; break;
2791 case "\n": res
+= s
.substring(j
, i
) + "\\n"; j
= i
+ 1; break;
2792 case "\r": res
+= s
.substring(j
, i
) + "\\r"; j
= i
+ 1; break;
2793 case "\t": res
+= s
.substring(j
, i
) + "\\t"; j
= i
+ 1; break;
2794 case "\v": res
+= s
.substring(j
, i
) + "\\v"; j
= i
+ 1; break;
2795 case '"': res
+= s
.substring(j
, i
) + '\\"'; j
= i
+ 1; break;
2796 case "\\": res
+= s
.substring(j
, i
) + "\\\\"; j
= i
+ 1; break;
2798 var c
= s
.charAt(i
);
2799 if ("\a" !== "a" && c
== "\a") {
2800 res
+= s
.substring(j
, i
) + "\\a"; j
= i
+ 1; continue;
2802 if ("\v" !== "v" && c
== "\v") {
2803 res
+= s
.substring(j
, i
) + "\\v"; j
= i
+ 1; continue;
2805 //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) {
2806 // CARE: Manuel is this OK with HOP?
2807 if (s
.charAt(i
) < ' ') {
2808 /* non printable character and special chars */
2809 res
+= s
.substring(j
, i
) + "\\x" + s
.charCodeAt(i
).toString(16);
2812 // else just let i increase...
2815 res
+= s
.substring(j
, i
);
2819 /* ------------------ display ---------------------------------------------------*/
2821 /*** META ((export #t)) */
2822 function sc_display(o
, p
) {
2823 if (p
=== undefined) // we assume not given
2825 p
.appendJSString(sc_toDisplayString(o
));
2828 function sc_toDisplayString(o
) {
2831 else if (o
=== true)
2833 else if (o
=== false)
2835 else if (o
=== undefined)
2836 return "#unspecified";
2837 else if (typeof o
=== 'function')
2838 return "#<procedure " + sc_hash(o
) + ">";
2839 else if (o
.sc_toDisplayString
)
2840 return o
.sc_toDisplayString();
2842 return o
.toString();
2845 /* ------------------ newline ---------------------------------------------------*/
2847 /*** META ((export #t)) */
2848 function sc_newline(p
) {
2849 if (p
=== undefined) // we assume not given
2851 p
.appendJSString("\n");
2854 /* ------------------ write-char ---------------------------------------------------*/
2856 /*** META ((export #t)) */
2857 function sc_writeChar(c
, p
) {
2858 if (p
=== undefined) // we assume not given
2860 p
.appendJSString(c
.val
);
2863 /* ------------------ write-circle ---------------------------------------------------*/
2865 /*** META ((export #t)) */
2866 function sc_writeCircle(o
, p
) {
2867 if (p
=== undefined) // we assume not given
2869 p
.appendJSString(sc_toWriteCircleString(o
));
2872 function sc_toWriteCircleString(o
) {
2873 var symb
= sc_gensym("writeCircle");
2874 var nbPointer
= new Object();
2876 sc_prepWriteCircle(o
, symb
, nbPointer
);
2877 return sc_genToWriteCircleString(o
, symb
);
2880 function sc_prepWriteCircle(o
, symb
, nbPointer
) {
2882 if (o
instanceof sc_Pair
||
2883 o
instanceof sc_Vector
) {
2884 if (o
[symb
] !== undefined) {
2885 // not the first visit.
2887 // unless there is already a number, assign one.
2888 if (!o
[symb
+ "nb"]) o
[symb
+ "nb"] = nbPointer
.nb
++;
2892 if (o
instanceof sc_Pair
) {
2893 sc_prepWriteCircle(o
.car
, symb
, nbPointer
);
2894 sc_prepWriteCircle(o
.cdr
, symb
, nbPointer
);
2896 for (var i
= 0; i
< o
.length
; i
++)
2897 sc_prepWriteCircle(o
[i
], symb
, nbPointer
);
2902 function sc_genToWriteCircleString(o
, symb
) {
2903 if (!(o
instanceof sc_Pair
||
2904 o
instanceof sc_Vector
))
2905 return sc_toWriteString(o
);
2906 return o
.sc_toWriteCircleString(symb
);
2908 sc_Pair
.prototype.sc_toWriteCircleString = function(symb
, inList
) {
2909 if (this[symb
+ "use"]) { // use-flag is set. Just use it.
2910 var nb
= this[symb
+ "nb"];
2911 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2913 delete this[symb
+ "nb"];
2914 delete this[symb
+ "use"];
2917 return '. #' + nb
+ '#';
2919 return '#' + nb
+ '#';
2921 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2923 delete this[symb
+ "nb"];
2924 delete this[symb
+ "use"];
2929 if (this[symb
] !== undefined) { // implies > 0
2930 this[symb
+ "use"] = true;
2932 res
+= '. #' + this[symb
+ "nb"] + '=';
2934 res
+= '#' + this[symb
+ "nb"] + '=';
2942 res
+= sc_genToWriteCircleString(this.car
, symb
);
2944 if (sc_isPair(this.cdr
)) {
2945 res
+= " " + this.cdr
.sc_toWriteCircleString(symb
, true);
2946 } else if (this.cdr
!== null) {
2947 res
+= " . " + sc_genToWriteCircleString(this.cdr
, symb
);
2953 sc_Vector
.prototype.sc_toWriteCircleString = function(symb
) {
2954 if (this[symb
+ "use"]) { // use-flag is set. Just use it.
2955 var nb
= this[symb
+ "nb"];
2956 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2958 delete this[symb
+ "nb"];
2959 delete this[symb
+ "use"];
2961 return '#' + nb
+ '#';
2963 if (this[symb
]-- === 0) { // if we are the last use. remove all fields.
2965 delete this[symb
+ "nb"];
2966 delete this[symb
+ "use"];
2970 if (this[symb
] !== undefined) { // implies > 0
2971 this[symb
+ "use"] = true;
2972 res
+= '#' + this[symb
+ "nb"] + '=';
2975 for (var i
= 0; i
< this.length
; i
++) {
2976 res
+= sc_genToWriteCircleString(this[i
], symb
);
2977 if (i
< this.length
- 1) res
+= " ";
2984 /* ------------------ print ---------------------------------------------------*/
2986 /*** META ((export #t)) */
2987 function sc_print(s
) {
2988 if (arguments
.length
=== 1) {
2993 for (var i
= 0; i
< arguments
.length
; i
++)
2994 sc_display(arguments
[i
]);
2999 /* ------------------ format ---------------------------------------------------*/
3000 /*** META ((export #t)) */
3001 function sc_format(s
, args
) {
3003 var p
= new sc_StringOutputPort();
3007 var i2
= s
.indexOf("~", i
);
3010 p
.appendJSString( s
.substring( i
, len
) );
3014 if (i2
== (len
- 1)) {
3015 p
.appendJSString(s
.substring(i
, len
));
3018 p
.appendJSString(s
.substring(i
, i2
));
3023 switch(s
.charCodeAt(i2
+ 1)) {
3027 sc_display(arguments
[j
], p
);
3034 sc_write(arguments
[j
], p
);
3041 sc_display(arguments
[j
], p
);
3042 p
.appendJSString("\n");
3049 p
.appendJSString(String
.fromCharCode(arguments
[j
]));
3056 p
.appendJSString(arguments
[j
].toString(6));
3063 p
.appendJSString(arguments
[j
].toString(8));
3070 p
.appendJSString(arguments
[j
].toString(2));
3077 p
.appendJSString("\n");
3082 p
.appendJSString("\r");
3087 p
.appendJSString("~");
3091 sc_error( "format: illegal ~"
3092 + String
.fromCharCode(s
.charCodeAt(i2
+ 1))
3102 /* ------------------ global ports ---------------------------------------------------*/
3104 var SC_DEFAULT_IN
= new sc_ErrorInputPort();
3105 var SC_DEFAULT_OUT
= new sc_ErrorOutputPort();
3106 var SC_ERROR_OUT
= new sc_ErrorOutputPort();
3108 var sc_SYMBOL_PREFIX
= "\u1E9C";
3109 var sc_KEYWORD_PREFIX
= "\u1E9D";
3111 /*** META ((export #t)
3113 function sc_jsstring2string(s
) {
3117 /*** META ((export #t)
3118 (peephole (prefix "'\\u1E9C' +")))
3120 function sc_jsstring2symbol(s
) {
3121 return sc_SYMBOL_PREFIX
+ s
;
3124 /*** META ((export #t)
3127 function sc_string2jsstring(s
) {
3131 /*** META ((export #t)
3132 (peephole (symbol2jsstring_immutable)))
3134 function sc_symbol2jsstring(s
) {
3138 /*** META ((export #t)
3139 (peephole (postfix ".slice(1)")))
3141 function sc_keyword2jsstring(k
) {
3145 /*** META ((export #t)
3146 (peephole (prefix "'\\u1E9D' +")))
3148 function sc_jsstring2keyword(s
) {
3149 return sc_KEYWORD_PREFIX
+ s
;
3152 /*** META ((export #t)
3155 function sc_isKeyword(s
) {
3156 return (typeof s
=== "string") &&
3157 (s
.charAt(0) === sc_KEYWORD_PREFIX
);
3161 /*** META ((export #t)) */
3162 var sc_gensym = function() {
3164 return function(sym
) {
3166 if (!sym
) sym
= sc_SYMBOL_PREFIX
;
3167 return sym
+ "s" + counter
+ "~" + "^sC-GeNsYm ";
3172 /*** META ((export #t)
3175 function sc_isEqual(o1
, o2
) {
3176 return ((o1
=== o2
) ||
3177 (sc_isPair(o1
) && sc_isPair(o2
)
3178 && sc_isPairEqual(o1
, o2
, sc_isEqual
)) ||
3179 (sc_isVector(o1
) && sc_isVector(o2
)
3180 && sc_isVectorEqual(o1
, o2
, sc_isEqual
)));
3183 /*** META ((export number->symbol integer->symbol)) */
3184 function sc_number2symbol(x
, radix
) {
3185 return sc_SYMBOL_PREFIX
+ sc_number2jsstring(x
, radix
);
3188 /*** META ((export number->string integer->string)) */
3189 var sc_number2string
= sc_number2jsstring
;
3191 /*** META ((export #t)) */
3192 function sc_symbol2number(s
, radix
) {
3193 return sc_jsstring2number(s
.slice(1), radix
);
3196 /*** META ((export #t)) */
3197 var sc_string2number
= sc_jsstring2number
;
3199 /*** META ((export #t)
3200 (peephole (prefix "+" s)))
3201 ;; peephole will only apply if no radix is given.
3203 function sc_string2integer(s
, radix
) {
3204 if (!radix
) return +s
;
3205 return parseInt(s
, radix
);
3208 /*** META ((export #t)
3209 (peephole (prefix "+")))
3211 function sc_string2real(s
) {
3216 /*** META ((export #t)
3219 function sc_isSymbol(s
) {
3220 return (typeof s
=== "string") &&
3221 (s
.charAt(0) === sc_SYMBOL_PREFIX
);
3224 /*** META ((export #t)
3225 (peephole (symbol2string_immutable)))
3227 function sc_symbol2string(s
) {
3231 /*** META ((export #t)
3232 (peephole (prefix "'\\u1E9C' +")))
3234 function sc_string2symbol(s
) {
3235 return sc_SYMBOL_PREFIX
+ s
;
3238 /*** META ((export symbol-append)
3239 (peephole (symbolAppend_immutable)))
3241 function sc_symbolAppend() {
3242 var res
= sc_SYMBOL_PREFIX
;
3243 for (var i
= 0; i
< arguments
.length
; i
++)
3244 res
+= arguments
[i
].slice(1);
3248 /*** META ((export #t)
3249 (peephole (postfix ".val")))
3251 function sc_char2string(c
) { return c
.val
; }
3253 /*** META ((export #t)
3254 (peephole (hole 1 "'\\u1E9C' + " c ".val")))
3256 function sc_char2symbol(c
) { return sc_SYMBOL_PREFIX
+ c
.val
; }
3258 /*** META ((export #t)
3261 function sc_isString(s
) {
3262 return (typeof s
=== "string") &&
3263 (s
.charAt(0) !== sc_SYMBOL_PREFIX
);
3266 /*** META ((export #t)) */
3267 var sc_makeString
= sc_makejsString
;
3270 /*** META ((export #t)) */
3271 function sc_string() {
3272 for (var i
= 0; i
< arguments
.length
; i
++)
3273 arguments
[i
] = arguments
[i
].val
;
3274 return "".concat
.apply("", arguments
);
3277 /*** META ((export #t)
3278 (peephole (postfix ".length")))
3280 function sc_stringLength(s
) { return s
.length
; }
3282 /*** META ((export #t)) */
3283 function sc_stringRef(s
, k
) {
3284 return new sc_Char(s
.charAt(k
));
3287 /* there's no stringSet in the immutable version
3288 function sc_stringSet(s, k, c)
3292 /*** META ((export string=?)
3294 (peephole (hole 2 str1 " === " str2)))
3296 function sc_isStringEqual(s1
, s2
) {
3299 /*** META ((export string<?)
3301 (peephole (hole 2 str1 " < " str2)))
3303 function sc_isStringLess(s1
, s2
) {
3306 /*** META ((export string>?)
3308 (peephole (hole 2 str1 " > " str2)))
3310 function sc_isStringGreater(s1
, s2
) {
3313 /*** META ((export string<=?)
3315 (peephole (hole 2 str1 " <= " str2)))
3317 function sc_isStringLessEqual(s1
, s2
) {
3320 /*** META ((export string>=?)
3322 (peephole (hole 2 str1 " >= " str2)))
3324 function sc_isStringGreaterEqual(s1
, s2
) {
3327 /*** META ((export string-ci=?)
3329 (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()")))
3331 function sc_isStringCIEqual(s1
, s2
) {
3332 return s1
.toLowerCase() === s2
.toLowerCase();
3334 /*** META ((export string-ci<?)
3336 (peephole (hole 2 str1 ".toLowerCase() < " str2 ".toLowerCase()")))
3338 function sc_isStringCILess(s1
, s2
) {
3339 return s1
.toLowerCase() < s2
.toLowerCase();
3341 /*** META ((export string-ci>?)
3343 (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()")))
3345 function sc_isStringCIGreater(s1
, s2
) {
3346 return s1
.toLowerCase() > s2
.toLowerCase();
3348 /*** META ((export string-ci<=?)
3350 (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()")))
3352 function sc_isStringCILessEqual(s1
, s2
) {
3353 return s1
.toLowerCase() <= s2
.toLowerCase();
3355 /*** META ((export string-ci>=?)
3357 (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()")))
3359 function sc_isStringCIGreaterEqual(s1
, s2
) {
3360 return s1
.toLowerCase() >= s2
.toLowerCase();
3363 /*** META ((export #t)
3364 (peephole (hole 3 s ".substring(" start ", " end ")")))
3366 function sc_substring(s
, start
, end
) {
3367 return s
.substring(start
, end
);
3370 /*** META ((export #t))
3372 function sc_isSubstring_at(s1
, s2
, i
) {
3373 return s2
== s1
.substring(i
, i
+ s2
.length
);
3376 /*** META ((export #t)
3377 (peephole (infix 0 #f "+" "''")))
3379 function sc_stringAppend() {
3380 return "".concat
.apply("", arguments
);
3383 /*** META ((export #t)) */
3384 var sc_string2list
= sc_jsstring2list
;
3386 /*** META ((export #t)) */
3387 var sc_list2string
= sc_list2jsstring
;
3389 /*** META ((export #t)
3392 function sc_stringCopy(s
) {
3396 /* there's no string-fill in the immutable version
3397 function sc_stringFill(s, c)
3400 /*** META ((export #t)
3401 (peephole (postfix ".slice(1)")))
3403 function sc_keyword2string(o
) {
3407 /*** META ((export #t)
3408 (peephole (prefix "'\\u1E9D' +")))
3410 function sc_string2keyword(o
) {
3411 return sc_KEYWORD_PREFIX
+ o
;
3414 String
.prototype.sc_toDisplayString = function() {
3415 if (this.charAt(0) === sc_SYMBOL_PREFIX
)
3416 // TODO: care for symbols with spaces (escape-chars symbols).
3417 return this.slice(1);
3418 else if (this.charAt(0) === sc_KEYWORD_PREFIX
)
3419 return ":" + this.slice(1);
3421 return this.toString();
3424 String
.prototype.sc_toWriteString = function() {
3425 if (this.charAt(0) === sc_SYMBOL_PREFIX
)
3426 // TODO: care for symbols with spaces (escape-chars symbols).
3427 return this.slice(1);
3428 else if (this.charAt(0) === sc_KEYWORD_PREFIX
)
3429 return ":" + this.slice(1);
3431 return '"' + sc_escapeWriteString(this) + '"';
3433 /* Exported Variables */
3434 var BgL_testzd2boyerzd2
;
3435 var BgL_nboyerzd2benchmarkzd2
;
3436 var BgL_setupzd2boyerzd2
;
3439 var translate_term_nboyer
;
3440 var translate_args_nboyer
;
3441 var untranslate_term_nboyer
;
3442 var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer
;
3443 var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
;
3444 var translate_alist_nboyer
;
3445 var apply_subst_nboyer
;
3446 var apply_subst_lst_nboyer
;
3447 var tautologyp_nboyer
;
3448 var if_constructor_nboyer
;
3449 var rewrite_count_nboyer
;
3451 var rewrite_args_nboyer
;
3452 var unify_subst_nboyer
;
3453 var one_way_unify1_nboyer
;
3454 var false_term_nboyer
;
3455 var true_term_nboyer
;
3456 var trans_of_implies1_nboyer
;
3457 var is_term_equal_nboyer
;
3458 var is_term_member_nboyer
;
3460 var sc_const_3_nboyer
;
3461 var sc_const_4_nboyer
;
3463 (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)))))));
3464 (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))))))));
3465 (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)))))))))));
3466 BgL_nboyerzd2benchmarkzd2 = function() {
3468 for (var sc_tmp
= arguments
.length
- 1; sc_tmp
>= 0; sc_tmp
--) {
3469 args
= sc_cons(arguments
[sc_tmp
], args
);
3472 return ((n
= ((args
=== null)?(0):(args
.car
))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n
))), (1), function() {
3473 return (BgL_testzd2boyerzd2(n
));
3474 }, function(rewrites
) {
3475 if ((sc_isNumber(rewrites
)))
3478 return (rewrites
===(95024));
3481 return (rewrites
===(591777));
3484 return (rewrites
===(1813975));
3487 return (rewrites
===(5375678));
3490 return (rewrites
===(16445406));
3493 return (rewrites
===(51507739));
3503 BgL_setupzd2boyerzd2 = function() {
3506 BgL_testzd2boyerzd2 = function() {
3509 translate_term_nboyer = function(term
) {
3511 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
))))))))));
3513 translate_args_nboyer = function(lst
) {
3516 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
))))))))));
3518 untranslate_term_nboyer = function(term
) {
3524 if (!(term
instanceof sc_Pair
))
3528 (falseHead1130
= (new sc_Pair(null, null)));
3529 (L1127
= (term
.cdr
));
3530 (tail1131
= falseHead1130
);
3531 while (!(L1127
=== null)) {
3533 (tail1131
.cdr
= (new sc_Pair((untranslate_term_nboyer((L1127
.car
))), null)));
3534 (tail1131
= (tail1131
.cdr
));
3535 (L1127
= (L1127
.cdr
));
3538 (optrOpnd
= (falseHead1130
.cdr
));
3539 return (new sc_Pair(((symbol_record
= (term
.car
)), (symbol_record
[(0)])), optrOpnd
));
3542 BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym
) {
3545 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
)));
3547 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
= null);
3548 translate_alist_nboyer = function(alist
) {
3551 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
))))))))));
3553 apply_subst_nboyer = function(alist
, term
) {
3556 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
))))))))));
3558 apply_subst_lst_nboyer = function(alist
, lst
) {
3560 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
))))))))));
3562 tautologyp_nboyer = function(sc_x_11
, true_lst
, false_lst
) {
3573 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))
3576 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))
3579 if (!(sc_x_11
instanceof sc_Pair
))
3582 if (((sc_x_11
.car
)===if_constructor_nboyer
))
3583 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))
3584 (sc_x_11
= (sc_x_11
.cdr
.cdr
.car
));
3586 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))
3587 (sc_x_11
= (sc_x_11
.cdr
.cdr
.cdr
.car
));
3589 if (((tautologyp_nboyer((sc_x_11
.cdr
.cdr
.car
), (new sc_Pair((sc_x_11
.cdr
.car
), true_lst
)), false_lst
))!== false))
3591 (false_lst
= (new sc_Pair((sc_x_11
.cdr
.car
), false_lst
)));
3592 (sc_x_11
= (sc_x_11
.cdr
.cdr
.cdr
.car
));
3600 (if_constructor_nboyer
= "\u1E9C*");
3601 (rewrite_count_nboyer
= (0));
3602 rewrite_nboyer = function(term
) {
3609 (++rewrite_count_nboyer
);
3610 if (!(term
instanceof sc_Pair
))
3614 (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
))))))))));
3615 (lst
= ((symbol_record
= (term
.car
)), (symbol_record
[(1)])));
3620 if ((((term2
= ((lst
.car
).cdr
.car
)), (unify_subst_nboyer
= null), (one_way_unify1_nboyer(sc_term_12
, term2
)))!== false))
3621 return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer
, ((lst
.car
).cdr
.cdr
.car
)))));
3628 rewrite_args_nboyer = function(lst
) {
3630 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
))))))))));
3632 (unify_subst_nboyer
= "\u1E9C*");
3633 one_way_unify1_nboyer = function(term1
, term2
) {
3637 if (!(term2
instanceof sc_Pair
))
3639 (temp_temp
= (sc_assq(term2
, unify_subst_nboyer
)));
3640 if ((temp_temp
!== false))
3641 return (is_term_equal_nboyer(term1
, (temp_temp
.cdr
)));
3643 if ((sc_isNumber(term2
)))
3644 return (sc_isEqual(term1
, term2
));
3647 (unify_subst_nboyer
= (new sc_Pair((new sc_Pair(term2
, term1
)), unify_subst_nboyer
)));
3652 if (!(term1
instanceof sc_Pair
))
3655 if (((term1
.car
)===(term2
.car
)))
3657 (lst1
= (term1
.cdr
));
3658 (lst2
= (term2
.cdr
));
3660 if ((lst1
=== null))
3661 return (lst2
=== null);
3663 if ((lst2
=== null))
3666 if (((one_way_unify1_nboyer((lst1
.car
), (lst2
.car
)))!== false))
3668 (lst1
= (lst1
.cdr
));
3669 (lst2
= (lst2
.cdr
));
3678 (false_term_nboyer
= "\u1E9C*");
3679 (true_term_nboyer
= "\u1E9C*");
3680 trans_of_implies1_nboyer = function(n
) {
3682 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)))))))))));
3684 is_term_equal_nboyer = function(x
, y
) {
3689 if ((x
instanceof sc_Pair
))
3690 if ((y
instanceof sc_Pair
))
3691 if ((((r1
= (x
.car
)), (r2
= (y
.car
)), (r1
===r2
))!== false))
3696 if ((lst1
=== null))
3697 return (lst2
=== null);
3699 if ((lst2
=== null))
3702 if (((is_term_equal_nboyer((lst1
.car
), (lst2
.car
)))!== false))
3704 (lst1
= (lst1
.cdr
));
3705 (lst2
= (lst2
.cdr
));
3716 return (sc_isEqual(x
, y
));
3718 is_term_member_nboyer = function(x
, lst
) {
3725 if (((is_term_equal_nboyer(x
, (lst
.car
)))!== false))
3731 BgL_setupzd2boyerzd2 = function() {
3734 var BgL_sc_symbolzd2record_16zd2
;
3742 (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer
= null);
3743 (if_constructor_nboyer
= (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif")));
3744 (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
))))))));
3745 (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
))))))));
3746 (lst
= sc_const_3_nboyer
);
3747 while (!(lst
=== null)) {
3750 if (((term
instanceof sc_Pair
)&&(((term
.car
)==="\u1E9Cequal")&&((term
.cdr
.car
) instanceof sc_Pair
))))
3752 (sc_sym_17
= ((term
.cdr
.car
).car
));
3753 (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)])))));
3754 (symbol_record
= (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17
)));
3755 (symbol_record
[(1)] = value
);
3758 (sc_error("ADD-LEMMA did not like term: ", term
));
3765 BgL_testzd2boyerzd2 = function(n
) {
3773 (rewrite_count_nboyer
= (0));
3774 (term
= sc_const_4_nboyer
);
3776 while (!(sc_n_20
=== 0)) {
3778 (term
= (sc_list("\u1E9Cor", term
, (new sc_Pair("\u1E9Cf",null)))));
3782 (sc_term_22
= term
);
3783 if (!(sc_term_22
instanceof sc_Pair
))
3784 (optrOpnd
= sc_term_22
);
3786 (optrOpnd
= (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22
.car
))), (translate_args_nboyer((sc_term_22
.cdr
))))));
3787 (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
)));
3788 (answer
= (tautologyp_nboyer((rewrite_nboyer(sc_term_21
)), null, null)));
3789 (sc_write(rewrite_count_nboyer
));
3790 (sc_display(" rewrites"));
3792 if ((answer
!== false))
3793 return rewrite_count_nboyer
;
3799 /* Exported Variables */
3800 var BgL_parsezd2ze3nbzd2treesze3
;
3801 var BgL_earleyzd2benchmarkzd2
;
3802 var BgL_parsezd2ze3parsedzf3zc2
;
3804 var BgL_parsezd2ze3treesz31
;
3805 var BgL_makezd2parserzd2
;
3810 (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)));
3811 BgL_makezd2parserzd2 = function(grammar
, lexer
) {
3824 var sc_predictors_3
;
3828 var BgL_sc_defzd2loop_6zd2
;
3829 var BgL_sc_nbzd2nts_7zd2
;
3831 var BgL_sc_defzd2loop_9zd2
;
3834 ind = function(nt
, sc_nts_10
) {
3837 (i
= ((sc_nts_10
.length
)-(1)));
3840 if ((sc_isEqual((sc_nts_10
[i
]), nt
)))
3849 (sc_nts_8
= ((BgL_sc_defzd2loop_9zd2 = function(defs
, sc_nts_11
) {
3853 return ((defs
instanceof sc_Pair
)?((def
= (defs
.car
)), (head
= (def
.car
)), (rule_loop = function(rules
, sc_nts_12
) {
3858 if ((rules
instanceof sc_Pair
))
3860 (rule
= (rules
.car
));
3862 (sc_nts_13
= sc_nts_12
);
3863 while ((l
instanceof sc_Pair
)) {
3867 (sc_nts_13
= (((sc_member(nt
, sc_nts_13
))!== false)?sc_nts_13
:(new sc_Pair(nt
, sc_nts_13
))));
3870 return (rule_loop((rules
.cdr
), sc_nts_13
));
3873 return (BgL_sc_defzd2loop_9zd2((defs
.cdr
), sc_nts_12
));
3874 }), (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
)))));
3875 }), (BgL_sc_defzd2loop_9zd2(grammar
, null))));
3876 (BgL_sc_nbzd2nts_7zd2
= (sc_nts_8
.length
));
3877 (nb_confs
= (((BgL_sc_defzd2loop_6zd2 = function(defs
, BgL_sc_nbzd2confs_14zd2
) {
3880 return ((defs
instanceof sc_Pair
)?((def
= (defs
.car
)), (rule_loop = function(rules
, BgL_sc_nbzd2confs_15zd2
) {
3882 var BgL_sc_nbzd2confs_16zd2
;
3884 if ((rules
instanceof sc_Pair
))
3886 (rule
= (rules
.car
));
3888 (BgL_sc_nbzd2confs_16zd2
= BgL_sc_nbzd2confs_15zd2
);
3889 while ((l
instanceof sc_Pair
)) {
3892 (++BgL_sc_nbzd2confs_16zd2
);
3895 return (rule_loop((rules
.cdr
), (BgL_sc_nbzd2confs_16zd2
+(1))));
3898 return (BgL_sc_defzd2loop_6zd2((defs
.cdr
), BgL_sc_nbzd2confs_15zd2
));
3899 }), (rule_loop((def
.cdr
), BgL_sc_nbzd2confs_14zd2
))):BgL_sc_nbzd2confs_14zd2
);
3900 }), (BgL_sc_defzd2loop_6zd2(grammar
, (0))))+BgL_sc_nbzd2nts_7zd2
));
3901 (sc_starters_5
= (sc_makeVector(BgL_sc_nbzd2nts_7zd2
, null)));
3902 (sc_enders_4
= (sc_makeVector(BgL_sc_nbzd2nts_7zd2
, null)));
3903 (sc_predictors_3
= (sc_makeVector(BgL_sc_nbzd2nts_7zd2
, null)));
3904 (sc_steps_2
= (sc_makeVector(nb_confs
, false)));
3905 (sc_names_1
= (sc_makeVector(nb_confs
, false)));
3907 (starters
= sc_starters_5
);
3908 (enders
= sc_enders_4
);
3909 (predictors
= sc_predictors_3
);
3910 (steps
= sc_steps_2
);
3911 (names
= sc_names_1
);
3912 (nb_nts
= (sc_nts_8
.length
));
3916 (sc_steps_2
[i
] = (i
-nb_nts
));
3917 (sc_names_1
[i
] = (sc_list((sc_nts_8
[i
]), (0))));
3918 (sc_enders_4
[i
] = (sc_list(i
)));
3922 def_loop = function(defs
, conf
) {
3926 return ((defs
instanceof sc_Pair
)?((def
= (defs
.car
)), (head
= (def
.car
)), (rule_loop = function(rules
, conf
, rule_num
) {
3934 if ((rules
instanceof sc_Pair
))
3936 (rule
= (rules
.car
));
3937 (names
[conf
] = (sc_list(head
, rule_num
)));
3938 (sc_i_19
= (ind(head
, nts
)));
3939 (starters
[sc_i_19
] = (new sc_Pair(conf
, (starters
[sc_i_19
]))));
3941 (sc_conf_18
= conf
);
3942 while ((l
instanceof sc_Pair
)) {
3945 (steps
[sc_conf_18
] = (ind(nt
, nts
)));
3946 (sc_i_17
= (ind(nt
, nts
)));
3947 (predictors
[sc_i_17
] = (new sc_Pair(sc_conf_18
, (predictors
[sc_i_17
]))));
3952 (steps
[sc_conf_18
] = ((ind(head
, nts
))-nb_nts
));
3953 (i
= (ind(head
, nts
)));
3954 (enders
[i
] = (new sc_Pair(sc_conf_18
, (enders
[i
]))));
3955 return (rule_loop((rules
.cdr
), (sc_conf_18
+(1)), (rule_num
+(1))));
3958 return (def_loop((defs
.cdr
), conf
));
3959 }), (rule_loop((def
.cdr
), conf
, (1)))):undefined);
3961 (def_loop(grammar
, (sc_nts_8
.length
)));
3962 (parser_descr
= [lexer
, sc_nts_8
, sc_starters_5
, sc_enders_4
, sc_predictors_3
, sc_steps_2
, sc_names_1
]);
3963 return function(input
) {
3969 var BgL_sc_stateza2_23za2
;
3971 var BgL_sc_nbzd2nts_24zd2
;
3975 var BgL_sc_statesza2_27za2
;
3989 var BgL_sc_statesza2_30za2
;
3990 var BgL_sc_nbzd2nts_31zd2
;
3991 var BgL_sc_nbzd2confs_32zd2
;
3995 var BgL_sc_nbzd2confs_34zd2
;
3996 var BgL_sc_nbzd2toks_35zd2
;
4001 var sc_predictors_39
;
4008 var BgL_sc_confzd2setzd2getza2_44za2
;
4009 var conf_set_merge_new_bang
;
4010 var conf_set_adjoin
;
4011 var BgL_sc_confzd2setzd2adjoinza2_45za2
;
4012 var BgL_sc_confzd2setzd2adjoinza2za2_46z00
;
4017 var BgL_sc_derivzd2treesza2_47z70
;
4019 var BgL_sc_nbzd2derivzd2treesza2_48za2
;
4021 sc_ind_43 = function(nt
, sc_nts_49
) {
4024 (i
= ((sc_nts_49
.length
)-(1)));
4027 if ((sc_isEqual((sc_nts_49
[i
]), nt
)))
4036 make_states = function(BgL_sc_nbzd2toks_50zd2
, BgL_sc_nbzd2confs_51zd2
) {
4041 (sc_states_52
= (sc_makeVector((BgL_sc_nbzd2toks_50zd2
+(1)), false)));
4042 (i
= BgL_sc_nbzd2toks_50zd2
);
4045 (v
= (sc_makeVector((BgL_sc_nbzd2confs_51zd2
+(1)), false)));
4047 (sc_states_52
[i
] = v
);
4051 return sc_states_52
;
4054 BgL_sc_confzd2setzd2getza2_44za2 = function(state
, BgL_sc_statezd2num_53zd2
, sc_conf_54
) {
4056 var BgL_sc_confzd2set_55zd2
;
4057 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
)));
4059 conf_set_merge_new_bang = function(conf_set
) {
4060 return ((conf_set
[((conf_set
[(1)])+(5))] = (conf_set
[(4)])), (conf_set
[(1)] = (conf_set
[(3)])), (conf_set
[(3)] = (-1)), (conf_set
[(4)] = (-1)));
4062 conf_set_adjoin = function(state
, conf_set
, sc_conf_56
, i
) {
4064 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));
4066 BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57
, BgL_sc_statezd2num_58zd2
, l
, i
) {
4072 (state
= (sc_states_57
[BgL_sc_statezd2num_58zd2
]));
4074 while ((l1
instanceof sc_Pair
)) {
4076 (sc_conf_59
= (l1
.car
));
4077 (conf_set
= (BgL_sc_confzd2setzd2getza2_44za2(state
, BgL_sc_statezd2num_58zd2
, sc_conf_59
)));
4078 if (((conf_set
[(i
+(5))])=== false))
4080 (conf_set_adjoin(state
, conf_set
, sc_conf_59
, i
));
4090 BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60
, BgL_sc_statesza2_61za2
, BgL_sc_statezd2num_62zd2
, sc_conf_63
, i
) {
4091 var BgL_sc_confzd2setza2_64z70
;
4092 var BgL_sc_stateza2_65za2
;
4095 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));
4097 conf_set_union = function(state
, conf_set
, sc_conf_66
, other_set
) {
4100 (i
= (other_set
[(2)]));
4102 if (((conf_set
[(i
+(5))])=== false))
4104 (conf_set_adjoin(state
, conf_set
, sc_conf_66
, i
));
4105 (i
= (other_set
[(i
+(5))]));
4108 (i
= (other_set
[(i
+(5))]));
4113 forw = function(sc_states_67
, BgL_sc_statezd2num_68zd2
, sc_starters_69
, sc_enders_70
, sc_predictors_71
, sc_steps_72
, sc_nts_73
) {
4124 var BgL_sc_confzd2set_76zd2
;
4125 var BgL_sc_statezd2num_77zd2
;
4129 var BgL_sc_confzd2set_79zd2
;
4132 var BgL_sc_nbzd2nts_81zd2
;
4135 (sc_state_82
= (sc_states_67
[BgL_sc_statezd2num_68zd2
]));
4136 (BgL_sc_nbzd2nts_81zd2
= (sc_nts_73
.length
));
4139 (sc_conf_80
= (sc_state_82
[(0)]));
4140 if ((sc_conf_80
>=(0)))
4142 (step
= (sc_steps_72
[sc_conf_80
]));
4143 (BgL_sc_confzd2set_79zd2
= (sc_state_82
[(sc_conf_80
+(1))]));
4144 (head
= (BgL_sc_confzd2set_79zd2
[(4)]));
4145 (sc_state_82
[(0)] = (BgL_sc_confzd2set_79zd2
[(0)]));
4146 (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2
));
4149 (sc_l_74
= (sc_starters_69
[step
]));
4150 while ((sc_l_74
instanceof sc_Pair
)) {
4152 (starter
= (sc_l_74
.car
));
4153 (starter_set
= (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82
, BgL_sc_statezd2num_68zd2
, starter
)));
4154 if (((starter_set
[(BgL_sc_statezd2num_68zd2
+(5))])=== false))
4156 (conf_set_adjoin(sc_state_82
, starter_set
, starter
, BgL_sc_statezd2num_68zd2
));
4157 (sc_l_74
= (sc_l_74
.cdr
));
4160 (sc_l_74
= (sc_l_74
.cdr
));
4163 (l
= (sc_enders_70
[step
]));
4164 while ((l
instanceof sc_Pair
)) {
4167 if ((((conf_set
= (sc_state_82
[(ender
+(1))])), ((conf_set
!== false)?(conf_set
[(BgL_sc_statezd2num_68zd2
+(5))]):false))!== false))
4169 (next
= (sc_conf_80
+(1)));
4170 (next_set
= (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82
, BgL_sc_statezd2num_68zd2
, next
)));
4171 (conf_set_union(sc_state_82
, next_set
, next
, BgL_sc_confzd2set_79zd2
));
4181 (preds
= (sc_predictors_71
[(step
+BgL_sc_nbzd2nts_81zd2
)]));
4182 (sc_states_78
= sc_states_67
);
4183 (state
= sc_state_82
);
4184 (BgL_sc_statezd2num_77zd2
= BgL_sc_statezd2num_68zd2
);
4185 (BgL_sc_confzd2set_76zd2
= BgL_sc_confzd2set_79zd2
);
4186 sc_loop1_75 = function(l
) {
4188 var BgL_sc_nextzd2set_84zd2
;
4193 if ((l
instanceof sc_Pair
))
4199 (pred_set
= ((sc_state_83
= (sc_states_78
[i
])), (sc_state_83
[(pred
+(1))])));
4200 if ((pred_set
!== false))
4202 (sc_next_85
= (pred
+(1)));
4203 (BgL_sc_nextzd2set_84zd2
= (BgL_sc_confzd2setzd2getza2_44za2(state
, BgL_sc_statezd2num_77zd2
, sc_next_85
)));
4204 (conf_set_union(state
, BgL_sc_nextzd2set_84zd2
, sc_next_85
, pred_set
));
4206 (i
= (BgL_sc_confzd2set_76zd2
[(i
+(5))]));
4209 return (sc_loop1_75((l
.cdr
)));
4214 (sc_loop1_75(preds
));
4223 is_parsed = function(nt
, i
, j
, sc_nts_86
, sc_enders_87
, sc_states_88
) {
4228 var BgL_sc_ntza2_90za2
;
4230 (BgL_sc_ntza2_90za2
= (sc_ind_43(nt
, sc_nts_86
)));
4231 if ((BgL_sc_ntza2_90za2
!== false))
4234 (l
= (sc_enders_87
[BgL_sc_ntza2_90za2
]));
4236 if ((l
instanceof sc_Pair
))
4238 (sc_conf_89
= (l
.car
));
4239 if ((((state
= (sc_states_88
[j
])), (conf_set
= (state
[(sc_conf_89
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false))
4252 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
) {
4256 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
) {
4264 if ((l1
instanceof sc_Pair
))
4267 (ender_set
= ((state
= (sc_states_96
[j
])), (state
[(ender
+(1))])));
4268 if ((ender_set
!== false))
4270 loop2 = function(k
, l2
) {
4280 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)))
4282 (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
)));
4283 (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
)));
4284 loop3 = function(l3
, l2
) {
4288 if ((l3
instanceof sc_Pair
))
4290 (ender_tree
= (sc_list((l3
.car
))));
4293 while ((l4
instanceof sc_Pair
)) {
4295 (sc_l2_100
= (new sc_Pair((sc_append((l4
.car
), ender_tree
)), sc_l2_100
)));
4299 return (loop3((l3
.cdr
), sc_l2_100
));
4302 return (loop2((ender_set
[(k
+(5))]), l2
));
4304 return (loop3(ender_trees
, l2
));
4307 (k
= (ender_set
[(k
+(5))]));
4309 return (sc_loop1_98((l1
.cdr
), l2
));
4312 return (loop2((ender_set
[(2)]), l2
));
4320 }), (sc_loop1_98((sc_enders_92
[(sc_steps_93
[prev
])]), null)))));
4322 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
) {
4328 var BgL_sc_nbzd2nts_108zd2
;
4329 var BgL_sc_ntza2_109za2
;
4331 (BgL_sc_ntza2_109za2
= (sc_ind_43(nt
, sc_nts_101
)));
4332 if ((BgL_sc_ntza2_109za2
!== false))
4334 (BgL_sc_nbzd2nts_108zd2
= (sc_nts_101
.length
));
4335 (l
= (sc_enders_102
[BgL_sc_ntza2_109za2
]));
4337 while ((l
instanceof sc_Pair
)) {
4339 (sc_conf_107
= (l
.car
));
4340 if ((((state
= (sc_states_106
[j
])), (conf_set
= (state
[(sc_conf_107
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false))
4343 (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
)));
4355 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
) {
4359 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
) {
4372 if ((l
instanceof sc_Pair
))
4375 (ender_set
= ((sc_state_117
= (sc_states_114
[j
])), (sc_state_117
[(ender
+(1))])));
4376 if ((ender_set
!== false))
4378 (k
= (ender_set
[(2)]));
4381 if (((k
>=i
)&&(((state
= (sc_states_114
[k
])), (conf_set
= (state
[(prev
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false)))
4383 (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
)));
4384 (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
)));
4385 (k
= (ender_set
[(k
+(5))]));
4386 (n
+=(nb_prev_trees
*nb_ender_trees
));
4389 (k
= (ender_set
[(k
+(5))]));
4391 return (sc_loop1_116((l
.cdr
), n
));
4399 }), (sc_loop1_116((sc_enders_111
[(sc_steps_112
[prev
])]), (0))))));
4401 BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt
, i
, j
, sc_nts_119
, sc_enders_120
, sc_steps_121
, sc_toks_122
, sc_states_123
) {
4407 var BgL_sc_nbzd2nts_125zd2
;
4408 var BgL_sc_ntza2_126za2
;
4410 (BgL_sc_ntza2_126za2
= (sc_ind_43(nt
, sc_nts_119
)));
4411 if ((BgL_sc_ntza2_126za2
!== false))
4413 (BgL_sc_nbzd2nts_125zd2
= (sc_nts_119
.length
));
4414 (l
= (sc_enders_120
[BgL_sc_ntza2_126za2
]));
4416 while ((l
instanceof sc_Pair
)) {
4418 (sc_conf_124
= (l
.car
));
4419 if ((((state
= (sc_states_123
[j
])), (conf_set
= (state
[(sc_conf_124
+(1))])), ((conf_set
!== false)?(conf_set
[(i
+(5))]):false))!== false))
4422 (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
));
4434 (lexer
= (parser_descr
[(0)]));
4435 (sc_nts_42
= (parser_descr
[(1)]));
4436 (sc_starters_41
= (parser_descr
[(2)]));
4437 (sc_enders_40
= (parser_descr
[(3)]));
4438 (sc_predictors_39
= (parser_descr
[(4)]));
4439 (sc_steps_38
= (parser_descr
[(5)]));
4440 (sc_names_37
= (parser_descr
[(6)]));
4441 (falseHead1128
= (new sc_Pair(null, null)));
4442 (L1125
= (lexer(input
)));
4443 (tail1129
= falseHead1128
);
4444 while (!(L1125
=== null)) {
4446 (tok
= (L1125
.car
));
4449 while ((l1
instanceof sc_Pair
)) {
4451 (sc_i_29
= (sc_ind_43((l1
.car
), sc_nts_42
)));
4452 if ((sc_i_29
!== false))
4455 (l2
= (new sc_Pair(sc_i_29
, l2
)));
4461 (sc_optrOpnd_22
= (new sc_Pair((tok
.car
), (sc_reverse(l2
)))));
4462 (sc_optrOpnd_21
= (new sc_Pair(sc_optrOpnd_22
, null)));
4463 (tail1129
.cdr
= sc_optrOpnd_21
);
4464 (tail1129
= (tail1129
.cdr
));
4465 (L1125
= (L1125
.cdr
));
4468 (sc_optrOpnd_20
= (falseHead1128
.cdr
));
4469 (sc_toks_36
= (sc_list2vector(sc_optrOpnd_20
)));
4470 (BgL_sc_nbzd2toks_35zd2
= (sc_toks_36
.length
));
4471 (BgL_sc_nbzd2confs_34zd2
= (sc_steps_38
.length
));
4472 (sc_states_33
= (make_states(BgL_sc_nbzd2toks_35zd2
, BgL_sc_nbzd2confs_34zd2
)));
4473 (goal_starters
= (sc_starters_41
[(0)]));
4474 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33
, (0), goal_starters
, (0)));
4475 (forw(sc_states_33
, (0), sc_starters_41
, sc_enders_40
, sc_predictors_39
, sc_steps_38
, sc_nts_42
));
4477 while ((sc_i_28
<BgL_sc_nbzd2toks_35zd2
)) {
4479 (tok_nts
= ((sc_toks_36
[sc_i_28
]).cdr
));
4480 (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33
, (sc_i_28
+(1)), tok_nts
, sc_i_28
));
4481 (forw(sc_states_33
, (sc_i_28
+(1)), sc_starters_41
, sc_enders_40
, sc_predictors_39
, sc_steps_38
, sc_nts_42
));
4485 (nb_toks
= (sc_toks_36
.length
));
4486 (BgL_sc_nbzd2confs_32zd2
= (sc_steps_38
.length
));
4487 (BgL_sc_nbzd2nts_31zd2
= (sc_nts_42
.length
));
4488 (BgL_sc_statesza2_30za2
= (make_states(nb_toks
, BgL_sc_nbzd2confs_32zd2
)));
4489 (goal_enders
= (sc_enders_40
[(0)]));
4491 while ((l
instanceof sc_Pair
)) {
4494 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_33
, BgL_sc_statesza2_30za2
, nb_toks
, conf
, (0)));
4501 (states
= sc_states_33
);
4502 (BgL_sc_statesza2_27za2
= BgL_sc_statesza2_30za2
);
4504 (sc_enders_26
= sc_enders_40
);
4505 (sc_steps_25
= sc_steps_38
);
4506 (BgL_sc_nbzd2nts_24zd2
= BgL_sc_nbzd2nts_31zd2
);
4507 (toks
= sc_toks_36
);
4508 (BgL_sc_stateza2_23za2
= (BgL_sc_statesza2_30za2
[i
]));
4509 loop1 = function() {
4512 var BgL_sc_statesza2_128za2
;
4521 (sc_conf_131
= (BgL_sc_stateza2_23za2
[(0)]));
4522 if ((sc_conf_131
>=(0)))
4524 (conf_set
= (BgL_sc_stateza2_23za2
[(sc_conf_131
+(1))]));
4525 (head
= (conf_set
[(4)]));
4526 (BgL_sc_stateza2_23za2
[(0)] = (conf_set
[(0)]));
4527 (conf_set_merge_new_bang(conf_set
));
4529 while ((sc_i_130
>=(0))) {
4533 (sc_states_129
= states
);
4534 (BgL_sc_statesza2_128za2
= BgL_sc_statesza2_27za2
);
4535 (prev
= (sc_conf_131
-(1)));
4536 if (((sc_conf_131
>=BgL_sc_nbzd2nts_24zd2
)&&((sc_steps_25
[prev
])>=(0))))
4538 sc_loop1_127 = function(l
) {
4545 if ((l
instanceof sc_Pair
))
4548 (ender_set
= ((state
= (sc_states_129
[j
])), (state
[(ender
+(1))])));
4549 if ((ender_set
!== false))
4551 (k
= (ender_set
[(2)]));
4555 if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129
, BgL_sc_statesza2_128za2
, k
, prev
, i
))!== false))
4556 (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129
, BgL_sc_statesza2_128za2
, j
, ender
, k
));
4557 (k
= (ender_set
[(k
+(5))]));
4560 return (sc_loop1_127((l
.cdr
)));
4569 (sc_loop1_127((sc_enders_26
[(sc_steps_25
[prev
])])));
4571 (sc_i_130
= (conf_set
[(sc_i_130
+(5))]));
4584 (optrOpnd
= BgL_sc_statesza2_30za2
);
4585 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
];
4590 BgL_parsezd2ze3parsedzf3zc2 = function(parse
, nt
, i
, j
) {
4595 return ((nts
= (parse
[(0)])), (enders
= (parse
[(2)])), (states
= (parse
[(7)])), (is_parsed
= (parse
[(8)])), (is_parsed(nt
, i
, j
, nts
, enders
, states
)));
4597 BgL_parsezd2ze3treesz31 = function(parse
, nt
, i
, j
) {
4598 var BgL_sc_derivzd2treesza2_132z70
;
4605 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
)));
4607 BgL_parsezd2ze3nbzd2treesze3 = function(parse
, nt
, i
, j
) {
4608 var BgL_sc_nbzd2derivzd2treesza2_133za2
;
4614 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
)));
4616 test2 = function(k
) {
4619 return ((p
= (BgL_makezd2parserzd2(const_earley
, function(l
) {
4625 (falseHead1133
= (new sc_Pair(null, null)));
4626 (tail1134
= falseHead1133
);
4628 while (!(L1130
=== null)) {
4630 (tail1134
.cdr
= (new sc_Pair(((sc_x_134
= (L1130
.car
)), (sc_list(sc_x_134
, sc_x_134
))), null)));
4631 (tail1134
= (tail1134
.cdr
));
4632 (L1130
= (L1130
.cdr
));
4635 return (falseHead1133
.cdr
);
4637 }))), (x
= (p((sc_vector2list((sc_makeVector(k
, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x
, "\u1E9Cs", (0), k
)))));
4639 BgL_earleyzd2benchmarkzd2 = function() {
4641 for (var sc_tmp
= arguments
.length
- 1; sc_tmp
>= 0; sc_tmp
--) {
4642 args
= sc_cons(arguments
[sc_tmp
], args
);
4645 return ((k
= ((args
=== null)?(7):(args
.car
))), (BgL_runzd2benchmarkzd2("earley", (1), function() {
4647 }, function(result
) {
4648 return ((sc_display(result
)), (sc_newline()), result
== 132);
4654 /************* END OF GENERATED CODE *************/
4655 // Invoke this function to run a benchmark.
4656 // The first argument is a string identifying the benchmark.
4657 // The second argument is the number of times to run the benchmark.
4658 // The third argument is a function that runs the benchmark.
4659 // The fourth argument is a unary function that warns if the result
4660 // returned by the benchmark is incorrect.
4663 // RunBenchmark("new Array()",
4665 // function () { new Array(1000000); }
4667 // return (v instanceof Array) && (v.length == 1000000);
4670 SC_DEFAULT_OUT
= new sc_GenericOutputPort(function(s
) {});
4671 SC_ERROR_OUT
= SC_DEFAULT_OUT
;
4673 function RunBenchmark(name
, count
, run
, warn
) {
4674 for (var n
= 0; n
< count
; ++n
) {
4676 if (!warn(result
)) {
4677 throw new Error("Earley or Boyer did incorrect number of rewrites");
4682 var BgL_runzd2benchmarkzd2
= RunBenchmark
;
4684 window
.onload = function(){ startTest("v8-earley-boyer", 'd4c16950');
4686 test("Earley", BgL_earleyzd2benchmarkzd2
);
4687 test("Boyer", BgL_nboyerzd2benchmarkzd2
);