Test output for srfi-42 [ok]

Testing time: 3s

'/usr/home/chicken/salmonella/build/salmonella-run-publish/chicken/bin/csi' -script run.scm < /dev/null 2>&1

(let ((x 0)) (do-ec (set! x (+ x 1))) x)
  => 1 ; correct

(let ((x 0)) (do-ec (:range i 10) (set! x (+ x 1))) x)
  => 10 ; correct

(let ((x 0)) (do-ec (:range n 10) (:range k n) (set! x (+ x 1))) x)
  => 45 ; correct

(list-ec 1)
  => (1) ; correct

(list-ec (:range i 4) i)
  => (0 1 2 3) ; correct

(list-ec (:range n 3) (:range k (+ n 1)) (list n k))
  => ((0 0) (1 0) (1 1) (2 0) (2 1) (2 2)) ; correct

(list-ec (: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-ec (: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-ec (: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-ec (: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-ec (:range n 10) (begin (set! x (+ x 1))) n) x)
  => 10 ; correct

(list-ec (nested (:range n 3) (:range k n)) k)
  => (0 0 1) ; correct

(append-ec (quote (a b)))
  => (a b) ; correct

(append-ec (:range i 0) (quote (a b)))
  => () ; correct

(append-ec (:range i 1) (quote (a b)))
  => (a b) ; correct

(append-ec (:range i 2) (quote (a b)))
  => (a b a b) ; correct

(string-ec #\a)
  => "a" ; correct

(string-ec (:range i 0) #\a)
  => "" ; correct

(string-ec (:range i 1) #\a)
  => "a" ; correct

(string-ec (:range i 2) #\a)
  => "aa" ; correct

(string-append-ec "ab")
  => "ab" ; correct

(string-append-ec (:range i 0) "ab")
  => "" ; correct

(string-append-ec (:range i 1) "ab")
  => "ab" ; correct

(string-append-ec (:range i 2) "ab")
  => "abab" ; correct

(vector-ec 1)
  => #(1) ; correct

(vector-ec (:range i 0) i)
  => #() ; correct

(vector-ec (:range i 1) i)
  => #(0) ; correct

(vector-ec (:range i 2) i)
  => #(0 1) ; correct

(vector-of-length-ec 1 1)
  => #(1) ; correct

(vector-of-length-ec 0 (:range i 0) i)
  => #() ; correct

(vector-of-length-ec 1 (:range i 1) i)
  => #(0) ; correct

(vector-of-length-ec 2 (:range i 2) i)
  => #(0 1) ; correct

(sum-ec 1)
  => 1 ; correct

(sum-ec (:range i 0) i)
  => 0 ; correct

(sum-ec (:range i 1) i)
  => 0 ; correct

(sum-ec (:range i 2) i)
  => 1 ; correct

(sum-ec (:range i 3) i)
  => 3 ; correct

(product-ec 1)
  => 1 ; correct

(product-ec (:range i 1 0) i)
  => 1 ; correct

(product-ec (:range i 1 1) i)
  => 1 ; correct

(product-ec (:range i 1 2) i)
  => 1 ; correct

(product-ec (:range i 1 3) i)
  => 2 ; correct

(product-ec (:range i 1 4) i)
  => 6 ; correct

(min-ec 1)
  => 1 ; correct

(min-ec (:range i 1) i)
  => 0 ; correct

(min-ec (:range i 2) i)
  => 0 ; correct

(max-ec 1)
  => 1 ; correct

(max-ec (:range i 1) i)
  => 0 ; correct

(max-ec (:range i 2) i)
  => 1 ; correct

(first-ec #f 1)
  => 1 ; correct

(first-ec #f (:range i 0) i)
  => #f ; correct

(first-ec #f (:range i 1) i)
  => 0 ; correct

(first-ec #f (:range i 2) i)
  => 0 ; correct

(let ((last-i -1)) (first-ec #f (:range i 10) (begin (set! last-i i)) i) last-i)
  => 0 ; correct

(last-ec #f 1)
  => 1 ; correct

(last-ec #f (:range i 0) i)
  => #f ; correct

(last-ec #f (:range i 1) i)
  => 0 ; correct

(last-ec #f (:range i 2) i)
  => 1 ; correct

(any?-ec #f)
  => #f ; correct

(any?-ec #t)
  => #t ; correct

(any?-ec (:range i 2 2) (even? i))
  => #f ; correct

(any?-ec (:range i 2 3) (even? i))
  => #t ; correct

(every?-ec #f)
  => #f ; correct

(every?-ec #t)
  => #t ; correct

(every?-ec (:range i 2 2) (even? i))
  => #t ; correct

(every?-ec (:range i 2 3) (even? i))
  => #t ; correct

(every?-ec (:range i 2 4) (even? i))
  => #f ; correct

(let ((sum-sqr (lambda (x result) (+ result (* x x))))) (fold-ec 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-ec (error "wrong") (:range i 10) i minus-1 sum-sqr))
  => 284 ; correct

(fold3-ec (quote infinity) (:range i 0) i min min)
  => infinity ; correct

(list-ec (:list x (quote ())) x)
  => () ; correct

(list-ec (:list x (quote (1))) x)
  => (1) ; correct

(list-ec (:list x (quote (1 2 3))) x)
  => (1 2 3) ; correct

(list-ec (:list x (quote (1)) (quote (2))) x)
  => (1 2) ; correct

(list-ec (:list x (quote (1)) (quote (2)) (quote (3))) x)
  => (1 2 3) ; correct

(list-ec (:string c "") c)
  => () ; correct

(list-ec (:string c "1") c)
  => (#\1) ; correct

(list-ec (:string c "123") c)
  => (#\1 #\2 #\3) ; correct

(list-ec (:string c "1" "2") c)
  => (#\1 #\2) ; correct

(list-ec (:string c "1" "2" "3") c)
  => (#\1 #\2 #\3) ; correct

(list-ec (:vector x (vector)) x)
  => () ; correct

(list-ec (:vector x (vector 1)) x)
  => (1) ; correct

(list-ec (:vector x (vector 1 2 3)) x)
  => (1 2 3) ; correct

(list-ec (:vector x (vector 1) (vector 2)) x)
  => (1 2) ; correct

(list-ec (:vector x (vector 1) (vector 2) (vector 3)) x)
  => (1 2 3) ; correct

(list-ec (:range x -2) x)
  => () ; correct

(list-ec (:range x -1) x)
  => () ; correct

(list-ec (:range x 0) x)
  => () ; correct

(list-ec (:range x 1) x)
  => (0) ; correct

(list-ec (:range x 2) x)
  => (0 1) ; correct

(list-ec (:range x 0 3) x)
  => (0 1 2) ; correct

(list-ec (:range x 1 3) x)
  => (1 2) ; correct

(list-ec (:range x -2 -1) x)
  => (-2) ; correct

(list-ec (:range x -2 -2) x)
  => () ; correct

(list-ec (:range x 1 5 2) x)
  => (1 3) ; correct

(list-ec (:range x 1 6 2) x)
  => (1 3 5) ; correct

(list-ec (:range x 5 1 -2) x)
  => (5 3) ; correct

(list-ec (:range x 6 1 -2) x)
  => (6 4 2) ; correct

(list-ec (:real-range x 0.0 3.0) x)
  => (0.0 1.0 2.0) ; correct

(list-ec (:real-range x 0 3.0) x)
  => (0.0 1.0 2.0) ; correct

(list-ec (:real-range x 0 3 1.0) x)
  => (0.0 1.0 2.0) ; correct

(string-ec (:char-range c #\a #\z) c)
  => "abcdefghijklmnopqrstuvwxyz" ; correct

(begin (let ((f (my-open-output-file "tmp1"))) (do-ec (:range n 10) (begin (write n f) (newline f))) (close-output-port f)) (my-call-with-input-file "tmp1" (lambda (port) (list-ec (:port x port read) x))))
  => (0 1 2 3 4 5 6 7 8 9) ; correct

(begin (let ((f (my-open-output-file "tmp1"))) (do-ec (:range n 10) (begin (write n f) (newline f))) (close-output-port f)) (my-call-with-input-file "tmp1" (lambda (port) (list-ec (:port x port) x))))
  => (0 1 2 3 4 5 6 7 8 9) ; correct

(list-ec (:do ((i 0)) (< i 4) ((+ i 1))) i)
  => (0 1 2 3) ; correct

(list-ec (:do (let ((x (quote x)))) ((i 0)) (< i 4) (let ((j (- 10 i)))) #t ((+ i 1))) j)
  => (10 9 8 7) ; correct

(list-ec (:let x 1) x)
  => (1) ; correct

(list-ec (:let x 1) (:let y (+ x 1)) y)
  => (2) ; correct

(list-ec (:let x 1) (:let x (+ x 1)) x)
  => (2) ; correct

(list-ec (:parallel (:range i 1 10) (:list x (quote (a b c)))) (list i x))
  => ((1 a) (2 b) (3 c)) ; correct

(list-ec (:while (:range i 1 10) (< i 5)) i)
  => (1 2 3 4) ; correct

(list-ec (:until (:range i 1 10) (>= i 5)) i)
  => (1 2 3 4 5) ; correct

(list-ec (:while (:list i (quote (1 2 3 4 5 6 7 8 9))) (< i 5)) i)
  => (1 2 3 4) ; correct

(list-ec (:until (:list i (quote (1 2 3 4 5 6 7 8 9))) (>= i 5)) i)
  => (1 2 3 4 5) ; correct

(list-ec (:while (:vector x (index i) (quote #(1 2 3 4 5))) (< x 10)) x)
  => (1 2 3 4 5) ; correct

(list-ec (: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-ec (: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-ec (:while (:range i 1 10) (begin (set! n (+ n 1)) (< i 5))) (if #f #f)) n)
  => 5 ; correct

(let ((n 0)) (do-ec (:until (:range i 1 10) (begin (set! n (+ n 1)) (>= i 5))) (if #f #f)) n)
  => 5 ; correct

(let ((n 0)) (do-ec (: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-ec (:until (:parallel (:range i 1 10) (:do () (begin (set! n (+ n 1)) #t) ())) (>= i 5)) (if #f #f)) n)
  => 5 ; correct

(list-ec (: c (quote (a b))) c)
  => (a b) ; correct

(list-ec (: c (quote (a b)) (quote (c d))) c)
  => (a b c d) ; correct

(list-ec (: c "ab") c)
  => (#\a #\b) ; correct

(list-ec (: c "ab" "cd") c)
  => (#\a #\b #\c #\d) ; correct

(list-ec (: c (vector (quote a) (quote b))) c)
  => (a b) ; correct

(list-ec (: c (vector (quote a) (quote b)) (vector (quote c))) c)
  => (a b c) ; correct

(list-ec (: i 0) i)
  => () ; correct

(list-ec (: i 1) i)
  => (0) ; correct

(list-ec (: i 10) i)
  => (0 1 2 3 4 5 6 7 8 9) ; correct

(list-ec (: i 1 2) i)
  => (1) ; correct

(list-ec (: i 1 2 3) i)
  => (1) ; correct

(list-ec (: i 1 9 3) i)
  => (1 4 7) ; correct

(list-ec (: i 0.0 1.0 0.2) i)
  => (0.0 0.2 0.4 0.6 0.8) ; correct

(list-ec (: c #\a #\c) c)
  => (#\a #\b #\c) ; correct

(begin (let ((f (my-open-output-file "tmp1"))) (do-ec (:range n 10) (begin (write n f) (newline f))) (close-output-port f)) (my-call-with-input-file "tmp1" (lambda (port) (list-ec (: x port read) x))))
  => (0 1 2 3 4 5 6 7 8 9) ; correct

(begin (let ((f (my-open-output-file "tmp1"))) (do-ec (:range n 10) (begin (write n f) (newline f))) (close-output-port f)) (my-call-with-input-file "tmp1" (lambda (port) (list-ec (: x port) x))))
  => (0 1 2 3 4 5 6 7 8 9) ; correct

(list-ec (:list c (index i) (quote (a b))) (list c i))
  => ((a 0) (b 1)) ; correct

(list-ec (:string c (index i) "a") (list c i))
  => ((#\a 0)) ; correct

(list-ec (:vector c (index i) (vector (quote a))) (list c i))
  => ((a 0)) ; correct

(list-ec (:range i (index j) 0 -3 -1) (list i j))
  => ((0 0) (-1 1) (-2 2)) ; correct

(list-ec (:real-range i (index j) 0 1 0.2) (list i j))
  => ((0.0 0) (0.2 1) (0.4 2) (0.6 3) (0.8 4)) ; correct

(list-ec (:char-range c (index i) #\a #\c) (list c i))
  => ((#\a 0) (#\b 1) (#\c 2)) ; correct

(list-ec (: x (index i) (quote (a b c d))) (list x i))
  => ((a 0) (b 1) (c 2) (d 3)) ; correct

(begin (let ((f (my-open-output-file "tmp1"))) (do-ec (:range n 10) (begin (write n f) (newline f))) (close-output-port f)) (my-call-with-input-file "tmp1" (lambda (port) (list-ec (: x (index i) port) (list x i)))))
  => ((0 0) (1 1) (2 2) (3 3) (4 4) (5 5) (6 6) (7 7) (8 8) (9 9)) ; correct

(list-ec (: i 5) (* i i))
  => (0 1 4 9 16) ; correct

(list-ec (: n 1 4) (: i n) (list n i))
  => ((1 0) (2 0) (2 1) (3 0) (3 1) (3 2)) ; correct

(list-ec (: x (index i) "abc") (list x i))
  => ((#\a 0) (#\b 1) (#\c 2)) ; correct

(list-ec (:string c (index i) "a" "b") (cons c i))
  => ((#\a . 0) (#\b . 1)) ; correct

(list-ec (:range x 5) (:range x x) x)
  => (0 0 1 0 1 2 0 1 2 3) ; correct

(list-ec (:list x (quote (2 "23" (4)))) (: y x) y)
  => (0 1 #\2 #\3 4) ; correct

(list-ec (: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 100000))
  => 9592 ; correct

(pythagoras 15)
  => ((3 4 5) (5 12 13) (6 8 10) (9 12 15)) ; correct

(length (pythagoras 200))
  => 127 ; correct

(qsort (quote (1 5 4 2 4 5 3 2 1 3)))
  => (1 1 2 2 3 3 4 4 5 5) ; correct

(pi-BBP 5)
  => 40413742330349316707/12864093722915635200 ; correct

(begin (let ((f (my-open-output-file "tmp1"))) (do-ec (:range n 10) (begin (write n f) (newline f))) (close-output-port f)) (read-lines "tmp1"))
  => ("0\n" "1\n" "2\n" "3\n" "4\n" "5\n" "6\n" "7\n" "8\n" "9\n") ; correct


correct examples : 163
wrong examples   : 0