Added (list-copy)

This commit is contained in:
Justin Ethier 2015-03-24 16:01:48 -04:00
parent 8b972b7421
commit 02d0054afc

View file

@ -99,6 +99,8 @@
'()
(cons obj (make (- n 1) obj) )))))
(make k x)))
(define (list-copy lst)
(foldr (lambda (x y) (cons x y)) '() lst))
(define (map func lst)
(foldr (lambda (x y) (cons (func x) y)) '() lst))
(define (for-each f lst)