From unknown Sat Jun 21 03:23:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23550: 25.0.93; cl.texi (for var on list by func): Fix documentation Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 May 2016 15:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23550 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 23550@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14634135621864 (code B ref -1); Mon, 16 May 2016 15:47:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 May 2016 15:46:02 +0000 Received: from localhost ([127.0.0.1]:53929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2KiX-0000Ti-SY for submit@debbugs.gnu.org; Mon, 16 May 2016 11:46:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2KiW-0000Ox-VA for submit@debbugs.gnu.org; Mon, 16 May 2016 11:46:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2KiQ-0000Lw-OE for submit@debbugs.gnu.org; Mon, 16 May 2016 11:45:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KiQ-0000Ll-Am for submit@debbugs.gnu.org; Mon, 16 May 2016 11:45:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KiO-0000sI-1J for bug-gnu-emacs@gnu.org; Mon, 16 May 2016 11:45:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2KiI-0000KP-Ow for bug-gnu-emacs@gnu.org; Mon, 16 May 2016 11:45:50 -0400 Received: from calancha-ilc.kek.jp ([130.87.234.234]:60097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KiI-0000KG-EQ for bug-gnu-emacs@gnu.org; Mon, 16 May 2016 11:45:46 -0400 Received: by calancha-ilc.kek.jp (Postfix, from userid 500) id 2B0FC640F; Tue, 17 May 2016 00:49:02 +0900 (JST) Received: from localhost (localhost [127.0.0.1]) by calancha-ilc.kek.jp (Postfix) with ESMTP id 14EAC5646 for ; Tue, 17 May 2016 00:49:02 +0900 (JST) Date: Tue, 17 May 2016 00:49:02 +0900 (JST) From: Tino Calancha X-X-Sender: calancha@calancha-ilc.kek.jp Message-ID: User-Agent: Alpine 2.20 (LRH 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) * doc/misc/cl.texi (for var on list by func): Fix documentation 'cl-loop for var on list by func' behaves as in CL: 'on' expression need to be a list. The following tests run in the *scratch* buffer return same values as in SBCL: ;; CL cl-loop -> loop emacs -Q: (require 'cl-lib) (setq preys '("grass" "lion" "rabbit")) (defun next-prey (x) "Return the name of the prey of animal X." (cl-loop while (not (atom x)) do (setq x (car x))) (cond ((member x preys) ; elisp ;; (cond ((member x preys :test #'string=) ; CL (cond ((string= x "lion") "rabbit") ((string= x "rabbit") "grass") (t nil))) (t nil))) (defun next-prey-list (x) "Return a list with the name of the prey of animal X." (let ((res (next-prey x))) (if res (list res) nil))) [A] (mapcar 'next-prey '("grass" "lion" "rabbit")) [B] (mapcar 'next-prey-list '("grass" "lion" "rabbit")) [A] (nil "rabbit" "grass") [B] (nil ("rabbit") ("grass")) [I] (cl-loop for y on preys collect y) [II] (cl-loop for y on preys by #'next-prey collect y) [III] (cl-loop for y on (car preys) by #'next-prey collect y) [IV] (cl-loop for y on (car preys) by #'next-prey-list collect y) [V] (cl-loop for y on preys by #'next-prey-list collect y) [I] (("grass" "lion" "rabbit") ("lion" "rabbit") ("rabbit")) [II] (("grass" "lion" "rabbit")) [III] nil [IV] nil [V] (("grass" "lion" "rabbit")) In GNU Emacs 25.0.93.3 (x86_64-pc-linux-gnu, GTK+ Version 2.24.30) Repository revision: 6de0715f5467d4b925e2dfe082174529ace3b174 >From 3e1756fb4d76e34b74b96782d4509582e9ce0cd3 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Tue, 17 May 2016 00:04:56 +0900 Subject: [PATCH] ; * cl.texi (clause 'for' with 'on'): Fix documentation --- doc/misc/cl.texi | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 4137a95..319592c 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -1956,18 +1956,6 @@ For Clauses @result{} ((1 2 3 4) (2 3 4) (3 4) (4)) @end example -With @code{by}, there is no real reason that the @code{on} expression -must be a list. For example: - -@example -(cl-loop for x on first-animal by 'next-animal collect x) -@end example - -@noindent -where @code{(next-animal x)} takes an ``animal'' @var{x} and returns -the next in the (assumed) sequence of animals, or @code{nil} if -@var{x} was the last animal in the sequence. - @item for @var{var} in-ref @var{list} by @var{function} This is like a regular @code{in} clause, but @var{var} becomes a @code{setf}-able ``reference'' onto the elements of the list -- 2.8.1 From unknown Sat Jun 21 03:23:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23550: 25.0.93; cl.texi (for var on list by func): Fix documentation Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Mar 2017 03:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23550 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: 23550@debbugs.gnu.org Received: via spool by 23550-submit@debbugs.gnu.org id=B23550.149049723029990 (code B ref 23550); Sun, 26 Mar 2017 03:01:01 +0000 Received: (at 23550) by debbugs.gnu.org; 26 Mar 2017 03:00:30 +0000 Received: from localhost ([127.0.0.1]:44860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cryPu-0007ne-2U for submit@debbugs.gnu.org; Sat, 25 Mar 2017 23:00:30 -0400 Received: from mail-it0-f42.google.com ([209.85.214.42]:37463) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cryPs-0007nP-Ov for 23550@debbugs.gnu.org; Sat, 25 Mar 2017 23:00:29 -0400 Received: by mail-it0-f42.google.com with SMTP id 190so23335694itm.0 for <23550@debbugs.gnu.org>; Sat, 25 Mar 2017 20:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=oOr1UNvd+hqb+Gq7DFHKm+OMawuPbUIDe6TxKdgtJWQ=; b=kvKskmNEsuOV6xn7EZqhoscnhHQhSQvrk4f25agNQqxbXSCmgtKaNf8bh7Mwv2hMbX gaMt/9xhK+Pxvihm84TZHv4DP5D64L56tdFXIghr1SWIv/cdPjigCp9rw4QetnF4Asra Kvcff3laC6BabhMNtD2BNtFTVHbcI7aQVsCxWgutAloxmU/pwc8SXJd+cRJJ6niGonTb Rc988cbvj1J8YJE5bgYm7cJJgkZ3BogdLcjUHRRP+tPZwOuNpUMCNSuSQDu6o7akVBAk E2nVHAgOof1v/GSWYmxEmSkyK5jald8QWymrJn4G8ACR8bIUaP9c/K0FfwnlBgMHNw4Q IQTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=oOr1UNvd+hqb+Gq7DFHKm+OMawuPbUIDe6TxKdgtJWQ=; b=nuj95IJUuOsMOzyV4IQz+z2QPCFGlUn87ps74Ii1MlRJ41VnggQ1VX4n0mubFAaoph Siybd5VdeFVxXssDCIWYJ9iEl+ty3T5mNDc4Ekugl7sTcG9k2eBGXQR8mhroC1A/RA5B TMsa3MPsdjkrKAnmhFrDER0qIc+6YHNjdX0TxvjyN1Wo4xwfBwImFCQdfIxaql5/Do2D vVSyoqco7L25YTnle6Q7qdUpPxb3ZMvbZhaJemcMrp6cEJjG2HOz3mky7LnMjW8fEq0G t3GQKW7SBJOTKdl35qesagB5tV/I1ozkcMFAbccy0jvm3CbeAG+WLby+ViEKDQKV5b4Z XI2g== X-Gm-Message-State: AFeK/H0c0CRHd748KVt+T4YutCKsEygvfn12jeafVCoeQ94elyU43uirlVljAdAItk66fQ== X-Received: by 10.107.129.214 with SMTP id l83mr14874791ioi.168.1490497222966; Sat, 25 Mar 2017 20:00:22 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id p6sm3585592iof.12.2017.03.25.20.00.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Mar 2017 20:00:22 -0700 (PDT) From: npostavs@users.sourceforge.net References: Date: Sat, 25 Mar 2017 23:01:45 -0400 In-Reply-To: (Tino Calancha's message of "Tue, 17 May 2016 00:49:02 +0900 (JST)") Message-ID: <874lyg68rq.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Tino Calancha writes: > * doc/misc/cl.texi (for var on list by func): Fix documentation > > 'cl-loop for var on list by func' behaves as in CL: 'on' expression > need to be a list. Well, it only needs to be a cons, because that's what the loop checks for. > > emacs -Q: > > (require 'cl-lib) > (setq preys '("grass" "lion" "rabbit")) > > (defun next-prey (x) > "Return the name of the prey of animal X." > (cl-loop while (not (atom x)) > do (setq x (car x))) > (cond ((member x preys) ; elisp > ;; (cond ((member x preys :test #'string=) ; CL > (cond ((string= x "lion") "rabbit") > ((string= x "rabbit") "grass") > (t nil))) > (t > nil))) > (defun next-prey-list (x) > "Return a list with the name of the prey of animal X." > (let ((res (next-prey x))) > (if res > (list res) > nil))) I guess the idea behind that statement is that the rest of the list can be implied by the stepping function, e.g. (cl-loop for y on (list "lion") by #'next-prey-list collect (car y)) ;=> ("lion" "rabbit" "grass") Works with the "in" clause too: (cl-loop for y in (list "lion") by #'next-prey-list collect y) ;=> ("lion" "rabbit" "grass") I guess it could be useful in combination with streams? Not sure if it's worth having this in the manual. From unknown Sat Jun 21 03:23:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23550: 25.0.93; cl.texi (for var on list by func): Fix documentation Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Mar 2017 13:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23550 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: npostavs@users.sourceforge.net Cc: Tino Calancha , 23550@debbugs.gnu.org Received: via spool by 23550-submit@debbugs.gnu.org id=B23550.14907940111755 (code B ref 23550); Wed, 29 Mar 2017 13:27:01 +0000 Received: (at 23550) by debbugs.gnu.org; 29 Mar 2017 13:26:51 +0000 Received: from localhost ([127.0.0.1]:50275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctDcg-0000SF-Vi for submit@debbugs.gnu.org; Wed, 29 Mar 2017 09:26:51 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctDce-0000S0-79 for 23550@debbugs.gnu.org; Wed, 29 Mar 2017 09:26:48 -0400 Received: by mail-pf0-f181.google.com with SMTP id i5so7735514pfc.2 for <23550@debbugs.gnu.org>; Wed, 29 Mar 2017 06:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=NORYPxsJUAOmdVQsovcn+YSEx7oEXVvVu/lBaOiFd98=; b=sDqjqZVS8OkWG3pjerOwfAm7mHKZ3MLZs3XAXoaFIzVhRatSbCFAgeWRK2Oyc5cuk3 nUMm6bOR0PNTyhRocHVsQ6BgqxHFdQfWfrAdCAJF3KU6cVkw5ku3xfh+p9W2yQjBTADv AlMBeorcQfTPQzfxmxtBQ9hr7oUod9YO7gTeUJ0IeAMnj42UqmUcsXJqnvP+S9v2BAEN MlmHa/QH7F8aPKTicoUF7FY7bqLoYiZE///nwlBO1I1iyASQH3RxBAK8LjGwAO0aABs6 QTeP4sF9wcPhXktlmpUdHRs4wDNiIny9tzHjxCSU8cAs040UpFgRmg+gbGTEWkgY9PH9 wUvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=NORYPxsJUAOmdVQsovcn+YSEx7oEXVvVu/lBaOiFd98=; b=AcHYyhbMLDtNSoCUDw91ZrT6Nnem4K0p8TRpo7j328Oqi2vn/UKUAU/jd3iUiopHeh LjQKwOyfIRVluOsHzd/jXPHzBY/CFveNQrlqZg5w4DgochIcuicP5AZbfnBLP13/Wb3Y jknc48iVQmow6YM3o7iXM3wcBhJl+GZGTpHeSoQ9SnsMthcQNk1dTEqTfWaZWAiCbo4T 3o/qjszdcL0ch4S0d3kLcv1NGkBlVKvD+YZwbfaJTYskXLlfIS3F3yvieo9vWM7uRY/y lsj0vVtMMLFTpfQCChk+GSUzdi5snXoYC5KZZX40JpfAgW02tpFPUJuQ3Au/Pjb2Mqa5 8LFA== X-Gm-Message-State: AFeK/H2u/w6lvY1aZTKP79nmvm/jkHCUx1KaH05r9eAS1cYXVNjbEMPSXJPnkrEmjO3UbA== X-Received: by 10.98.160.212 with SMTP id p81mr517502pfl.204.1490794002617; Wed, 29 Mar 2017 06:26:42 -0700 (PDT) Received: from calancha-pc (234.204.100.220.dy.bbexcite.jp. [220.100.204.234]) by smtp.gmail.com with ESMTPSA id u69sm13746036pfg.121.2017.03.29.06.26.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Mar 2017 06:26:42 -0700 (PDT) From: Tino Calancha References: <874lyg68rq.fsf@users.sourceforge.net> Date: Wed, 29 Mar 2017 22:26:27 +0900 In-Reply-To: <874lyg68rq.fsf@users.sourceforge.net> (npostavs's message of "Sat, 25 Mar 2017 23:01:45 -0400") Message-ID: <87lgroxlh8.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.8 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) npostavs@users.sourceforge.net writes: >> >> emacs -Q: >> >> (require 'cl-lib) >> (setq preys '("grass" "lion" "rabbit")) >> >> (defun next-prey (x) >> "Return the name of the prey of animal X." >> (cl-loop while (not (atom x)) >> do (setq x (car x))) >> (cond ((member x preys) ; elisp >> ;; (cond ((member x preys :test #'string=) ; CL >> (cond ((string= x "lion") "rabbit") >> ((string= x "rabbit") "grass") >> (t nil))) >> (t >> nil))) >> (defun next-prey-list (x) >> "Return a list with the name of the prey of animal X." >> (let ((res (next-prey x))) >> (if res >> (list res) >> nil))) > > I guess the idea behind that statement is that the rest of the list can > be implied by the stepping function, e.g. > > (cl-loop for y on (list "lion") by #'next-prey-list collect (car y)) > ;=> ("lion" "rabbit" "grass") > > Works with the "in" clause too: > > (cl-loop for y in (list "lion") by #'next-prey-list collect y) > ;=> ("lion" "rabbit" "grass") > > I guess it could be useful in combination with streams? Not sure if > it's worth having this in the manual. In the way is written makes me expect that: (cl-loop for y on "lion" by #'next-prey-list collect (car y)) will be evaluated to: ("lion" "rabbit" "grass"). Becase i read in the example first-animal, instead of (list first-animal), and they also write: 'With @code{by}, there is no real reason that the @code{on} expression must be a list.' It might be useful rewrite that part to make it more clear, but i don't have a clear proposal. From unknown Sat Jun 21 03:23:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23550: 25.0.93; cl.texi (for var on list by func): Fix documentation Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Mar 2017 14:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23550 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: Tino Calancha , 23550@debbugs.gnu.org Received: via spool by 23550-submit@debbugs.gnu.org id=B23550.14907964206767 (code B ref 23550); Wed, 29 Mar 2017 14:07:01 +0000 Received: (at 23550) by debbugs.gnu.org; 29 Mar 2017 14:07:00 +0000 Received: from localhost ([127.0.0.1]:51409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctEFY-0001l5-Jq for submit@debbugs.gnu.org; Wed, 29 Mar 2017 10:07:00 -0400 Received: from mail-it0-f46.google.com ([209.85.214.46]:38348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctEFX-0001kq-9x for 23550@debbugs.gnu.org; Wed, 29 Mar 2017 10:06:59 -0400 Received: by mail-it0-f46.google.com with SMTP id y18so58169993itc.1 for <23550@debbugs.gnu.org>; Wed, 29 Mar 2017 07:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=AAWELmRkkfJ6LmVcVPNs9jCJmYeyHaZq4wveDxyWZmE=; b=ZQmUoXq1wu0+Wi0EhzkpxAiyzhVyS1RX02FJ5SDIINC5myE+CRNzr10nqPHS7osqk5 8MdEQde1dncUl1P29MocSZRYRWwTUb9CJrg+xNSRcmV84U8JddyozeFzQwJvdR6uwRp9 NYNQvyq0h5GWs8B86AsVlNnxdKAMaq6S6Q2gsLHu+iQtKGOC1gHqEaS3P+TYbpIQQbee 8Sr2gB53l1DTJySOn3lIpbSW7EMdjTDi/JOPiX/HRWwlvhjDYMAGCqN7rKIxTBORkXCV u4KnXmRJwwpzyF/x+17udh9HRz2TZB1Vnsk/p/x4OdGSwdOjbyXPjBIviayOdc70+dC6 yleg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=AAWELmRkkfJ6LmVcVPNs9jCJmYeyHaZq4wveDxyWZmE=; b=B0HXClzlz05txqhWAEoyyF0E5UPveyigLUqNo41p9CZyGg39L6fBDY85DToDsi/iRE 9H3sgxGyku6olwDBkbQeAn10tgncqFhNpJnY0lRaQULA9JziRsInjP+AvKSwchqOwqnX c0ZN2SG2Qe9Sb+lfN06O1dsmGQhNeyumnvEEHJF659GfPkLCH8FodNbWsSj2kWHSlpUn GxA+V91/Umg/2ROoRVcxWuTl6tKCyqaCkJZ4rcxv7Of78H4KSRERP5AaTCtkpvQX4oZZ zCwd6WJTiIhiVb1X1QiCpenGEc4Wrxa4WSlGo23FwDgj61DP27Lm1LYExkRO2ERB6sPf 7CzQ== X-Gm-Message-State: AFeK/H2DHBoZumS/G7b8o4Vv/PJmDP+9MMOxTYlgw2EtWi4kJGYQSHB7ZxtleDTPt/5JWw== X-Received: by 10.107.142.136 with SMTP id q130mr960627iod.31.1490796413294; Wed, 29 Mar 2017 07:06:53 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id f196sm4505026itc.2.2017.03.29.07.06.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Mar 2017 07:06:52 -0700 (PDT) From: npostavs@users.sourceforge.net References: <874lyg68rq.fsf@users.sourceforge.net> <87lgroxlh8.fsf@calancha-pc> Date: Wed, 29 Mar 2017 10:08:14 -0400 In-Reply-To: <87lgroxlh8.fsf@calancha-pc> (Tino Calancha's message of "Wed, 29 Mar 2017 22:26:27 +0900") Message-ID: <87efxg2n1t.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Tino Calancha writes: > It might be useful rewrite that part to make it more clear, but i don't > have a clear proposal. Actually, looking at this some more, I think you should just apply your patch that removes this stuff completely. It's much clearer to write that sort of example as (cl-loop for y = "lion" then (next-prey y) while y collect y) And looking down the page, `for VAR = EXPR1 then EXPR2' is already explained well enough (as well as the equivalence to the `for VAR on LIST by FUNCTION' form). From unknown Sat Jun 21 03:23:53 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Tino Calancha Subject: bug#23550: closed (Re: bug#23550: 25.0.93; cl.texi (for var on list by func): Fix documentation) Message-ID: References: <87bmshhn74.fsf@calancha-pc> X-Gnu-PR-Message: they-closed 23550 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 23550@debbugs.gnu.org Date: Fri, 31 Mar 2017 08:21:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1490948462-14462-1" This is a multi-part message in MIME format... ------------=_1490948462-14462-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #23550: 25.0.93; cl.texi (for var on list by func): Fix documentation which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 23550@debbugs.gnu.org. --=20 23550: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D23550 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1490948462-14462-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 23550-done) by debbugs.gnu.org; 31 Mar 2017 08:20:43 +0000 Received: from localhost ([127.0.0.1]:53540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctrnX-0003kb-Fs for submit@debbugs.gnu.org; Fri, 31 Mar 2017 04:20:43 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:33388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctrnV-0003kO-Ii for 23550-done@debbugs.gnu.org; Fri, 31 Mar 2017 04:20:41 -0400 Received: by mail-pg0-f53.google.com with SMTP id x125so64284999pgb.0 for <23550-done@debbugs.gnu.org>; Fri, 31 Mar 2017 01:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=SiAIuHp7Wou5404ztutnKrEr4sLzg5ZxNke1AevxJLQ=; b=obBYmmOdcRfUUclNnAVuCZEJFPHvwe61VYto8OZGFcAIpKIX4C/4+V1XV1aSp/m+Nb PrcQQiWewYyD+RxABNQGv8EiU5GBMi4g0508AiGU6bCypGHRjBEDNBFojQlBxmElapV2 Ju1LkpnP+OLTcTXZsaMHEA9IYIL66OC1M4BHdQefuKDdD9JPOfMihXSi5V0BHvjIHTM6 eZecoFp108EIup1kzOjnB4Az7AdhUP1QPkJPgAREkUZM0mW/xUTl9rRtnWwlhUbOUUxw IEyAg9Y07WhkSW4rNmLfQv5M2sAXm/aMh6GmmwLNOm55CSYImxkeH2jHCm8piNE+91WW uU9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=SiAIuHp7Wou5404ztutnKrEr4sLzg5ZxNke1AevxJLQ=; b=bcLYuXsuVQOq2Pdi1X65OWXvQFGOXZa2iktFolU7KL2l1XQF8N7QCmZ2WLFShmNG1u ac4+ZIL3bwyeHUJykKkNIEhic6YUCe+NQeQTUiy/H1pVAS6rwms0MjHSn6mE9gUtAJgF nRmfPyAc3l4M5+mB7SM86cUB0mOZLB499gz3OtowI12pEAJoiye1ZILtxlH8rA7w8sk7 SCs/cMn9/ac3lmuCWAJTx+eFZgya6krg10NicL6RPY3cc5VW4H10OVgHCyYuyoxglnTL 6rzLoP8lT1vrpsXlXX2UuWEs3o6K7DTvZp3vDykSyZwdOk8Iyiwg8j33Zks2RlUizjs4 udDw== X-Gm-Message-State: AFeK/H1QSSuXqQlTDOLAXJ38CmLMeHKBe+C5dSFzxT1oZOAUakF468DElA9wW3v0PKn0wA== X-Received: by 10.84.138.1 with SMTP id 1mr2052696plo.29.1490948435411; Fri, 31 Mar 2017 01:20:35 -0700 (PDT) Received: from calancha-pc (234.204.100.220.dy.bbexcite.jp. [220.100.204.234]) by smtp.gmail.com with ESMTPSA id n7sm8774537pfn.0.2017.03.31.01.20.34 for <23550-done@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 31 Mar 2017 01:20:34 -0700 (PDT) From: Tino Calancha To: 23550-done@debbugs.gnu.org Subject: Re: bug#23550: 25.0.93; cl.texi (for var on list by func): Fix documentation References: <874lyg68rq.fsf@users.sourceforge.net> <87lgroxlh8.fsf@calancha-pc> <87efxg2n1t.fsf@users.sourceforge.net> Date: Fri, 31 Mar 2017 17:20:31 +0900 In-Reply-To: <87efxg2n1t.fsf@users.sourceforge.net> (npostavs's message of "Wed, 29 Mar 2017 10:08:14 -0400") Message-ID: <87bmshhn74.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 23550-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) npostavs@users.sourceforge.net writes: > Tino Calancha writes: > >> It might be useful rewrite that part to make it more clear, but i don't >> have a clear proposal. > > Actually, looking at this some more, I think you should just apply your > patch that removes this stuff completely. It's much clearer to write > that sort of example as > > (cl-loop for y = "lion" then (next-prey y) > while y collect y) > > And looking down the page, `for VAR = EXPR1 then EXPR2' is already > explained well enough (as well as the equivalence to the `for VAR on > LIST by FUNCTION' form). Thank you. Pushed fix into emacs-25 branch with commit: 3f0d047d2eb1fb59be2ff962c01392d8c808a654 ------------=_1490948462-14462-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 16 May 2016 15:46:02 +0000 Received: from localhost ([127.0.0.1]:53929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2KiX-0000Ti-SY for submit@debbugs.gnu.org; Mon, 16 May 2016 11:46:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b2KiW-0000Ox-VA for submit@debbugs.gnu.org; Mon, 16 May 2016 11:46:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2KiQ-0000Lw-OE for submit@debbugs.gnu.org; Mon, 16 May 2016 11:45:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KiQ-0000Ll-Am for submit@debbugs.gnu.org; Mon, 16 May 2016 11:45:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KiO-0000sI-1J for bug-gnu-emacs@gnu.org; Mon, 16 May 2016 11:45:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2KiI-0000KP-Ow for bug-gnu-emacs@gnu.org; Mon, 16 May 2016 11:45:50 -0400 Received: from calancha-ilc.kek.jp ([130.87.234.234]:60097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2KiI-0000KG-EQ for bug-gnu-emacs@gnu.org; Mon, 16 May 2016 11:45:46 -0400 Received: by calancha-ilc.kek.jp (Postfix, from userid 500) id 2B0FC640F; Tue, 17 May 2016 00:49:02 +0900 (JST) Received: from localhost (localhost [127.0.0.1]) by calancha-ilc.kek.jp (Postfix) with ESMTP id 14EAC5646 for ; Tue, 17 May 2016 00:49:02 +0900 (JST) Date: Tue, 17 May 2016 00:49:02 +0900 (JST) From: Tino Calancha X-X-Sender: calancha@calancha-ilc.kek.jp To: bug-gnu-emacs@gnu.org Subject: 25.0.93; cl.texi (for var on list by func): Fix documentation Message-ID: User-Agent: Alpine 2.20 (LRH 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) * doc/misc/cl.texi (for var on list by func): Fix documentation 'cl-loop for var on list by func' behaves as in CL: 'on' expression need to be a list. The following tests run in the *scratch* buffer return same values as in SBCL: ;; CL cl-loop -> loop emacs -Q: (require 'cl-lib) (setq preys '("grass" "lion" "rabbit")) (defun next-prey (x) "Return the name of the prey of animal X." (cl-loop while (not (atom x)) do (setq x (car x))) (cond ((member x preys) ; elisp ;; (cond ((member x preys :test #'string=) ; CL (cond ((string= x "lion") "rabbit") ((string= x "rabbit") "grass") (t nil))) (t nil))) (defun next-prey-list (x) "Return a list with the name of the prey of animal X." (let ((res (next-prey x))) (if res (list res) nil))) [A] (mapcar 'next-prey '("grass" "lion" "rabbit")) [B] (mapcar 'next-prey-list '("grass" "lion" "rabbit")) [A] (nil "rabbit" "grass") [B] (nil ("rabbit") ("grass")) [I] (cl-loop for y on preys collect y) [II] (cl-loop for y on preys by #'next-prey collect y) [III] (cl-loop for y on (car preys) by #'next-prey collect y) [IV] (cl-loop for y on (car preys) by #'next-prey-list collect y) [V] (cl-loop for y on preys by #'next-prey-list collect y) [I] (("grass" "lion" "rabbit") ("lion" "rabbit") ("rabbit")) [II] (("grass" "lion" "rabbit")) [III] nil [IV] nil [V] (("grass" "lion" "rabbit")) In GNU Emacs 25.0.93.3 (x86_64-pc-linux-gnu, GTK+ Version 2.24.30) Repository revision: 6de0715f5467d4b925e2dfe082174529ace3b174 >From 3e1756fb4d76e34b74b96782d4509582e9ce0cd3 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Tue, 17 May 2016 00:04:56 +0900 Subject: [PATCH] ; * cl.texi (clause 'for' with 'on'): Fix documentation --- doc/misc/cl.texi | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 4137a95..319592c 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -1956,18 +1956,6 @@ For Clauses @result{} ((1 2 3 4) (2 3 4) (3 4) (4)) @end example -With @code{by}, there is no real reason that the @code{on} expression -must be a list. For example: - -@example -(cl-loop for x on first-animal by 'next-animal collect x) -@end example - -@noindent -where @code{(next-animal x)} takes an ``animal'' @var{x} and returns -the next in the (assumed) sequence of animals, or @code{nil} if -@var{x} was the last animal in the sequence. - @item for @var{var} in-ref @var{list} by @var{function} This is like a regular @code{in} clause, but @var{var} becomes a @code{setf}-able ``reference'' onto the elements of the list -- 2.8.1 ------------=_1490948462-14462-1--