fix bug that filter-map fails when called with multiple clists

This commit is contained in:
Yuito Murase 2014-06-26 09:42:16 +09:00
parent 6c8c46d295
commit d39a2eb4c9
1 changed files with 4 additions and 9 deletions

View File

@ -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