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: [PATCH] sequence manipulation functions Date: Thu, 20 Nov 2014 18:16:28 -0500 Message-ID: References: <87oasmmwzt.fsf@gmail.com> <87bnolslph.fsf@gmail.com> <87zjc2dic0.fsf@gmail.com> <87ioimtzu0.fsf@gmail.com> <87lhngcnrc.fsf@gmail.com> <87k330cj3u.fsf@gmail.com> <87ioikcf39.fsf@gmail.com> <87h9y4c93e.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1416525427 31562 80.91.229.3 (20 Nov 2014 23:17:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Nov 2014 23:17:07 +0000 (UTC) Cc: Bozhidar Batsov , Emacs developers To: Nicolas Petton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 21 00:17:00 2014 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 1XrayB-0003M5-QE for ged-emacs-devel@m.gmane.org; Fri, 21 Nov 2014 00:16:59 +0100 Original-Received: from localhost ([::1]:37757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrayB-00015x-Bq for ged-emacs-devel@m.gmane.org; Thu, 20 Nov 2014 18:16:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xraxq-00015q-Sy for emacs-devel@gnu.org; Thu, 20 Nov 2014 18:16:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xraxi-0001fp-Rd for emacs-devel@gnu.org; Thu, 20 Nov 2014 18:16:38 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:56828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xraxi-0001fh-O5 for emacs-devel@gnu.org; Thu, 20 Nov 2014 18:16:30 -0500 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id sAKNGSAx032237; Thu, 20 Nov 2014 18:16:28 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 2D0B666A3B; Thu, 20 Nov 2014 18:16:28 -0500 (EST) In-Reply-To: <87h9y4c93e.fsf@gmail.com> (Nicolas Petton's message of "Thu, 13 Nov 2014 00:06:29 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5131=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5131> : inlines <1551> : streams <1345894> : uri <1835481> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:177897 Archived-At: > +(defun seq-filter (pred seq) > + "Return a list of all the elements for which (PRED element) is non-nil in SEQ." > + (delq 'seq--exclude (seq-map (lambda (elt) > + (if (funcall pred elt) > + elt > + 'seq--exclude)) > + seq))) This won't do the right thing if the list includes the symbol `seq--exclude' (which could happen if this function is used by, say, completion code). Better do a (defvar seq--exclude (make-symbol "exclude")) and then use the value of `seq--exclude' rather than the constant `seq--exclude'. > + "Reduce the two-arguments function FUNCTION across SEQ, starting with INITIAL-VALUE. This first line is too long. I guess we need to drop the "two-arguments" part. > I have renamed the library "seq" instead of "sequences". Good. > seq-doseq macro, similar to dolist. Actually seq-doseq is "unusable" on lists: it's O(N^2) instead of O(N). Otherwise, it looks fine, thank you, Stefan