[alexandria-devel] [PATCH] add MEMQ

Stelian Ionescu sionescu at common-lisp.net
Sat Feb 9 18:13:01 UTC 2008


Hello, the attached patch adds MEMQ.
I think that MEMQ is popular and useful enough that it should be part of
Alexandria.

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
-------------- next part --------------
diff -rN -u old-alexandria/package.lisp new-alexandria/package.lisp
--- old-alexandria/package.lisp	2008-02-09 19:08:24.000000000 +0100
+++ new-alexandria/package.lisp	2008-02-09 19:08:24.000000000 +0100
@@ -93,6 +93,7 @@
    #:map-combinations
    #:map-derangements
    #:map-permutations
+   #:memq
    #:proper-sequence
    #:random-elt
    #:removef
diff -rN -u old-alexandria/sequences.lisp new-alexandria/sequences.lisp
--- old-alexandria/sequences.lisp	2008-02-09 19:08:24.000000000 +0100
+++ new-alexandria/sequences.lisp	2008-02-09 19:08:24.000000000 +0100
@@ -389,3 +389,7 @@
                            (setf (bit mask i) 0))))))
       (derange start size)
       sequence)))
+
+(defun memq (obj list)
+  "Like MEMBER, using #'EQ as test."
+  (member obj list :test #'eq))

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/alexandria-devel/attachments/20080209/fb7e2a6b/attachment.sig>


More information about the alexandria-devel mailing list