summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 796853ec..68a12ae6 100644
--- a/lib.c
+++ b/lib.c
@@ -2796,6 +2796,28 @@ val tailp(val obj, val list)
return t;
}
+val delcons(val cons, val list)
+{
+ val iter = list;
+
+ if (!consp(cons))
+ return list;
+
+ if (cons == iter)
+ return cdr(iter);
+
+ while (consp(iter)) {
+ val d = us_cdr(iter);
+ if (cons == d) {
+ us_rplacd(iter, us_cdr(cons));
+ break;
+ }
+ iter = d;
+ }
+
+ return list;
+}
+
val memq(val obj, val list)
{
val list_orig = list;