[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: What to use instead of find-if?
From: |
Drew Adams |
Subject: |
RE: What to use instead of find-if? |
Date: |
Tue, 2 Dec 2008 16:58:45 -0800 |
> > There are no doubt lots of ways to do it. Here's one:
> > (defun my-find-if (pred xs)
> > (catch 'my-found
> > (dolist (x xs) (when (funcall pred x) (throw 'my-found x)))
> > nil))
>
> Ahah. That's neat! (And is indeed the semantics I had in mind when I
> wrote the original).
>
> Now, this really isn't relevant to the original question, but
> I was just wondering: what are the performance costs of (catch )
> in elisp? For example, should one think twice before using it in
> syntax highlighting code or the like?
Sorry, I can't answer that.
My guess is that it is very performant.
I know that I don't think twice about using it.
But then I don't think twice about a lot of things. ;-)