diff options
Diffstat (limited to 'test-suite/tests/srfi-1.test')
-rw-r--r-- | test-suite/tests/srfi-1.test | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test-suite/tests/srfi-1.test b/test-suite/tests/srfi-1.test index 8569a3db1..eaad8c961 100644 --- a/test-suite/tests/srfi-1.test +++ b/test-suite/tests/srfi-1.test @@ -1266,6 +1266,28 @@ (equal? '((1 2) (3 4) (5 6)) lst)))))) ;; +;; fold-right +;; + +(with-test-prefix "fold-right" + + (pass-if "one list" + (equal? (iota 10) + (fold-right cons '() (iota 10)))) + + (pass-if "two lists" + (equal? (zip (iota 10) (map integer->char (iota 10))) + (fold-right (lambda (x y z) + (cons (list x y) z)) + '() + (iota 10) + (map integer->char (iota 10))))) + + (pass-if "tail-recursive" + (= 1e6 (fold-right (lambda (x y) (+ 1 y)) + 0 + (iota 1e6))))) +;; ;; unfold ;; |