map handles mismatched list lengths when the first list isn't the shortest

This commit is contained in:
Alex Shinn 2011-11-27 21:43:58 +09:00
parent b84dba8425
commit a4bd018480

View file

@ -76,7 +76,7 @@
(map1 proc (cdr ls) (cons (proc (car ls)) res))
(reverse res)))
(define (mapn proc lol res)
(if (pair? (car lol))
(if (every pair? lol)
(mapn proc
(map1 cdr lol '())
(cons (apply1 proc (map1 car lol '())) res))