From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#23550: 25.0.93; cl.texi (for var on list by func): Fix documentation Date: Wed, 29 Mar 2017 22:26:27 +0900 Message-ID: <87lgroxlh8.fsf@calancha-pc> References: <874lyg68rq.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1490794044 24918 195.159.176.226 (29 Mar 2017 13:27:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 29 Mar 2017 13:27:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Tino Calancha , 23550@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 29 15:27:20 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctDcz-0004tZ-Hm for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Mar 2017 15:27:09 +0200 Original-Received: from localhost ([::1]:59139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctDd5-0007yz-E4 for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Mar 2017 09:27:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctDcx-0007yL-Ef for bug-gnu-emacs@gnu.org; Wed, 29 Mar 2017 09:27:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctDcs-0005n7-EQ for bug-gnu-emacs@gnu.org; Wed, 29 Mar 2017 09:27:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52076) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ctDcs-0005n2-A5 for bug-gnu-emacs@gnu.org; Wed, 29 Mar 2017 09:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ctDcr-0000Sd-Vs for bug-gnu-emacs@gnu.org; Wed, 29 Mar 2017 09:27:01 -0400 X-Loop: help-debbugs@gnu.org 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 Original-Received: via spool by 23550-submit@debbugs.gnu.org id=B23550.14907940111755 (code B ref 23550); Wed, 29 Mar 2017 13:27:01 +0000 Original-Received: (at 23550) by debbugs.gnu.org; 29 Mar 2017 13:26:51 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: <874lyg68rq.fsf@users.sourceforge.net> (npostavs's message of "Sat, 25 Mar 2017 23:01:45 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131056 Archived-At: 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.