=================================== library-test-debug.js (eqv? (quote a) (quote a)) OK (not (eqv? (quote a) (quote b))) OK (eqv? 2 2) OK (eqv? (quote ()) (quote ())) OK (eqv? 100000000 100000000) OK (not (eqv? (cons 1 2) (cons 1 2))) OK (not (eqv? (lambda () 1) (lambda () 2))) OK (not (eqv? #f (quote nil))) OK (eqv? p p) OK (eqv? g g) OK (not (eqv? (gen-counter) (gen-counter))) OK (eqv? g g) OK (eqv? x x) OK (eq? (quote a) (quote a)) OK (not (eq? (list (quote a)) (list (quote a)))) OK (eq? (quote ()) (quote ())) OK (eq? car car) FAIL (eq? x x) OK (eq? x x) OK (eq? p p) OK (equal? (quote a) (quote a)) OK (equal? (quote (a)) (quote (a))) OK (equal? (quote (a (b) c)) (quote (a (b) c))) OK (equal? "abc" "abc") OK (equal? 2 2) OK (equal? (make-vector 5 (quote a)) (make-vector 5 (quote ... OK (not (not #t)) OK (not (not 3)) OK (not (not (list 3))) OK (not #f) OK (not (not (quote ()))) OK (not (not (list))) OK (not (not (quote nil))) OK (boolean? #f) OK (not (boolean? 0)) OK (not (boolean? (quote ()))) OK (pair? (quote (a . b))) OK (pair? (quote (a b c))) OK (not (pair? (quote ()))) OK (not (pair? (quote #(a b)))) OK (symbol? (quote foo)) OK (symbol? (car (quote (a b)))) OK (not (symbol? "bar")) OK (symbol? (quote nil)) OK (not (symbol? (quote ()))) OK (not (symbol? #f)) OK (procedure? car) OK (not (procedure? (quote car))) OK (procedure? (lambda (x) (* x x))) OK (not (procedure? (quote (lambda (x) (* x x))))) OK (call-with-current-continuation procedure?) OK (call-with-values (lambda () (values 4 5)) (lambda (a b) ... OK (call-with-values * -) == -1 OK (void 1 2 3) == # OK (cons (quote a) (quote ())) == (a) OK (cons (quote (a)) (quote (b c d))) == ((a) b c d) OK (cons "a" (quote (b c))) == ("a" b c) OK (cons (quote a) 3) == (a . 3) OK (cons (quote (a b)) (quote c)) == ((a b) . c) OK (car (quote (a b c))) == a OK (car (quote ((a) b c d))) == (a) OK (car (quote (1 . 2))) == 1 OK (cdr (quote ((a) b c d))) == (b c d) OK (cdr (quote (1 . 2))) == 2 OK (list? (quote (a b c))) OK (list? (quote ())) OK (not (list? (quote (a . b)))) OK (not (let ((x (list (quote a)))) (set-cdr! x x) (list? x))) OK (list (quote a) (+ 3 4) (quote c)) == (a 7 c) OK (list) == () OK (length (quote (a b c))) == 3 OK (length (quote (a (b) (c d e)))) == 3 OK (length (quote ())) == 0 OK y == (a b c) OK (list? y) OK x == (a . 4) OK (eqv? x y) OK y == (a . 4) OK (not (list? y)) OK (not (list? x)) OK (append (quote (x)) (quote (y))) == (x y) OK (append (quote (a)) (quote (b c d))) == (a b c d) OK (append (quote (a (b))) (quote ((c)))) == (a (b) (c)) OK (append (quote (a b)) (quote (c . d))) == (a b c . d) OK (append (quote ()) (quote a)) == a OK (reverse (quote (a b c))) == (c b a) OK (reverse (quote (a (b c) d (e (f))))) == ((e (f)) d (b c ... OK (list-ref (quote (a b c d)) 2) == c OK (list-ref (quote (a b c d)) (inexact->exact (round 1.8)) ... OK (memq (quote a) (quote (a b c))) == (a b c) OK (memq (quote b) (quote (a b c))) == (b c) OK (not (memq (quote a) (quote (b c d)))) OK (not (memq (list (quote a)) (quote (b (a) c)))) OK (member (list (quote a)) (quote (b (a) c))) == ((a) c) OK (memv 101 (quote (100 101 102))) == (101 102) OK (assq (quote a) ex) == (a 1) OK (assq (quote b) ex) == (b 2) OK (not (assq (quote d) ex)) OK (not (assq (list (quote a)) (quote (((a)) ((b)) ((c)))))) OK (assoc (list (quote a)) (quote (((a)) ((b)) ((c))))) == ... OK (assv 5 (quote ((2 3) (5 7) (11 13)))) == (5 7) OK (+ 3 4) == 7 OK (+ 3) == 3 OK (+) == 0 OK (* 4) == 4 OK (*) == 1 OK (- 3 4) == -1 OK (- 3 4 5) == -6 OK (- 3) == -3 OK (/ 3 4 5) == 0.15 OK (/ 3) == 0.333333333333333 OK (complex? 3) OK (real? 3) OK (rational? 0.6) OK (rational? 2) OK (integer? 3) OK (integer? 2) OK (max 3 4) == 4 OK (max 3.9 4) == 4 OK (abs -7) == 7 OK (modulo 13 4) == 1 OK (remainder 13 4) == 1 OK (modulo -13 4) == 3 OK (remainder -13 4) == -1 OK (modulo 13 -4) == -3 OK (remainder 13 -4) == 1 OK (modulo -13 -4) == -1 OK (remainder -13 -4) == -1 OK (remainder -13 -4) == -1 OK (floor -4.3) == -5 OK (ceiling -4.3) == -4 OK (truncate -4.3) == -4 OK (round -4.3) == -4 OK (floor 3.5) == 3 OK (ceiling 3.5) == 4 OK (truncate 3.5) == 3 OK (round 3.5) == 4 OK (round 3.5) == 4 OK (round 7) == 7 OK (gcd 32 -36) == 4 OK (gcd) == 0 OK (lcm 32 -36) == 288 OK (lcm 32 -36) == 288 OK (lcm) == 1 OK (<= (char->integer #\a) (char->integer #\b)) OK (char<=? (integer->char 115) (integer->char 116)) OK (symbol->string (quote flying-fish)) == flying-fish OK (symbol->string (quote Martin)) == Martin OK (symbol->string (string->symbol "Malvina")) == Malvina OK (not (eq? (quote mISSISSIppi) (quote mississippi))) OK (string->symbol "mISSISSIppi") == mISSISSIppi OK (not (eq? (quote bitBlt) (string->symbol "bitBlt"))) FAIL (string->symbol (symbol->string (quote JollyWog))) == Jo ... OK (symbol->string (string->symbol "K. Harper, M.D.")) == K ... OK (vector-ref (quote #(1 1 2 3 5 8 13 21)) 5) == 8 OK (vector-ref (quote #(1 1 2 3 5 8 13 21)) (let ((i (round ... OK (let ((vec (vector 0 (quote (2 2 2 2)) "Anna"))) (vector ... OK (vector->list (quote #(dah dah didah))) == (dah dah didah) OK (list->vector (quote (dididit dah))) == #(dididit dah) OK (apply + (list 3 4)) == 7 OK ((compose sqrt *) 12 75) == 30 OK (map cadr (quote ((a b) (d e) (g h)))) == (b e h) OK (map (lambda (n) (expt n n)) (quote (1 2 3 4 5))) == (1 ... OK (map + (quote (1 2 3)) (quote (4 5 6))) == (5 7 9) OK (let ((count 0)) (map (lambda (ignored) (set! count (+ c ... OK (let ((v (make-vector 5))) (for-each (lambda (i) (vector ... OK n == 3 OK (map (cut + 1 <>) (quote #(1 2 3))) == (2 3 4) OK (call-with-current-continuation (lambda (exit) (for-each ... OK (list-length (quote (1 2 3 4))) == 4 OK (not (list-length (quote (a b . c)))) OK (let ((path (quote ())) (c #f)) (let ((add (lambda (s) ( ... OK (force (delay (+ 1 2))) == 3 OK (let ((p (delay (+ 1 2)))) (list (force p) (force p))) = ... OK (head (tail (tail a-stream))) == 2 OK (force p) == 6 OK (begin (set! x 10) (force p)) == 6 OK (let ((number 10) (radix 16)) (eqv? number (string->numb ... OK (string->number "100") == 100 OK (string->number "100" 16) == 256 OK (string->number "1e2") == 100 OK (string->number "15##") == 1500 OK (not (string->number "abc")) OK (string->number "123") == 123 OK (string->number "#e123") == 123 OK (string->number "#i123") == 123 OK (string->number "#xff") == 255 OK (string->number "#o23") == 19 OK (string->number "#b+1111") == 15 OK (string->number "#e#b1111") == 15 OK (not (string->number "#e#b1111x")) OK (not (string->number "#e#b1111.2")) OK (string->number "1111.2") == 1111.2 OK (string->number "11#1.2") == 1101.2 OK (string->number "200/100") == 2 OK (string->number "#x10/2") == 8 OK (string->number "1e3") == 1000 OK (not (string->number "1e3" 16)) FAIL (string->number "-.##1") == -0.001 OK (not (string->number "-.##1abc")) OK ((native (%host-ref "foo")) (callback (lambda (x) (set! ... OK done OK (with-input-from-string " (1 2 #(3 a) "testfoo" . b) ... OK ((o (cut + <> 2) (cut * <> 2)) 20) == 42 OK ((const 42)) == 42 OK (id 42) == 42 OK (not ((compl (const #t)) 42)) OK ---------------------------------------------------------------------- tests succeded: 204 tests failed: 3 total number of tests: 207 =================================== 0001-loop.js 21 10000 =================================== 0002-fac.js 3628800 =================================== 0003-r4rstest.js SECTION(2 1) SECTION(3 4) # # # # # # # # # (#t #f #f #f #f #f #f #f #f)#t (#t #f #f #f #f #f #f #f #f)#f (#f #t #f #f #f #f #f #f #f)#\a (#f #f #t #f #f #f #f #f #f)() (#f #f #f #t #f #f #f #f #f)9739 (#f #f #f #f #t #f #f #f #f)(test) (#f #f #f #f #f #t #f #f #f)# (#f #f #f #f #f #f #t #f #f)"test" (#f #f #f #f #f #f #t #f #f)"" (#f #f #f #f #f #f #f #t #f)test (#f #f #f #f #f #f #f #f #t)#() (#f #f #f #f #f #f #f #f #t)#(a b c) SECTION(4 1 2) (quote (quote a)) ==> (quote a) (quote (quote a)) ==> (quote a) SECTION(4 1 3) (# 3 4) ==> 12 SECTION(4 1 4) (# 4) ==> 8 (# 7 10) ==> 3 (# 6) ==> 10 (# 3 4 5 6) ==> (3 4 5 6) (# 3 4 5 6) ==> (5 6) SECTION(4 1 5) (if yes) ==> yes (if no) ==> no (if 1) ==> 1 SECTION(4 1 6) (define 3) ==> 3 (set! 5) ==> 5 SECTION(4 2 1) (cond greater) ==> greater (cond equal) ==> equal (cond 2) ==> 2 (case composite) ==> composite (case consonant) ==> consonant (and #t) ==> #t (and #f) ==> #f (and (f g)) ==> (f g) (and #t) ==> #t (or #t) ==> #t (or #t) ==> #t (or #f) ==> #f (or #f) ==> #f (or (b c)) ==> (b c) SECTION(4 2 2) (let 6) ==> 6 (let 35) ==> 35 (let* 70) ==> 70 (letrec #t) ==> #t (let 5) ==> 5 (let 34) ==> 34 (let 6) ==> 6 (let 34) ==> 34 (let* 7) ==> 7 (let* 34) ==> 34 (let* 8) ==> 8 (let* 34) ==> 34 (letrec 9) ==> 9 (letrec 34) ==> 34 (letrec 10) ==> 10 (letrec 34) ==> 34 SECTION(4 2 3) (begin 6) ==> 6 SECTION(4 2 4) (do #(0 1 2 3 4)) ==> #(0 1 2 3 4) (do 25) ==> 25 (let 1) ==> 1 (let ((6 1 3) (-5 -2))) ==> ((6 1 3) (-5 -2)) (let -1) ==> -1 SECTION(4 2 6) (quasiquote (list 3 4)) ==> (list 3 4) (quasiquote (list a (quote a))) ==> (list a (quote a)) (quasiquote (a 3 4 5 6 b)) ==> (a 3 4 5 6 b) (quasiquote ((foo 7) . cons)) ==> ((foo 7) . cons) (quasiquote #(10 5 2 4 3 8)) ==> #(10 5 2 4 3 8) (quasiquote 5) ==> 5 (quasiquote (a (quasiquote (b (unquote (+ 1 2)) (unquote (foo 4 d)) e)) f)) ==> (a (quasiquote (b (unquote (+ 1 2)) (unquote (foo 4 d)) e)) f) (quasiquote (a (quasiquote (b (unquote x) (unquote (quote y)) d)) e)) ==> (a (quasiquote (b (unquote x) (unquote (quote y)) d)) e) (quasiquote (list 3 4)) ==> (list 3 4) (quasiquote (quasiquote (list (unquote (+ 1 2)) 4))) ==> (quasiquote (list (unquote (+ 1 2)) 4)) SECTION(5 2 1) (define 6) ==> 6 (define 1) ==> 1 SECTION(5 2 2) (#) ==> 5 (define 34) ==> 34 (#) ==> 5 (define 34) ==> 34 (# 88) ==> 88 (# 4) ==> 4 (define 34) ==> 34 (internal-define 99) ==> 99 (internal-define 77) ==> 77 SECTION(6 1) (# #t) ==> #f (# 3) ==> #f (# (3)) ==> #f (# #f) ==> #t (# ()) ==> #f (# ()) ==> #f (# nil) ==> #f SECTION(6 2) (# a a) ==> #t (# a b) ==> #f (# 2 2) ==> #t (# () ()) ==> #t (# 10000 10000) ==> #t (# (1 . 2) (1 . 2)) ==> #f (# # #) ==> #f (# #f nil) ==> #f (# # #) ==> #t (# # #) ==> #t (# # #) ==> #f (# # #) ==> #f (# a a) ==> #t (# (a) (a)) ==> #f (# () ()) ==> #t (# (a) (a)) ==> #t (# #() #()) ==> #t (# # #) ==> #t (# a a) ==> #t (# (a) (a)) ==> #t (# (a (b) c) (a (b) c)) ==> #t (# "abc" "abc") ==> #t (# 2 2) ==> #t (# #(a a a a a) #(a a a a a)) ==> #t SECTION(6 3) (dot (a b c d e)) ==> (a b c d e) (# (a b c)) ==> #t (set-cdr! (a . 4)) ==> (a . 4) (# (a . 4) (a . 4)) ==> #t (dot (a b c . d)) ==> (a b c . d) (# (a . 4)) ==> #f (list? #f) ==> #f (# a ()) ==> (a) (# (a) (b c d)) ==> ((a) b c d) (# "a" (b c)) ==> ("a" b c) (# a 3) ==> (a . 3) (# (a b) c) ==> ((a b) . c) (# (a b c)) ==> a (# ((a) b c d)) ==> (a) (# (1 . 2)) ==> 1 (# ((a) b c d)) ==> (b c d) (# (1 . 2)) ==> 2 (# a 7 c) ==> (a 7 c) (#) ==> () (# (a b c)) ==> 3 (# (a (b) (c d e))) ==> 3 (# ()) ==> 0 (# (x) (y)) ==> (x y) (# (a) (b c d)) ==> (a b c d) (# (a (b)) ((c))) ==> (a (b) (c)) (#) ==> () (# (a b) (c . d)) ==> (a b c . d) (# () a) ==> a (# (a b c)) ==> (c b a) (# (a (b c) d (e (f)))) ==> ((e (f)) d (b c) a) (# (a b c d) 2) ==> c (# a (a b c)) ==> (a b c) (# b (a b c)) ==> (b c) (# a (b c d)) ==> #f (# (a) (b (a) c)) ==> #f (# (a) (b (a) c)) ==> ((a) c) (# 101 (100 101 102)) ==> (101 102) (# a ((a 1) (b 2) (c 3))) ==> (a 1) (# b ((a 1) (b 2) (c 3))) ==> (b 2) (# d ((a 1) (b 2) (c 3))) ==> #f (# (a) (((a)) ((b)) ((c)))) ==> #f (# (a) (((a)) ((b)) ((c)))) ==> ((a)) (# 5 ((2 3) (5 7) (11 13))) ==> (5 7) SECTION(6 4) (# a) ==> #t (string->symbol #t) ==> #t BUT EXPECTED #f (# "JollyWog") ==> JollyWog SECTION(6 5 5) (# 3) ==> #t (# 3) ==> #t (# 3) ==> #t (# 3) ==> #t (# 3) ==> #t (# 3) ==> #t (# 3) ==> #f (# 22 22 22) ==> #t (# 22 22) ==> #t (# 34 34 35) ==> #f (# 34 35) ==> #f (# 3 -6246) ==> #t (# 9 9 -2424) ==> #f (# 3 -4 -6246) ==> #t (# 9 9) ==> #t (# 8 9) ==> #f (# -1 2 3 4 5 6 7 8) ==> #t (# -1 2 3 4 4 5 6 7) ==> #f (# -1 2 3 4 5 6 7 8) ==> #t (# -1 2 3 4 4 5 6 7) ==> #t (# 1 3 2) ==> #f (# 1 3 2) ==> #f (# 0) ==> #t (# 1) ==> #f (# -1) ==> #f (# -100) ==> #f (# 4) ==> #t (# -4) ==> #f (# 0) ==> #f (# 4) ==> #f (# -4) ==> #t (# 0) ==> #f (# 3) ==> #t (# 2) ==> #f (# -4) ==> #f (# -1) ==> #t (# 3) ==> #f (# 2) ==> #t (# -4) ==> #t (# -1) ==> #f (# 34 5 7 38 6) ==> 38 (# 3 5 5 330 4 -24) ==> -24 (# 3 4) ==> 7 (# 3) ==> 3 (#) ==> 0 (# 4) ==> 4 (#) ==> 1 (# 3 4) ==> -1 (# 3) ==> -3 (# -7) ==> 7 (# 7) ==> 7 (# 0) ==> 0 (# 35 7) ==> 5 (# -35 7) ==> -5 (# 35 -7) ==> -5 (# -35 -7) ==> 5 (# 13 4) ==> 1 (# 13 4) ==> 1 (# -13 4) ==> 3 (# -13 4) ==> -1 (# 13 -4) ==> -3 (# 13 -4) ==> 1 (# -13 -4) ==> -1 (# -13 -4) ==> -1 (# 0 86400) ==> 0 (# 0 -86400) ==> 0 (# 238 9) ==> #t (# -238 9) ==> #t (# 238 -9) ==> #t (# -238 -9) ==> #t (# 0 4) ==> 4 (# -4 0) ==> 4 (# 32 -36) ==> 4 (#) ==> 0 (# 32 -36) ==> 288 (#) ==> 1 SECTION(6 5 5) 1 (# "+#.#") ==> #t (# "-#.#") ==> #t (# "#.#") ==> #t (# "1/0") ==> #t (# "-1/0") ==> #t (# "0/0") ==> #t (# "+1/0i") ==> #t (# "-1/0i") ==> #t (# "0/0i") ==> #t (# "0/0-0/0i") ==> #t (# "1/0-1/0i") ==> #t (# "-1/0+1/0i") ==> #t (# "#i") ==> #t (# "#e") ==> #t (# "#") ==> #t (# "#i0/0") ==> #t SECTION(6 5 9) (# 0) ==> "0" (# 100) ==> "100" (# 256 16) ==> "100" (# "100") ==> 100 (# "100" 16) ==> 256 (# "") ==> #f (# ".") ==> #f (# "d") ==> #f (# "D") ==> #f (# "i") ==> #f (# "I") ==> #f (# "3i") ==> #f (# "3I") ==> #f (# "33i") ==> #f (# "33I") ==> #f (# "3.3i") ==> #f (# "3.3I") ==> #f (# "-") ==> #f (# "+") ==> #f (string->number #t) ==> #t (string->number #t) ==> #t SECTION(6 6) (# #\a) ==> #t (# #\() ==> #t (# #\space) ==> #t (# #\newline) ==> #t (# #\A #\B) ==> #f (# #\a #\b) ==> #f (# #\9 #\0) ==> #f (# #\A #\A) ==> #t (# #\A #\B) ==> #t (# #\a #\b) ==> #t (# #\9 #\0) ==> #f (# #\A #\A) ==> #f (# #\A #\B) ==> #f (# #\a #\b) ==> #f (# #\9 #\0) ==> #t (# #\A #\A) ==> #f (# #\A #\B) ==> #t (# #\a #\b) ==> #t (# #\9 #\0) ==> #f (# #\A #\A) ==> #t (# #\A #\B) ==> #f (# #\a #\b) ==> #f (# #\9 #\0) ==> #t (# #\A #\A) ==> #t (# #\A #\B) ==> #f (# #\a #\B) ==> #f (# #\A #\b) ==> #f (# #\a #\b) ==> #f (# #\9 #\0) ==> #f (# #\A #\A) ==> #t (# #\A #\a) ==> #t (# #\A #\B) ==> #t (# #\a #\B) ==> #t (# #\A #\b) ==> #t (# #\a #\b) ==> #t (# #\9 #\0) ==> #f (# #\A #\A) ==> #f (# #\A #\a) ==> #f (# #\A #\B) ==> #f (# #\a #\B) ==> #f (# #\A #\b) ==> #f (# #\a #\b) ==> #f (# #\9 #\0) ==> #t (# #\A #\A) ==> #f (# #\A #\a) ==> #f (# #\A #\B) ==> #t (# #\a #\B) ==> #t (# #\A #\b) ==> #t (# #\a #\b) ==> #t (# #\9 #\0) ==> #f (# #\A #\A) ==> #t (# #\A #\a) ==> #t (# #\A #\B) ==> #f (# #\a #\B) ==> #f (# #\A #\b) ==> #f (# #\a #\b) ==> #f (# #\9 #\0) ==> #t (# #\A #\A) ==> #t (# #\A #\a) ==> #t (# #\a) ==> #t (# #\A) ==> #t (# #\z) ==> #t (# #\Z) ==> #t (# #\0) ==> #f (# #\9) ==> #f (# #\space) ==> #f (# #\;) ==> #f (# #\a) ==> #f (# #\A) ==> #f (# #\z) ==> #f (# #\Z) ==> #f (# #\0) ==> #t (# #\9) ==> #t (# #\space) ==> #f (# #\;) ==> #f (# #\a) ==> #f (# #\A) ==> #f (# #\z) ==> #f (# #\Z) ==> #f (# #\0) ==> #f (# #\9) ==> #f (# #\space) ==> #t (# #\;) ==> #f (# #\0) ==> #f (# #\9) ==> #f (# #\space) ==> #f (# #\;) ==> #f (# #\0) ==> #f (# #\9) ==> #f (# #\space) ==> #f (# #\;) ==> #f (# 46) ==> #\. (# 65) ==> #\A (# 97) ==> #\a (# #\A) ==> #\A (# #\a) ==> #\A (# #\A) ==> #\a (# #\a) ==> #\a SECTION(6 7) (# "The word "recursion\" has many meanings.") ==> #t (string-set! "?**") ==> "?**" (# #\a #\b #\c) ==> "abc" (#) ==> "" (# "abc") ==> 3 (# "abc" 0) ==> #\a (# "abc" 2) ==> #\c (# "") ==> 0 (# "ab" 0 0) ==> "" (# "ab" 1 1) ==> "" (# "ab" 2 2) ==> "" (# "ab" 0 1) ==> "a" (# "ab" 1 2) ==> "b" (# "ab" 0 2) ==> "ab" (# "foo" "bar") ==> "foobar" (# "foo") ==> "foo" (# "foo" "") ==> "foo" (# "" "foo") ==> "foo" (#) ==> "" (# 0) ==> "" (# "" "") ==> #t (# "" "") ==> #f (# "" "") ==> #f (# "" "") ==> #t (# "" "") ==> #t (# "" "") ==> #t (# "" "") ==> #f (# "" "") ==> #f (# "" "") ==> #t (# "" "") ==> #t (# "A" "B") ==> #f (# "a" "b") ==> #f (# "9" "0") ==> #f (# "A" "A") ==> #t (# "A" "B") ==> #t (# "a" "b") ==> #t (# "9" "0") ==> #f (# "A" "A") ==> #f (# "A" "B") ==> #f (# "a" "b") ==> #f (# "9" "0") ==> #t (# "A" "A") ==> #f (# "A" "B") ==> #t (# "a" "b") ==> #t (# "9" "0") ==> #f (# "A" "A") ==> #t (# "A" "B") ==> #f (# "a" "b") ==> #f (# "9" "0") ==> #t (# "A" "A") ==> #t (# "A" "B") ==> #f (# "a" "B") ==> #f (# "A" "b") ==> #f (# "a" "b") ==> #f (# "9" "0") ==> #f (# "A" "A") ==> #t (# "A" "a") ==> #t (# "A" "B") ==> #t (# "a" "B") ==> #t (# "A" "b") ==> #t (# "a" "b") ==> #t (# "9" "0") ==> #f (# "A" "A") ==> #f (# "A" "a") ==> #f (# "A" "B") ==> #f (# "a" "B") ==> #f (# "A" "b") ==> #f (# "a" "b") ==> #f (# "9" "0") ==> #t (# "A" "A") ==> #f (# "A" "a") ==> #f (# "A" "B") ==> #t (# "a" "B") ==> #t (# "A" "b") ==> #t (# "a" "b") ==> #t (# "9" "0") ==> #f (# "A" "A") ==> #t (# "A" "a") ==> #t (# "A" "B") ==> #f (# "a" "B") ==> #f (# "A" "b") ==> #f (# "a" "b") ==> #f (# "9" "0") ==> #t (# "A" "A") ==> #t (# "A" "a") ==> #t SECTION(6 8) (# #(0 (2 2 2 2) "Anna")) ==> #t (# a b c) ==> #(a b c) (#) ==> #() (# #(0 (2 2 2 2) "Anna")) ==> 3 (# #()) ==> 0 (# #(1 1 2 3 5 8 13 21) 5) ==> 8 (vector-set #(0 ("Sue" "Sue") "Anna")) ==> #(0 ("Sue" "Sue") "Anna") (# 2 hi) ==> #(hi hi) (# 0) ==> #() (# 0 a) ==> #() SECTION(6 9) (# #) ==> #t (# #) ==> #t (# (lambda (x) (* x x))) ==> #f (# #) ==> #t (# # (3 4)) ==> 7 (# # (3 4)) ==> 7 (# # 10 (3 4)) ==> 17 (# # ()) ==> () (# 12 75) ==> 30 (# # ((a b) (d e) (g h))) ==> (b e h) (# # (1 2 3) (4 5 6)) ==> (5 7 9) (# # (1 2 3)) ==> (1 2 3) (# # (1 2 3)) ==> (1 2 3) (# # (1 2 3)) ==> (-1 -2 -3) (for-each #(0 1 4 9 16)) ==> #(0 1 4 9 16) (# #) ==> -3 (# (1 2 3 4)) ==> 4 (# (a b . c)) ==> #f (# # ()) ==> () SECTION(6 10 1) (# #) ==> #t (# #) ==> #t errors were: (SECTION (got expected (call))) ((6 4) (#t #f (string->symbol #t))) To fully test continuations, Scheme 4, and DELAY/FORCE do: (test-cont) (test-sc4) (test-delay) ;testing continuations; SECTION(6 9) (# (a (b (c))) ((a) b c)) ==> #t (# (a (b (c))) ((a) b c d)) ==> #f errors were: (SECTION (got expected (call))) ((6 4) (#t #f (string->symbol #t))) ;testing scheme 4 functions; SECTION(6 7) (# "P l") ==> (#\P #\space #\l) (# "") ==> () (# (#\1 #\\ #\")) ==> "1\"" (# ()) ==> "" SECTION(6 8) (# #(dah dah didah)) ==> (dah dah didah) (# #()) ==> () (# (dididit dah)) ==> #(dididit dah) (# ()) ==> #() errors were: (SECTION (got expected (call))) ((6 4) (#t #f (string->symbol #t))) ;testing DELAY and FORCE; SECTION(6 9) (delay 3) ==> 3 (delay (3 3)) ==> (3 3) (delay 2) ==> 2 (# #) ==> 6 (# #) ==> 6 #) ==> 6 (# #) ==> 6 =================================== 0004-r5rs-pitfalls.js Passed: 1.1 Passed: 1.2 Passed: 1.3 Passed: 2.1 Passed: 3.1 Passed: 3.2 Passed: 3.3 Passed: 3.4 Passed: 4.1 Passed: 4.2 Passed: 4.3 Passed: 5.1 Passed: 5.2 Passed: 5.3 Passed: 6.1 Passed: 7.1 Passed: 7.2 Passed: 7.3 Passed: 7.4 Passed: 8.1 Passed: 8.2 Passed: 8.3 Map is call/cc safe, but probably not tail recursive or inefficient. =================================== 0006-ec-test.js (let ((x 0)) (do-of (set! x (+ x 1))) x) => 1 ; correct (let ((x 0)) (do-of (:range i 10) (set! x (+ x 1))) x) => 10 ; correct (let ((x 0)) (do-of (:range n 10) (:range k n) (set! x (+ x 1))) x) => 45 ; correct (list-of 1) => (1) ; correct (list-of (:range i 4) i) => (0 1 2 3) ; correct (list-of (:range n 3) (:range k (+ n 1)) (list n k)) => ((0 0) (1 0) (1 1) (2 0) (2 1) (2 2)) ; correct (list-of (:range n 5) (if (even? n)) (:range k (+ n 1)) (list n k)) => ((0 0) (2 0) (2 1) (2 2) (4 0) (4 1) (4 2) (4 3) (4 4)) ; correct (list-of (:range n 5) (not (even? n)) (:range k (+ n 1)) (list n k)) => ((1 0) (1 1) (3 0) (3 1) (3 2) (3 3)) ; correct (list-of (:range n 5) (and (even? n) (> n 2)) (:range k (+ n 1)) (list n k)) => ((4 0) (4 1) (4 2) (4 3) (4 4)) ; correct (list-of (:range n 5) (or (even? n) (> n 3)) (:range k (+ n 1)) (list n k)) => ((0 0) (2 0) (2 1) (2 2) (4 0) (4 1) (4 2) (4 3) (4 4)) ; correct (let ((x 0)) (list-of (:range n 10) (begin (set! x (+ x 1))) n) x) => 10 ; correct (list-of (nested (:range n 3) (:range k n)) k) => (0 0 1) ; correct (append-of (quote (a b))) => (a b) ; correct (append-of (:range i 0) (quote (a b))) => () ; correct (append-of (:range i 1) (quote (a b))) => (a b) ; correct (append-of (:range i 2) (quote (a b))) => (a b a b) ; correct (string-of #\a) => "a" ; correct (string-of (:range i 0) #\a) => "" ; correct (string-of (:range i 1) #\a) => "a" ; correct (string-of (:range i 2) #\a) => "aa" ; correct (string-append-of "ab") => "ab" ; correct (string-append-of (:range i 0) "ab") => "" ; correct (string-append-of (:range i 1) "ab") => "ab" ; correct (string-append-of (:range i 2) "ab") => "abab" ; correct (vector-of 1) => #(1) ; correct (vector-of (:range i 0) i) => #() ; correct (vector-of (:range i 1) i) => #(0) ; correct (vector-of (:range i 2) i) => #(0 1) ; correct (vector-of-length-of 1 1) => #(1) ; correct (vector-of-length-of 0 (:range i 0) i) => #() ; correct (vector-of-length-of 1 (:range i 1) i) => #(0) ; correct (vector-of-length-of 2 (:range i 2) i) => #(0 1) ; correct (sum-of 1) => 1 ; correct (sum-of (:range i 0) i) => 0 ; correct (sum-of (:range i 1) i) => 0 ; correct (sum-of (:range i 2) i) => 1 ; correct (sum-of (:range i 3) i) => 3 ; correct (product-of 1) => 1 ; correct (product-of (:range i 1 0) i) => 1 ; correct (product-of (:range i 1 1) i) => 1 ; correct (product-of (:range i 1 2) i) => 1 ; correct (product-of (:range i 1 3) i) => 2 ; correct (product-of (:range i 1 4) i) => 6 ; correct (min-of 1) => 1 ; correct (min-of (:range i 1) i) => 0 ; correct (min-of (:range i 2) i) => 0 ; correct (max-of 1) => 1 ; correct (max-of (:range i 1) i) => 0 ; correct (max-of (:range i 2) i) => 1 ; correct (first-of #f 1) => 1 ; correct (first-of #f (:range i 0) i) => #f ; correct (first-of #f (:range i 1) i) => 0 ; correct (first-of #f (:range i 2) i) => 0 ; correct (let ((last-i -1)) (first-of #f (:range i 10) (begin (set! last-i i)) i) last-i) => 0 ; correct (last-of #f 1) => 1 ; correct (last-of #f (:range i 0) i) => #f ; correct (last-of #f (:range i 1) i) => 0 ; correct (last-of #f (:range i 2) i) => 1 ; correct (any-of #f) => #f ; correct (any-of #t) => #t ; correct (any-of (:range i 2 2) (even? i)) => #f ; correct (any-of (:range i 2 3) (even? i)) => #t ; correct (every-of #f) => #f ; correct (every-of #t) => #f ; *** wrong ***, desired result: => #t (every-of (:range i 2 2) (even? i)) => #t ; correct (every-of (:range i 2 3) (even? i)) => #t ; correct (every-of (:range i 2 4) (even? i)) => #f ; correct (let ((sum-sqr (lambda (x result) (+ result (* x x))))) (fold-of 0 (:range i 10) i sum-sqr)) => 285 ; correct (let ((minus-1 (lambda (x) (- x 1))) (sum-sqr (lambda (x result) (+ result (* x x))))) (fold3-of (error "wrong") (:range i 10) i minus-1 sum-sqr)) => 284 ; correct (fold3-of (quote infinity) (:range i 0) i min min) => infinity ; correct (list-of (:list x (quote ())) x) => () ; correct (list-of (:list x (quote (1))) x) => (1) ; correct (list-of (:list x (quote (1 2 3))) x) => (1 2 3) ; correct (list-of (:list x (quote (1)) (quote (2))) x) => (1 2) ; correct (list-of (:list x (quote (1)) (quote (2)) (quote (3))) x) => (1 2 3) ; correct (list-of (:string c "") c) => () ; correct (list-of (:string c "1") c) => (#\1) ; correct (list-of (:string c "123") c) => (#\1 #\2 #\3) ; correct (list-of (:string c "1" "2") c) => (#\1 #\2) ; correct (list-of (:string c "1" "2" "3") c) => (#\1 #\2 #\3) ; correct (list-of (:vector x (vector)) x) => () ; correct (list-of (:vector x (vector 1)) x) => (1) ; correct (list-of (:vector x (vector 1 2 3)) x) => (1 2 3) ; correct (list-of (:vector x (vector 1) (vector 2)) x) => (1 2) ; correct (list-of (:vector x (vector 1) (vector 2) (vector 3)) x) => (1 2 3) ; correct (list-of (:range x -2) x) => () ; correct (list-of (:range x -1) x) => () ; correct (list-of (:range x 0) x) => () ; correct (list-of (:range x 1) x) => (0) ; correct (list-of (:range x 2) x) => (0 1) ; correct (list-of (:range x 0 3) x) => (0 1 2) ; correct (list-of (:range x 1 3) x) => (1 2) ; correct (list-of (:range x -2 -1) x) => (-2) ; correct (list-of (:range x -2 -2) x) => () ; correct (list-of (:range x 1 5 2) x) => (1 3) ; correct (list-of (:range x 1 6 2) x) => (1 3 5) ; correct (list-of (:range x 5 1 -2) x) => (5 3) ; correct (list-of (:range x 6 1 -2) x) => (6 4 2) ; correct (list-of (:real-range x 0 3) x) => (0 1 2) ; correct (list-of (:real-range x 0 3) x) => (0 1 2) ; correct (list-of (:real-range x 0 3 1) x) => (0 1 2) ; correct (string-of (:char-range c #\a #\z) c) => "abcdefghijklmnopqrstuvwxyz" ; correct (list-of (:do ((i 0)) (< i 4) ((+ i 1))) i) => (0 1 2 3) ; correct (list-of (:do (let ((x (quote x)))) ((i 0)) (< i 4) (let ((j (- 10 i)))) #t ((+ i 1))) j) => (10 9 8 7) ; correct (list-of (:let x 1) x) => (1) ; correct (list-of (:let x 1) (:let y (+ x 1)) y) => (2) ; correct (list-of (:let x 1) (:let x (+ x 1)) x) => (2) ; correct (list-of (:parallel (:range i 1 10) (:list x (quote (a b c)))) (list i x)) => ((1 a) (2 b) (3 c)) ; correct (list-of (:while (:range i 1 10) (< i 5)) i) => (1 2 3 4) ; correct (list-of (:until (:range i 1 10) (>= i 5)) i) => (1 2 3 4 5) ; correct (list-of (:while (:list i (quote (1 2 3 4 5 6 7 8 9))) (< i 5)) i) => (1 2 3 4) ; correct (list-of (:until (:list i (quote (1 2 3 4 5 6 7 8 9))) (>= i 5)) i) => (1 2 3 4 5) ; correct (list-of (:while (:vector x (index i) (quote #(1 2 3 4 5))) (< x 10)) x) => (1 2 3 4 5) ; correct (list-of (:while (:parallel (:range i 1 10) (:list j (quote (1 2 3 4 5 6 7 8 9)))) (< i 5)) (list i j)) => ((1 1) (2 2) (3 3) (4 4)) ; correct (list-of (:until (:parallel (:range i 1 10) (:list j (quote (1 2 3 4 5 6 7 8 9)))) (>= i 5)) (list i j)) => ((1 1) (2 2) (3 3) (4 4) (5 5)) ; correct (let ((n 0)) (do-of (:while (:range i 1 10) (begin (set! n (+ n 1)) (< i 5))) (if #f #f)) n) => 5 ; correct (let ((n 0)) (do-of (:until (:range i 1 10) (begin (set! n (+ n 1)) (>= i 5))) (if #f #f)) n) => 5 ; correct (let ((n 0)) (do-of (:while (:parallel (:range i 1 10) (:do () (begin (set! n (+ n 1)) #t) ())) (< i 5)) (if #f #f)) n) => 5 ; correct (let ((n 0)) (do-of (:until (:parallel (:range i 1 10) (:do () (begin (set! n (+ n 1)) #t) ())) (>= i 5)) (if #f #f)) n) => 5 ; correct (list-of (: c (quote (a b))) c) => (a b) ; correct (list-of (: c (quote (a b)) (quote (c d))) c) => (a b c d) ; correct (list-of (: c "ab") c) => (#\a #\b) ; correct (list-of (: c "ab" "cd") c) => (#\a #\b #\c #\d) ; correct (list-of (: c (vector (quote a) (quote b))) c) => (a b) ; correct (list-of (: c (vector (quote a) (quote b)) (vector (quote c))) c) => (a b c) ; correct (list-of (: i 0) i) => () ; correct (list-of (: i 1) i) => (0) ; correct (list-of (: i 10) i) => (0 1 2 3 4 5 6 7 8 9) ; correct (list-of (: i 1 2) i) => (1) ; correct (list-of (: i 1 2 3) i) => (1) ; correct (list-of (: i 1 9 3) i) => (1 4 7) ; correct (list-of (: i 0 1 0.2) i) => (0 0.2 0.4 0.6000000000000001 0.8) ; correct (list-of (: c #\a #\c) c) => (#\a #\b #\c) ; correct (list-of (:list c (index i) (quote (a b))) (list c i)) => ((a 0) (b 1)) ; correct (list-of (:string c (index i) "a") (list c i)) => ((#\a 0)) ; correct (list-of (:vector c (index i) (vector (quote a))) (list c i)) => ((a 0)) ; correct (list-of (:range i (index j) 0 -3 -1) (list i j)) => ((0 0) (-1 1) (-2 2)) ; correct (list-of (:real-range i (index j) 0 1 0.2) (list i j)) => ((0 0) (0.2 1) (0.4 2) (0.6000000000000001 3) (0.8 4)) ; correct (list-of (:char-range c (index i) #\a #\c) (list c i)) => ((#\a 0) (#\b 1) (#\c 2)) ; correct (list-of (: x (index i) (quote (a b c d))) (list x i)) => ((a 0) (b 1) (c 2) (d 3)) ; correct (list-of (: i 5) (* i i)) => (0 1 4 9 16) ; correct (list-of (: n 1 4) (: i n) (list n i)) => ((1 0) (2 0) (2 1) (3 0) (3 1) (3 2)) ; correct (list-of (: x (index i) "abc") (list x i)) => ((#\a 0) (#\b 1) (#\c 2)) ; correct (list-of (:string c (index i) "a" "b") (cons c i)) => ((#\a . 0) (#\b . 1)) ; correct (list-of (:range x 5) (:range x x) x) => (0 0 1 0 1 2 0 1 2 3) ; correct (list-of (:list x (quote (2 "23" (4)))) (: y x) y) => (0 1 #\2 #\3 4) ; correct (list-of (:parallel (:integers x) (:do ((i 10)) (< x i) ((- i 1)))) (list x i)) => ((0 10) (1 9) (2 8) (3 7) (4 6)) ; correct (factorial 0) => 1 ; correct (factorial 1) => 1 ; correct (factorial 3) => 6 ; correct (factorial 5) => 120 ; correct (eratosthenes 50) => (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47) ; correct (length (eratosthenes 5000)) => 669 ; correct (pythagoras 15) => ((3 4 5) (5 12 13) (6 8 10) (9 12 15)) ; correct (length (pythagoras 100)) finished.