1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

SRFI-1: Rewrite `alist-copy' in Scheme.

This partially reverts commit b1fff4e793
(Sat Apr 2 2005).

* libguile/srfi-1.c (scm_srfi1_alist_copy): Remove.
* libguile/srfi-1.h (scm_srfi1_alist_copy): Remove declaration.

* module/srfi/srfi-1.scm (alist-copy): New procedure.
This commit is contained in:
Ludovic Courtès 2010-09-20 00:00:44 +02:00
parent cd99e21cd4
commit 194865d2f7
3 changed files with 9 additions and 36 deletions

View file

@ -664,6 +664,15 @@ CLIST1 ... CLISTN, that satisfies PRED."
(define alist-cons acons)
(define (alist-copy alist)
"Return a copy of ALIST, copying both the pairs comprising the list
and those making the associations."
(let lp ((a alist)
(rl '()))
(if (null? a)
(reverse! rl)
(lp (cdr a) (alist-cons (caar a) (cdar a) rl)))))
(define* (alist-delete key alist #:optional (k= equal?))
(let lp ((a alist) (rl '()))
(if (null? a)