From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Cassou Newsgroups: gmane.emacs.bugs Subject: bug#57561: Improve documentation of seq-position Date: Sat, 03 Sep 2022 18:52:54 +0200 Message-ID: <87h71ofli1.fsf@cassou.me> References: <87mtbgfw95.fsf@cassou.me> <87r10sbn5r.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3002"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57561@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 03 18:54:35 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oUWPi-0000c5-HY for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Sep 2022 18:54:34 +0200 Original-Received: from localhost ([::1]:38276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUWPh-0005Ib-Lm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Sep 2022 12:54:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUWPC-0005G2-To for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2022 12:54:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUWPC-0004BM-Kh for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2022 12:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUWPC-0004Y2-HM for bug-gnu-emacs@gnu.org; Sat, 03 Sep 2022 12:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Damien Cassou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Sep 2022 16:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57561 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 57561-submit@debbugs.gnu.org id=B57561.166222398117364 (code B ref 57561); Sat, 03 Sep 2022 16:54:02 +0000 Original-Received: (at 57561) by debbugs.gnu.org; 3 Sep 2022 16:53:01 +0000 Original-Received: from localhost ([127.0.0.1]:42815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUWOD-0004Vt-5I for submit@debbugs.gnu.org; Sat, 03 Sep 2022 12:53:01 -0400 Original-Received: from mail.choca.pics ([80.67.172.235]:47648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUWOA-0004Vh-SP for 57561@debbugs.gnu.org; Sat, 03 Sep 2022 12:52:59 -0400 Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 8B5E5181942A0; Sat, 3 Sep 2022 18:52:56 +0200 (CEST) Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id mNpULBKgv3EI; Sat, 3 Sep 2022 18:52:55 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [IPv6:::1]) by mail.choca.pics (Postfix) with ESMTP id 9FEB5181942A3; Sat, 3 Sep 2022 18:52:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at choca.pics Original-Received: from mail.choca.pics ([IPv6:::1]) by localhost (mail.choca.pics [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id r7to5wyo_bFp; Sat, 3 Sep 2022 18:52:55 +0200 (CEST) Original-Received: from localhost (153.226.95.79.rev.sfr.net [79.95.226.153]) by mail.choca.pics (Postfix) with ESMTPSA id 43A55181942A0; Sat, 3 Sep 2022 18:52:55 +0200 (CEST) In-Reply-To: <87r10sbn5r.fsf@gnus.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241429 Archived-At: --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > Damien Cassou writes: >> - "Return the index of the first element in SEQUENCE that is equal to ELT. >> -Equality is defined by TESTFN if non-nil or by `equal' if nil." >> + "Return the (zero-based) index of the first element in SEQUENCE that is equal to ELT. > > This makes the first line too long. Indeed. I applied the change suggested by Eli. Also, the same sentence appeared several times in the file so the patch changes them all. -- Damien Cassou "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Improve-documentation-of-seq-position.patch >From c198f7233081ddaee0e0f7c9872f58f602e37186 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Sat, 3 Sep 2022 14:56:53 +0200 Subject: [PATCH] Improve documentation of seq-position * doc/lispref/sequences.texi (Sequence Functions): * lisp/emacs-lisp/seq.el (seq-position): Use more standard wording in the documentation of `seq-position'. --- doc/lispref/sequences.texi | 2 +- lisp/emacs-lisp/seq.el | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 1f6f80521c..cc956952d6 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -863,7 +863,7 @@ Sequence Functions @end defun @defun seq-position sequence elt &optional function - This function returns the index of the first element in + This function returns the (zero-based) index of the first element in @var{sequence} that is equal to @var{elt}. If the optional argument @var{function} is non-@code{nil}, it is a function of two arguments to use instead of the default @code{equal}. diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index b6f0f66e5b..23fed13c5d 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -409,7 +409,7 @@ seq-count (cl-defgeneric seq-contains (sequence elt &optional testfn) "Return the first element in SEQUENCE that is equal to ELT. -Equality is defined by TESTFN if non-nil or by `equal' if nil." +Equality is defined by the function TESTFN, which defaults to `equal'." (declare (obsolete seq-contains-p "27.1")) (seq-some (lambda (e) (when (funcall (or testfn #'equal) elt e) @@ -418,7 +418,7 @@ seq-contains (cl-defgeneric seq-contains-p (sequence elt &optional testfn) "Return non-nil if SEQUENCE contains an element equal to ELT. -Equality is defined by TESTFN if non-nil or by `equal' if nil." +Equality is defined by the function TESTFN, which defaults to `equal'." (catch 'seq--break (seq-doseq (e sequence) (let ((r (funcall (or testfn #'equal) e elt))) @@ -429,14 +429,14 @@ seq-contains-p (cl-defgeneric seq-set-equal-p (sequence1 sequence2 &optional testfn) "Return non-nil if SEQUENCE1 and SEQUENCE2 contain the same elements. This does not depend on the order of the elements. -Equality is defined by TESTFN if non-nil or by `equal' if nil." +Equality is defined by the function TESTFN, which defaults to `equal'." (and (seq-every-p (lambda (item1) (seq-contains-p sequence2 item1 testfn)) sequence1) (seq-every-p (lambda (item2) (seq-contains-p sequence1 item2 testfn)) sequence2))) ;;;###autoload (cl-defgeneric seq-position (sequence elt &optional testfn) - "Return the index of the first element in SEQUENCE that is equal to ELT. -Equality is defined by TESTFN if non-nil or by `equal' if nil." + "Return the (zero-based) index of the first element in SEQUENCE equal to ELT. +Equality is defined by the function TESTFN, which defaults to `equal'." (let ((index 0)) (catch 'seq--break (seq-doseq (e sequence) @@ -502,7 +502,7 @@ seq-partition ;;;###autoload (cl-defgeneric seq-union (sequence1 sequence2 &optional testfn) "Return a list of all elements that appear in either SEQUENCE1 or SEQUENCE2. -Equality is defined by TESTFN if non-nil or by `equal' if nil." +Equality is defined by the function TESTFN, which defaults to `equal'." (let* ((accum (lambda (acc elt) (if (seq-contains-p acc elt testfn) acc @@ -514,7 +514,7 @@ seq-union ;;;###autoload (cl-defgeneric seq-intersection (sequence1 sequence2 &optional testfn) "Return a list of the elements that appear in both SEQUENCE1 and SEQUENCE2. -Equality is defined by TESTFN if non-nil or by `equal' if nil." +Equality is defined by the function TESTFN, which defaults to `equal'." (seq-reduce (lambda (acc elt) (if (seq-contains-p sequence2 elt testfn) (cons elt acc) @@ -524,7 +524,7 @@ seq-intersection (cl-defgeneric seq-difference (sequence1 sequence2 &optional testfn) "Return a list of the elements that appear in SEQUENCE1 but not in SEQUENCE2. -Equality is defined by TESTFN if non-nil or by `equal' if nil." +Equality is defined by the function TESTFN, which defaults to `equal'." (seq-reduce (lambda (acc elt) (if (seq-contains-p sequence2 elt testfn) acc -- 2.36.2 --=-=-=--