From a03830bf04ca7d1663ef6078b4f27b132929ac41 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sat, 15 May 2010 21:54:53 +0200 Subject: [PATCH] Add yet inactive expansion of MEMBER for constant, short lists --- src/cmp/cmpopt-sequence.lsp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cmp/cmpopt-sequence.lsp b/src/cmp/cmpopt-sequence.lsp index 735972e20..2193c7d73 100644 --- a/src/cmp/cmpopt-sequence.lsp +++ b/src/cmp/cmpopt-sequence.lsp @@ -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