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:
commit
7b1cc27b08
|
@ -387,15 +387,10 @@
|
||||||
(reverse! acc)))))
|
(reverse! acc)))))
|
||||||
|
|
||||||
(define (filter-map f clist . clists)
|
(define (filter-map f clist . clists)
|
||||||
(if (null? clists)
|
(let recur ((l (apply map f clist clists)))
|
||||||
(let rec ((clist clist) (cont values))
|
(cond ((null? l) '())
|
||||||
(if (null? clist)
|
((car l) (cons (car l) (recur (cdr l))))
|
||||||
(cont '())
|
(else (recur (cdr l))))))
|
||||||
(rec (cdr clist)
|
|
||||||
(let ((it (f (car clist))))
|
|
||||||
(if it
|
|
||||||
(lambda (x) (cont (cons it x)))
|
|
||||||
(lambda (x) (cont x)))))))))
|
|
||||||
|
|
||||||
(export map for-each
|
(export map for-each
|
||||||
fold unfold pair-fold reduce
|
fold unfold pair-fold reduce
|
||||||
|
|
Loading…
Reference in New Issue