Issue #367 - Allow list-copy to return non-lists

This commit is contained in:
Justin Ethier 2020-05-13 15:33:39 -04:00
parent fcf6b04e78
commit 380641ddda

View file

@ -808,8 +808,12 @@
'()
(cons obj (make (- n 1) obj) )))))
(make k x)))
(define (list-copy lst)
(foldr (lambda (x y) (cons x y)) '() lst))
(define (list-copy ls)
(let lp ((ls ls) (res '()))
(if (pair? ls)
(lp (cdr ls) (cons (car ls) res))
(append (reverse res) ls))))
;; Implementation of receive from SRFI 8
(define-syntax receive
(er-macro-transformer