From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Philipp Stephani
Newsgroups: gmane.emacs.help
Subject: Re: return first element in list with certain property
Date: Tue, 21 Nov 2017 18:01:40 +0000
Message-ID:
References: <8660a60zjn.fsf@zoho.com>
<87mv3gzndx.fsf@ericabrahamsen.net>
<86ine4y7jy.fsf@zoho.com> <874lpozk0y.fsf@ericabrahamsen.net>
<8660a4xuou.fsf@zoho.com>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1511287340 22527 195.159.176.226 (21 Nov 2017 18:02:20 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 21 Nov 2017 18:02:20 +0000 (UTC)
To: help-gnu-emacs@gnu.org
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 21 19:02:15 2017
Return-path:
Envelope-to: geh-help-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
by blaine.gmane.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1eHCs8-0005LU-ER
for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Nov 2017 19:02:12 +0100
Original-Received: from localhost ([::1]:35843 helo=lists.gnu.org)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from )
id 1eHCsF-0005To-Lz
for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Nov 2017 13:02:19 -0500
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45660)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1eHCro-0005Ta-Jk
for help-gnu-emacs@gnu.org; Tue, 21 Nov 2017 13:01:53 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1eHCrn-0005Rl-OS
for help-gnu-emacs@gnu.org; Tue, 21 Nov 2017 13:01:52 -0500
Original-Received: from mail-qk0-x234.google.com ([2607:f8b0:400d:c09::234]:39228)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
(Exim 4.71) (envelope-from )
id 1eHCrn-0005RW-LE
for help-gnu-emacs@gnu.org; Tue, 21 Nov 2017 13:01:51 -0500
Original-Received: by mail-qk0-x234.google.com with SMTP id w125so13244095qkb.6
for ; Tue, 21 Nov 2017 10:01:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=gTCFx57hgOQ8XnYakMKc7fkmqmv7CmhEtj2lefhptUI=;
b=HZXPssNQ8ukpMb3KX8IJGk9zs0aQPKvgrNTQavwrxR8Nu9/QPvvfrgoWqNpD/EgZPw
FaqCU+w75CgTwofrGWAMZRMIeZBRiIeTptpQKF/DjFrHxBfhMT5UFr/yGa3TxP2IFP6/
NVGk63rCzzNLtmuiOdaxpUldvT/OTzeFCUSmuNFdBmAeJrAJ3FVM2DT2BdCjovLFsWmY
uhmCKd170q+Lt4qw4oK/365eNlGtg4ywg2Zgvxh1/LgDbY5bKSnFUZprUqAt7cxvULdp
GGQjP0CE3h8TtOjAMysqBLtvxpH+Vk6fgkgi9Ff9uAwODu6qxt6jftAoHM9K5e4LaYMH
1y2A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=gTCFx57hgOQ8XnYakMKc7fkmqmv7CmhEtj2lefhptUI=;
b=kG7np8NClAs8knpUyqElWYWc63NLqsHww0KyqO+gVOCn9ljMjf6oK6+c+TirzGZnWI
IjwTeBpIfrP5JTUr9zmlFD5SqRjppyQanICj53xLb2qTCWTRzj8yycU7Z+q79HA3y7xO
Rhztk8PV5EAvW7hwtE/s/CvYXk2eXNjkMiFnu+CYWAV8M8itNcGrX5x7SJOD1ZsOeQdV
Vc6FMsQxdZZ9oZtDofbDE8cWwu+YwsLToQKKYSuwQqJFdIImljIcjesDft4mg9DDFI7G
t0klkAEY+nWePE5i9mq8qsPgtEZphsOAKvVXsIA9EN9lOidJnHFaWn15HoxRV9ZEIAeO
MZoA==
X-Gm-Message-State: AJaThX5QdUxxt7GcyL0lrmQiZ5VKzxn3nGmUARRasXqR5g/KJWT47JIK
NXsXXOAFnzCQVZSAYndrRMyXnC92snw6BsalAJUvjg==
X-Google-Smtp-Source: AGs4zMaeQZbjZbA0czwztutLLt2U1rncohZeOPwv7TcQ2byg41ybjXUHUGgbwbpEXYOHWqdQY1PqJ048OsI2QSOn5+I=
X-Received: by 10.55.5.210 with SMTP id 201mr15023552qkf.151.1511287310512;
Tue, 21 Nov 2017 10:01:50 -0800 (PST)
In-Reply-To: <8660a4xuou.fsf@zoho.com>
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
recognized.
X-Received-From: 2607:f8b0:400d:c09::234
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Users list for the GNU Emacs text editor
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "help-gnu-emacs"
Xref: news.gmane.org gmane.emacs.help:115032
Archived-At:
Emanuel Berg schrieb am Di., 21. Nov. 2017 um 02:55 Uhr:
> Eric Abrahamsen wrote:
>
> > In that case there will be less difference
> > between the two: as Drew noted, `cl-find-if'
> > will traverse the list twice, which only
> > becomes a big problem if the desired element
> > is at the end of the list.
>
> It doesn't have to be a problem, it is bizarre
> as it is. Thanks for mentioning it, I'll change
> to `seq-find'.
>
> See, my intuition was right, seq-find *is*
> better even tho you guys are in denial about
> it :)
>
Please consider Knuth's statement about premature optimization. Until your
users have actually complained about the speed of your product and you have
benchmarked it and isolated cl-find-if as the culprit, there's no need to
micro-optimize. Presumably cl-find-if has performed two iterations for
years or decades without anybody being bothered enough to improve it.