From 055d30c1e64a8debc53dbfa9a48e7629c38b124e Mon Sep 17 00:00:00 2001 From: ram <ram> Date: Wed, 16 May 1990 11:05:58 +0000 Subject: [PATCH] Fixed the MEMBER transform to be correct, and to generate somewhat more straightfoward code (from the compiler's point of view.) Previously we returned T or NIL, rather than the correct tail of the list. --- compiler/seqtran.lisp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/compiler/seqtran.lisp b/compiler/seqtran.lisp index 163d5499c..9bc1f687b 100644 --- a/compiler/seqtran.lisp +++ b/compiler/seqtran.lisp @@ -82,15 +82,22 @@ (deftransform member ((e l &key (test #'eql)) * * :node node) (unless (constant-continuation-p l) (give-up)) - (let ((val (continuation-value l))) + + (let ((val (continuation-value l)) + (if-p (if-p (continuation-dest (node-cont node))))) (unless (policy node (or (= speed 3) (and (>= speed space) (<= (length val) 5)))) (give-up)) - `(or ,@(mapcar #'(lambda (x) `(funcall test e ',x)) - val)))) - + + (labels ((frob (els) + (if els + `(if (funcall test e ',(car els)) + ',(if if-p t els) + ,(frob (cdr els))) + 'nil))) + (frob val)))) #|Inline expansion is available... -- GitLab