Re: Effeciency of any predicate
- From: André Thieme <address.good.until.2007.may.12@xxxxxxxxxxx>
- Date: Wed, 28 Feb 2007 16:34:11 +0100
S. Robert James schrieb:
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?
Others toly you about SOME, but you could also say:
(defun any (predicate list)
(when list
(or (funcall predicate (first list))
(any predicate (rest list)))))
André
--
.
- References:
- Effeciency of any predicate
- From: S. Robert James
- Effeciency of any predicate
- Prev by Date: Re: A style question
- Next by Date: Re: A style question
- Previous by thread: Re: Effeciency of any predicate
- Next by thread: "The Swine before Perl" location?
- Index(es):
Relevant Pages
|