summaryrefslogtreecommitdiff
path: root/src/fns.c
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2006-09-20 23:07:17 +0000
committerKim F. Storm <storm@cua.dk>2006-09-20 23:07:17 +0000
commit008ef0efaab24b4d02cb2dfeb82cd050e08a21f3 (patch)
tree486161b4c7e263d4e07fd508a0301785cd483c04 /src/fns.c
parent0aad54a5a0a89c07ed00ab7d4bb8da93705aea7f (diff)
downloademacs-008ef0efaab24b4d02cb2dfeb82cd050e08a21f3.tar.gz
emacs-008ef0efaab24b4d02cb2dfeb82cd050e08a21f3.tar.bz2
emacs-008ef0efaab24b4d02cb2dfeb82cd050e08a21f3.zip
(Fmemq): Refill doc string.
(Fmemql): New defun, like memq but using eql. (syms_of_fns): Defsubr it.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/fns.c b/src/fns.c
index f9f4b72529e..e769f40cc88 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1464,11 +1464,10 @@ The value is actually the tail of LIST whose car is ELT. */)
}
DEFUN ("memq", Fmemq, Smemq, 2, 2, 0,
- doc: /* Return non-nil if ELT is an element of LIST.
-Comparison done with `eq'. The value is actually the tail of LIST
-whose car is ELT. */)
+doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eq'.
+The value is actually the tail of LIST whose car is ELT. */)
(elt, list)
- Lisp_Object elt, list;
+ register Lisp_Object elt, list;
{
while (1)
{
@@ -1491,6 +1490,30 @@ whose car is ELT. */)
return list;
}
+DEFUN ("memql", Fmemql, Smemql, 2, 2, 0,
+doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eql'.
+The value is actually the tail of LIST whose car is ELT. */)
+ (elt, list)
+ register Lisp_Object elt;
+ Lisp_Object list;
+{
+ register Lisp_Object tail;
+
+ if (!FLOATP (elt))
+ return Fmemq (elt, list);
+
+ for (tail = list; !NILP (tail); tail = XCDR (tail))
+ {
+ register Lisp_Object tem;
+ CHECK_LIST_CONS (tail, list);
+ tem = XCAR (tail);
+ if (FLOATP (tem) && internal_equal (elt, tem, 0, 0))
+ return tail;
+ QUIT;
+ }
+ return Qnil;
+}
+
DEFUN ("assq", Fassq, Sassq, 2, 2, 0,
doc: /* Return non-nil if KEY is `eq' to the car of an element of LIST.
The value is actually the first element of LIST whose car is KEY.
@@ -5833,6 +5856,7 @@ used if both `use-dialog-box' and this variable are non-nil. */);
defsubr (&Selt);
defsubr (&Smember);
defsubr (&Smemq);
+ defsubr (&Smemql);
defsubr (&Sassq);
defsubr (&Sassoc);
defsubr (&Srassq);