From 02d0054afc729d77cdc0fa4d70cee3bee45862e7 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 24 Mar 2015 16:01:48 -0400 Subject: [PATCH] Added (list-copy) --- trans.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trans.scm b/trans.scm index bd122bc3..b87dfeb0 100644 --- a/trans.scm +++ b/trans.scm @@ -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)