Commit eae51075 authored by Kim F. Storm's avatar Kim F. Storm
Browse files

(member*): Use memql instead of complex code.

Suggested by Miles Bader.
parent 5bde639f
......@@ -2578,21 +2578,7 @@ surrounded by (block NAME ...).
(cl-const-expr-val (nth 1 keys)))))
(cond ((eq test 'eq) (list 'memq a list))
((eq test 'equal) (list 'member a list))
((or (null keys) (eq test 'eql))
(if (eq (cl-const-expr-p a) t)
(list (if (floatp-safe (cl-const-expr-val a)) 'member 'memq)
a list)
(if (eq (cl-const-expr-p list) t)
(let ((p (cl-const-expr-val list)) (mb nil) (mq nil))
(if (not (cdr p))
(and p (list 'eql a (list 'quote (car p))))
(while p
(if (floatp-safe (car p)) (setq mb t)
(or (integerp (car p)) (symbolp (car p)) (setq mq t)))
(setq p (cdr p)))
(if (not mb) (list 'memq a list)
(if (not mq) (list 'member a list) form))))
form)))
((or (null keys) (eq test 'eql)) (list 'memql a list))
(t form))))
(define-compiler-macro assoc* (&whole form a list &rest keys)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment