mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-28 22:10:29 +02:00
srfi-1 list-copy: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_list_copy): delete. * libguile/srfi-1.h (scm_srfi1_list_copy): delete. * module/srfi/srfi-1.scm: add list-copy. * test-suite/tests/srfi-1.test: ensure copied spine is independent.
This commit is contained in:
parent
6bd70136d9
commit
aa44035ee8
4 changed files with 26 additions and 35 deletions
|
@ -1449,7 +1449,14 @@
|
|||
(pass-if (equal? '(1 . 2) (list-copy '(1 . 2))))
|
||||
(pass-if (equal? '(1 2 . 3) (list-copy '(1 2 . 3))))
|
||||
(pass-if (equal? '(1 2 3 . 4) (list-copy '(1 2 3 . 4))))
|
||||
(pass-if (equal? '(1 2 3 4 . 5) (list-copy '(1 2 3 4 . 5)))))
|
||||
(pass-if (equal? '(1 2 3 4 . 5) (list-copy '(1 2 3 4 . 5))))
|
||||
|
||||
(let ((src (list 1 2 3 4 5)))
|
||||
(define (find-pair? p lst)
|
||||
(let lp ((lst lst))
|
||||
(and (pair? lst) (or (eq? p lst) (lp (cdr lst))))))
|
||||
(pair-for-each (lambda (p) (pass-if (not (find-pair? p src))))
|
||||
(list-copy src))))
|
||||
|
||||
;;
|
||||
;; list-index
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue