mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-14 05:12:38 -08:00
Add yet inactive expansion of MEMBER for constant, short lists
This commit is contained in:
parent
c90d6ed6bb
commit
a03830bf04
1 changed files with 13 additions and 0 deletions
|
|
@ -174,6 +174,19 @@
|
|||
key-flag test-flag test)
|
||||
(seq-opt-parse-args 'member sequence-args :start-end nil)
|
||||
(unless key-flag
|
||||
#+(or)
|
||||
(when (and (or (null test) (constant-function-expression test))
|
||||
(constant-expression-p list))
|
||||
(when (<= (length (setf list (cmp-eval list))) 4)
|
||||
(return-from expand-member
|
||||
(ext:with-unique-names (%value)
|
||||
`(let ((,%value ,value))
|
||||
(or ,@(loop for l on list
|
||||
for elt = (first l)
|
||||
collect `(and ,(funcall test-function %value `',elt)
|
||||
',l))))))
|
||||
(when (or (consp list) (symbol list))
|
||||
(setf list `',list))))
|
||||
(when (or (null test-flag) (eq test-flag :test))
|
||||
(when (member test '('EQ #'EQ) :test #'equal)
|
||||
(return-from expand-member
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue