Effeciency of any predicate



Is there a more efficient way of doing this:

(defun any? (predicate lst)
(if (null lst)
nil
(or (funcall predicate (car lst))
(any? predicate (cdr lst)))))

Does common Lisp have a built in which can reach the same goal?

.



Relevant Pages

  • Re: Partition list with predicate
    ... | I want a function that removes values from a list if a predicate ... If you must modify the list in place, because you have multiple references ... lst = ...
    (comp.lang.python)
  • Re: Effeciency of any predicate
    ... (defun any? ... (predicate lst) ... (or (funcall predicate (car lst)) ... Does common Lisp have a built in which can reach the same goal? ...
    (comp.lang.lisp)
  • Re: Effeciency of any predicate
    ... (predicate lst) ... (or (funcall predicate (car lst)) ... There is also an equivalent in the loop macro, ... In Common Lisp, it's unusual to use the question mark to indicate predicates. ...
    (comp.lang.lisp)
  • Re: Partition list with predicate
    ... Terry Reedy wrote: ... | I want a function that removes values from a list if a predicate evaluates ... Forget the rigamarole you posted, ... lst = ...
    (comp.lang.python)
  • Re: How much intelligence?
    ... and I also think you'd agree that "car not car" is 100% false.Thus the ... think you need to define the mechanics you're using a little better. ... Without a verb no predicate. ... We learned to think logically from tautologies. ...
    (comp.ai.philosophy)