std-position-if | ![]() |
STD-POSITION-IF
returns the first found position (index) the element which matches the predicate pred. pred is a function or lambda list accepting one argument and returning either nil or non-nil.
It returns either an integer number or nil if not found.
(std-position-if 'numberp '(0 1 2 3)) => 0 (std-position-if 'stringp '(0 "1" 2 "3")) => 1 (std-position-if
'(lambda (x)
(or (std-integerp x) (stringp x)))
'(nil 0 "1" 2 "3")) => 1
pred: a function or lambda list accepting one argument and returning either nil or non-nil.
lst: any proper list.
An integer number or nil.
Beware that the predicate pred may produce any side-effects.
(std-require 'STDLIST)
Defined in STDLIST
#- SMALL