picrin/contrib/50.for/t/test.scm

24 lines
510 B
Scheme
Raw Normal View History

2014-07-22 08:35:03 -04:00
(import (scheme base)
(picrin control list)
(picrin test))
(test '(1 2 3)
(for
(in '(1 2 3))))
2014-07-22 08:35:03 -04:00
(test '((1 . a) (1 . b) (1 . c) (2 . a) (2 . b) (2 . c) (3 . a) (3 . b) (3 . c))
2014-07-22 08:35:03 -04:00
(for
(let ((n (in '(1 2 3)))
(c (in '(a b c))))
(cons n c))))
(define (fail) (in zero))
(test '((2 . a) (2 . b) (2 . c))
(for
(let ((n (in '(1 2 3)))
(c (in '(a b c))))
(if (even? n)
(cons n c)
(fail)))))