unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: Drew Adams <drew.adams@oracle.com>, 24014@debbugs.gnu.org
Subject: bug#24014: 24.5; doc string of `cl-reduce'
Date: Mon, 18 Jul 2016 18:03:00 +0200	[thread overview]
Message-ID: <578CFDB4.1050302@gmail.com> (raw)
In-Reply-To: <791de973-6bb2-4bd3-a375-b6866e594ad2@default>


[-- Attachment #1.1: Type: text/plain, Size: 1153 bytes --]

On 2016-07-18 16:02, Drew Adams wrote:
>>> Even providing a functional-programming definition of `reduce' is
>>> better than just describing it in abstract terms, if we can't come
>>> up with a more down-to-earth description.
>>
>> What about adding a few examples? Something like this maybe?
>>
>>     (cl-reduce f '(1 2 3 4 5))
>>       ↔ (f (f (f (f 1 2) 3) 4) 5)
>>
>>     (cl-reduce f '(1 2 3 4 5) :initial-value 0)
>>       ↔ (f (f (f (f (f 0 1) 2) 3) 4) 5)
>>
>>     (cl-reduce f '(1 2 3 4 5) :from-end t)
>>       ↔ (f 1 (f 2 (f 3 (f 4 5))))
>>
>>     (cl-reduce f '(1 2 3 4 5) :from-end t :initial-value 0)
>>       ↔ (f 1 (f 2 (f 3 (f 4 (f 5 0)))))
> 
> LGTM - except that f should be quoted as an arg to `cl-reduce'.
> E.g. (cl-reduce 'f '(1 2 3)).
> 
> And a shorter list makes things a tiny bit simpler: (1 2 3).
> 
> (And I'm not crazy about the too-short double arrow, personally.)

I wasn't sure about the sort list; I actually found things more confusing that way.  Should this go in the ELisp manual, or in the docstring?
No strong feelings about the double arrow, and fine with me for quoting f.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-07-18 16:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-17 14:55 bug#24014: 24.5; doc string of `cl-reduce' Drew Adams
2016-07-17 15:57 ` Michael Heerdegen
2016-07-17 21:18   ` Nicolas Petton
2016-07-18  4:44     ` Drew Adams
2016-07-18 12:19       ` Nicolas Petton
2021-10-23 17:32       ` Stefan Kangas
2016-07-18  4:41   ` Drew Adams
2016-07-18  8:54     ` Clément Pit--Claudel
2016-07-18 14:02       ` Drew Adams
2016-07-18 16:03         ` Clément Pit--Claudel [this message]
2016-07-18 17:28           ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=578CFDB4.1050302@gmail.com \
    --to=clement.pit@gmail.com \
    --cc=24014@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).