add simple map.

This commit is contained in:
Jan Nieuwenhuizen 2016-07-09 22:01:13 +02:00
parent 1fe2fb51b1
commit 717ae9cdc1
2 changed files with 8 additions and 0 deletions

View File

@ -92,3 +92,7 @@ EOF
(define-macro (let* bindings . body)
(expand-let* bindings body))
(define (map f l . r)
(cond ((null l) '())
((null r) (cons (f (car l)) (map f (cdr l))))))

View File

@ -98,4 +98,8 @@
(newline)
(display 'let*-dun)
(newline)
(map display '(1 2 3 4))
(newline)
(map '(lambda (x) (display x) (newline)) '(5 6 7 8))
(newline)
'()