From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Petton Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] sequence manipulation functions Date: Fri, 21 Nov 2014 13:40:42 +0100 Message-ID: <87y4r4wwtx.fsf@gmail.com> 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 1416573667 26652 80.91.229.3 (21 Nov 2014 12:41:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Nov 2014 12:41:07 +0000 (UTC) Cc: Bozhidar Batsov , Emacs developers To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 21 13:41:01 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 1XrnWH-00030c-6i for ged-emacs-devel@m.gmane.org; Fri, 21 Nov 2014 13:41:01 +0100 Original-Received: from localhost ([::1]:40329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrnWG-0002sV-Dc for ged-emacs-devel@m.gmane.org; Fri, 21 Nov 2014 07:41:00 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrnW7-0002sO-0K for emacs-devel@gnu.org; Fri, 21 Nov 2014 07:40:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrnW2-00074S-6b for emacs-devel@gnu.org; Fri, 21 Nov 2014 07:40:50 -0500 Original-Received: from mail-lb0-x22c.google.com ([2a00:1450:4010:c04::22c]:49518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrnW1-000746-Mx for emacs-devel@gnu.org; Fri, 21 Nov 2014 07:40:45 -0500 Original-Received: by mail-lb0-f172.google.com with SMTP id u10so3949782lbd.17 for ; Fri, 21 Nov 2014 04:40:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-type; bh=PbWKkKnIxwNNsMYxEoZc16242TefV2/NBMqGWSU0jaI=; b=p7js2aqKvdhW48Mz+hYJmKISvjxGX+8/EzT+vlPcI2F8LrvlgVuN3POGww3SORodKx 9yX6PVdt0GPmbPkE//IRMpAgj1U9yh/zy9jvblTjL+bdc1btjaMJVZlapGj9xcQgAubo e2O0QJwBpSk9C86kWJyw+IDxCQuuLcJUn2vOu6ZXpqKXEw+FMa4ERnrz+7YrOm8ct7Gd n/kAuHqeKDljzOjWBAOO2QLdgS6UQKJaghJnMlsHJS7vonBivNwZarMVuvgZiDTKZNpK Av/0ZtiXI9QG+1zvX7HFUQEnkvjKm/h7LgvnFefJP9rEK8XLzUz43ioFkaWOAFcPs+oT q41A== X-Received: by 10.153.7.170 with SMTP id dd10mr4289957lad.44.1416573644108; Fri, 21 Nov 2014 04:40:44 -0800 (PST) Original-Received: from blueberry (31-211-216-84.customers.ownit.se. [31.211.216.84]) by mx.google.com with ESMTPSA id e10sm1161148lbq.1.2014.11.21.04.40.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Nov 2014 04:40:43 -0800 (PST) User-agent: mu4e 0.9.9.6pre3; emacs 24.3.1 In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22c 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:177940 Archived-At: Stefan Monnier writes: >> +(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'. Indeed. > >> + "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. Ok, I will do that. > >> 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). The macro could use to "dolist" if the sequence is a list. > > Otherwise, it looks fine, thank you, > > > Stefan -- Nicolas Petton http://nicolas-petton.fr