2014-07-22 08:35:03 -04:00
|
|
|
(import (scheme base)
|
|
|
|
(picrin control list)
|
|
|
|
(picrin test))
|
|
|
|
|
|
|
|
(test '(1 2 3)
|
|
|
|
(for
|
2015-07-19 02:13:17 -04:00
|
|
|
(in '(1 2 3))))
|
2014-07-22 08:35:03 -04:00
|
|
|
|
2015-07-19 02:13:17 -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))))
|
2015-07-19 02:13:17 -04:00
|
|
|
(cons n c))))
|
2014-07-22 08:54:02 -04:00
|
|
|
|
2015-07-19 02:13:17 -04:00
|
|
|
(define (fail) (in zero))
|
|
|
|
|
|
|
|
(test '((2 . a) (2 . b) (2 . c))
|
2014-07-22 08:54:02 -04:00
|
|
|
(for
|
|
|
|
(let ((n (in '(1 2 3)))
|
|
|
|
(c (in '(a b c))))
|
|
|
|
(if (even? n)
|
2015-07-19 02:13:17 -04:00
|
|
|
(cons n c)
|
|
|
|
(fail)))))
|