map: support two lists.

This commit is contained in:
Jan Nieuwenhuizen 2016-07-09 22:05:07 +02:00
parent 717ae9cdc1
commit de2e9502cf
2 changed files with 7 additions and 1 deletions

View File

@ -95,4 +95,6 @@ EOF
(define (map f l . r)
(cond ((null l) '())
((null r) (cons (f (car l)) (map f (cdr l))))))
((null r) (cons (f (car l)) (map f (cdr l))))
((null (cdr r))
(cons (f (car l) (caar r)) (map f (cdr l) (cdar r))))))

View File

@ -102,4 +102,8 @@
(newline)
(map '(lambda (x) (display x) (newline)) '(5 6 7 8))
(newline)
(map '(lambda (i a) (display i) (display ':) (display a) (newline)) '(1 2 3 4) '(a b c d))
(newline)
'()