summaryrefslogtreecommitdiff
path: root/libguile/alist.c
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2000-07-23 11:50:05 +0000
committerMarius Vollmer <mvo@zagadka.de>2000-07-23 11:50:05 +0000
commit5d2538526626d1948536b7b9df1298771474285f (patch)
treeaaacc5885f1dd3868a5e745c784d8d5501a11c27 /libguile/alist.c
parentff0fd4e4081ae85a5f643728ffcc3c6fc9fcdafd (diff)
downloadguile-5d2538526626d1948536b7b9df1298771474285f.tar.gz
* alist.c (scm_assq_remove_x, scm_assv_remove_x,
scm_assoc_remove_x): Remove all cells whose key is eq, eqv, or equal (respectively) to the argument key, not all cells that are eq, eqv, or equal to the first cell with the argument key. Thanks to Neil Jerram!
Diffstat (limited to 'libguile/alist.c')
-rw-r--r--libguile/alist.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/libguile/alist.c b/libguile/alist.c
index db8602e19..e4f0b0cc5 100644
--- a/libguile/alist.c
+++ b/libguile/alist.c
@@ -331,19 +331,19 @@ SCM_DEFINE (scm_assq_remove_x, "assq-remove!", 2, 0, 0,
(SCM alist, SCM key),
"@deffnx primitive assv-remove! alist key\n"
"@deffnx primitive assoc-remove! alist key\n"
- "Delete any entry in @var{alist} associated with @var{key}, and return\n"
+ "Delete all entries in @var{alist} associated with @var{key}, and return\n"
"the resulting alist.")
#define FUNC_NAME s_scm_assq_remove_x
{
SCM handle;
handle = scm_sloppy_assq (key, alist);
- if (SCM_CONSP (handle))
+ while (SCM_CONSP (handle))
{
- return scm_delq_x (handle, alist);
+ alist = scm_delq_x (handle, alist);
+ handle = scm_sloppy_assq (key, alist);
}
- else
- return alist;
+ return alist;
}
#undef FUNC_NAME
@@ -356,12 +356,12 @@ SCM_DEFINE (scm_assv_remove_x, "assv-remove!", 2, 0, 0,
SCM handle;
handle = scm_sloppy_assv (key, alist);
- if (SCM_CONSP (handle))
+ while (SCM_CONSP (handle))
{
- return scm_delv_x (handle, alist);
+ alist = scm_delq_x (handle, alist);
+ handle = scm_sloppy_assv (key, alist);
}
- else
- return alist;
+ return alist;
}
#undef FUNC_NAME
@@ -374,12 +374,12 @@ SCM_DEFINE (scm_assoc_remove_x, "assoc-remove!", 2, 0, 0,
SCM handle;
handle = scm_sloppy_assoc (key, alist);
- if (SCM_CONSP (handle))
+ while (SCM_CONSP (handle))
{
- return scm_delete_x (handle, alist);
+ alist = scm_delq_x (handle, alist);
+ handle = scm_sloppy_assoc (key, alist);
}
- else
- return alist;
+ return alist;
}
#undef FUNC_NAME