From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: Re: seq-some-p and nil Date: Tue, 8 Sep 2015 22:19:59 -0400 Message-ID: <20150909021959.GA1494@holos> References: <878u8i69ok.fsf@petton.fr> <674102d7-0e97-478a-af05-ca6d82c17c28@default> <87mvwym01x.fsf@petton.fr> <87h9n5mloa.fsf@petton.fr> <87zj0xkpx0.fsf@petton.fr> <20150908133729.GA20184@holos> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1441765238 28250 80.91.229.3 (9 Sep 2015 02:20:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Sep 2015 02:20:38 +0000 (UTC) Cc: Nicolas Petton , Drew Adams , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 09 04:20:22 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 1ZZUzk-000679-E3 for ged-emacs-devel@m.gmane.org; Wed, 09 Sep 2015 04:20:20 +0200 Original-Received: from localhost ([::1]:38936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZUzk-0004c0-RI for ged-emacs-devel@m.gmane.org; Tue, 08 Sep 2015 22:20:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZUzX-0004Z7-Q8 for emacs-devel@gnu.org; Tue, 08 Sep 2015 22:20:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZUzS-0001id-TM for emacs-devel@gnu.org; Tue, 08 Sep 2015 22:20:07 -0400 Original-Received: from mail-qg0-f46.google.com ([209.85.192.46]:33922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZUzS-0001gI-PO for emacs-devel@gnu.org; Tue, 08 Sep 2015 22:20:02 -0400 Original-Received: by qgez77 with SMTP id z77so99930952qge.1 for ; Tue, 08 Sep 2015 19:20:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=ke6nAuH07DNAhOS+/rkX5Vvs9u250fL00yKNG5U4UDA=; b=WAiIy0wGehxa4vrhULe2E9bqc2VPnG88+dbr2wwUSk/coR1MW9z9+Kq6TWF/fJjKyY Iq2SIFRP0NDZZB13azmljduPE2cCs4ylSVZ5vxAMcZ0g0nbS73xb/F/n9xzCSPe6Ty2O qzmFLJGrEjZ2fO4QNIOzWMz4K1qM9tgpR5E0gsh83Ucb5cR54cfPH4bZONsr3CCaS2KN IMNwUAXn8Z+3eejRBRQUKZfzS0hG451cTSiAbjko6SHjL1sDT+dQ1je6Q+/TLedrWWYR Z9lZrPja/Pr1jOIsw0KOuD2VRDnqnusEBjwCEGlJMJ7u3biLk2UOdsvTtAq9ZLegzx2K yimA== X-Gm-Message-State: ALoCoQlFIYoOmO5wdGiJDhYFzVmoLTTMTz77OK5s6oorIplEZxctJJtVeNw37wyfhH+oFJyixlIc X-Received: by 10.141.28.6 with SMTP id f6mr42504650qhe.53.1441765201650; Tue, 08 Sep 2015 19:20:01 -0700 (PDT) Original-Received: from holos.localdomain (c-73-128-248-14.hsd1.md.comcast.net. [73.128.248.14]) by smtp.gmail.com with ESMTPSA id f1sm3037999qhe.42.2015.09.08.19.20.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2015 19:20:00 -0700 (PDT) Original-Received: by holos.localdomain (Postfix, from userid 1000) id AD61368971; Tue, 8 Sep 2015 22:19:59 -0400 (EDT) Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24+9 (2dac9fa02842) (2015-08-30) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.46 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:189750 Archived-At: On 08/09/15 at 01:50pm, Stefan Monnier wrote: > > (defun seq-some (pred seq) > > (funcall pred (seq-find (pred seq))) > > But that fails for the case where the element found is nil. Works as expected (cl-defgeneric seq-find (pred seq) (catch 'seq--break (seq-doseq (elt seq) (when (funcall pred elt) (throw 'seq--break elt))) nil)) (cl-defgeneric seq-some (pred seq) (funcall pred (seq-find pred seq))) (seq-find 'null [1 2 nil]) ;; => nil (seq-some 'null [1 2 nil]) ;; => t It's not a "semantic problem" or a "corner case", if one is really curious if their sequence has a nil value, seq-find isn't the way to find out.