fix bug that filter-map fails when called with multiple clists
This commit is contained in:
parent
6c8c46d295
commit
d39a2eb4c9
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue