New function ecl_delete_eq

This commit is contained in:
Juan Jose Garcia Ripoll 2011-03-13 21:58:41 +01:00
parent 5fcd784bb9
commit c2935cbb4f
2 changed files with 17 additions and 0 deletions

View file

@ -1053,6 +1053,22 @@ ecl_remove_eq(cl_object x, cl_object l)
return head;
}
cl_object
ecl_delete_eq(cl_object x, cl_object l)
{
cl_object head = l;
cl_object *p = &head;
while (!ECL_ATOM(l)) {
if (ECL_CONS_CAR(l) == x) {
*p = l = ECL_CONS_CDR(l);
} else {
p = &ECL_CONS_CDR(l);
l = *p;
}
}
return head;
}
/* Added for use by the compiler, instead of open coding them. Beppe */
cl_object
ecl_assq(cl_object x, cl_object l)

View file

@ -917,6 +917,7 @@ extern ECL_API cl_object ecl_assql(cl_object x, cl_object l);
extern ECL_API cl_object ecl_assoc(cl_object x, cl_object l);
extern ECL_API cl_object ecl_assqlp(cl_object x, cl_object l);
extern ECL_API cl_object ecl_remove_eq(cl_object x, cl_object l);
extern ECL_API cl_object ecl_delete_eq(cl_object x, cl_object l);
#define si_cons_car cl_car
#define si_cons_cdr cl_cdr