;; of the &REST vars.)
`(lambda (result-type fun ,@seq-args)
(declare (ignore result-type))
- (do ((really-fun (%coerce-callable-to-function fun))
+ (do ((really-fun (%coerce-callable-to-fun fun))
,@index-bindingoids
(acc nil))
((or ,@tests)
(let ((leaf (ref-leaf use)))
(and (global-var-p leaf)
(eq (global-var-kind leaf) :global-function)
- (not (null (member (leaf-name leaf) names :test #'equal))))))))
+ (not (null (member (leaf-source-name leaf) names
+ :test #'equal))))))))
;;; If CONT is a constant continuation, the return the constant value.
;;; If it is null, then return default, otherwise quietly give up the
(return (values find position)))
(when (>= index start)
(when (funcall predicate key-i)
- ;; This hack of dealing with non-NIL FROM-END for list data
- ;; by iterating forward through the list and keeping track of
- ;; the last time we found a match might be more screwy than
- ;; what the user expects, but it seems to be allowed by the
- ;; ANSI standard. (And if the user is screwy enough to ask
- ;; for FROM-END behavior on list data, turnabout is fair play.)
+ ;; This hack of dealing with non-NIL FROM-END for list
+ ;; data by iterating forward through the list and keeping
+ ;; track of the last time we found a match might be more
+ ;; screwy than what the user expects, but it seems to be
+ ;; allowed by the ANSI standard. (And if the user is
+ ;; screwy enough to ask for FROM-END behavior on list
+ ;; data, turnabout is fair play.)
;;
- ;; It's also not enormously efficient, calling PREDICATE and
- ;; KEY more often than necessary; but all the alternatives
- ;; seem to have their own efficiency problems.
+ ;; It's also not enormously efficient, calling PREDICATE
+ ;; and KEY more often than necessary; but all the
+ ;; alternatives seem to have their own efficiency
+ ;; problems.
(if from-end
(setf find i
position index)
:policy (> speed space)
:important t)
"expand inline"
- '(%find-position-if (let ((test-fun (%coerce-callable-to-function test)))
+ '(%find-position-if (let ((test-fun (%coerce-callable-to-fun test)))
+ ;; I'm having difficulty believing I'm
+ ;; reading it right, but as far as I can see,
+ ;; the only guidance that ANSI gives for the
+ ;; order of arguments to asymmetric tests is
+ ;; the character-set dependent example from
+ ;; the definition of FIND,
+ ;; (find #\d "here are some.." :test #'char>)
+ ;; => #\Space
+ ;; (In ASCII, we have (CHAR> #\d #\SPACE)=>T.)
+ ;; (Neither the POSITION definition page nor
+ ;; section 17.2 ("Rules about Test Functions")
+ ;; seem to consider the possibility of
+ ;; asymmetry.)
+ ;;
+ ;; So, judging from the example, we want to
+ ;; do (FUNCALL TEST-FUN ITEM I), because
+ ;; (FUNCALL #'CHAR> #\d #\SPACE)=>T.
+ ;;
+ ;; -- WHN (whose attention was drawn to it by
+ ;; Alexey Dejneka's bug report/fix)
(lambda (i)
- (funcall test-fun i item)))
+ (funcall test-fun item i)))
sequence
from-end
start
end
- (%coerce-callable-to-function key)))
+ (%coerce-callable-to-fun key)))
;;; The inline expansions for the VECTOR case are saved as macros so
;;; that we can share them between the DEFTRANSFORMs and the default
start
end
element
+ ;; (See the LIST transform for a discussion of the correct
+ ;; argument order, i.e. whether the searched-for ,ITEM goes before
+ ;; or after the checked sequence element.)
`(funcall ,test ,item (funcall ,key ,element)))))
(def!macro %find-position-if-vector-macro (predicate sequence