From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: seq-some-p and nil Date: Tue, 08 Sep 2015 16:33:07 -0400 Message-ID: References: <1441295429.4215.0@smtp.gmail.com> <87si6vl21r.fsf@petton.fr> <878u8k2vnp.fsf@udel.edu> <878u8i69ok.fsf@petton.fr> <674102d7-0e97-478a-af05-ca6d82c17c28@default> <87mvwym01x.fsf@petton.fr> <87h9n5mloa.fsf@petton.fr> <8737ypm547.fsf@petton.fr> <87twr4lotv.fsf@petton.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1441744439 8754 80.91.229.3 (8 Sep 2015 20:33:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Sep 2015 20:33:59 +0000 (UTC) Cc: Mark Oteiza , Drew Adams , emacs-devel@gnu.org To: Nicolas Petton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 08 22:33:42 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZZPaD-0007uw-M0 for ged-emacs-devel@m.gmane.org; Tue, 08 Sep 2015 22:33:37 +0200 Original-Received: from localhost ([::1]:37322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZPaE-0007sZ-02 for ged-emacs-devel@m.gmane.org; Tue, 08 Sep 2015 16:33:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZPaA-0007sN-T9 for emacs-devel@gnu.org; Tue, 08 Sep 2015 16:33:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZPa7-0004sp-JT for emacs-devel@gnu.org; Tue, 08 Sep 2015 16:33:34 -0400 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:48794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZPa7-0004s6-7d for emacs-devel@gnu.org; Tue, 08 Sep 2015 16:33:31 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id A108B24231; Tue, 8 Sep 2015 16:33:30 -0400 (EDT) Original-Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 83EAB1E5B9B; Tue, 8 Sep 2015 16:33:07 -0400 (EDT) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 66F69B4145; Tue, 8 Sep 2015 16:33:07 -0400 (EDT) In-Reply-To: <87twr4lotv.fsf@petton.fr> (Nicolas Petton's message of "Tue, 08 Sep 2015 20:59:24 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 132.204.24.67 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189741 Archived-At: >>>> then in most cases, I think the code ends up just as simple with >>>> seq-some as with seq-find. >> [...] >>> To make things easier to understand, I'm taking the example of finding >>> the first odd number in a seq: >> I've never needed to do that. > That was just an example. You never needed to find an element from > a sequence? On its own, no; only to do something with it. So I think in many cases you can cheaply move the equivalent of (and x) into the seq-some search, in many other cases you can instead cheaply move the processing of the result into the seq-some search. Of course, there are still remaining cases where you'll end up needing (lambda (x) (if (my-pred x) x)), but in my experience, it's not frequent enough to make a seq-find useful. This said, we have lots of such functions I find useless, so don't let that prevent you from adding it to seq.el. Just don't forget to warn about its little semantic problem with nil in the docstring. Stefan