Merge pull request #148 from zeptometer/fix-filter-map

fix bug that filter-map fails when called with multiple clists
This commit is contained in:
Yuichi Nishiwaki
2014-06-26 13:23:24 +09:00
+4 -9
View File
@@ -387,15 +387,10 @@
(reverse! acc)))))
(define (filter-map f clist . clists)
(if (null? clists)
(let rec ((clist clist) (cont values))
(if (null? clist)
(cont '())
(rec (cdr clist)
(let ((it (f (car clist))))
(if it
(lambda (x) (cont (cons it x)))
(lambda (x) (cont x)))))))))
(let recur ((l (apply map f clist clists)))
(cond ((null? l) '())
((car l) (cons (car l) (recur (cdr l))))
(else (recur (cdr l))))))
(export map for-each
fold unfold pair-fold reduce