From: Michael Heerdegen <michael_heerdegen@web.de>
To: Nicolas Petton <nicolas@petton.fr>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Enhance seq-min and seq-max
Date: Mon, 17 Jun 2019 01:21:32 +0200 [thread overview]
Message-ID: <87sgs9glqb.fsf@web.de> (raw)
In-Reply-To: <87imt59tpm.fsf@petton.fr> (Nicolas Petton's message of "Sun, 16 Jun 2019 22:11:01 +0200")
Nicolas Petton <nicolas@petton.fr> writes:
> In addition to documentation, could you also add unit tests? (for
> seq.el, I like when my unit tests test multiple sequence types).
Sure.
> I left some comments below.
>
> > + (if predicate
> ^^^^^^^^^
> What if `predicate' is nil but `key' is non-nil?
Then it does nonsense. Ok, we get one more case. I wonder if I should
rather give one general definition in the function body and handle the
four cases (KEY/PREDICATE given/not given) in a compiler macro. Then in
compiled code there would be no runtime tests and it would be optimized
for the respective case.
> > + (apply #'min (seq-into sequence 'list))))
> ^^^^^^^^^^^^^^^^^^^^^^^ I think your version of
> `seq-min' will break when `predicate' is used for
> all sequence types but lists, since you don't
> convert the sequence, but use `car' and `cdr'.
Correct. I changed it to use seq-first and seq-rest instead of car/cdr
- an intermediate conversion step is not necessary I think.
Thanks,
Michael.
next prev parent reply other threads:[~2019-06-16 23:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 20:09 Emacs 26.2.90 is out! Nicolas Petton
2019-06-12 21:31 ` Nicolas Petton
2019-06-13 21:35 ` Phillip Lord
2019-06-13 23:03 ` stream.el (was: Emacs 26.2.90 is out!) Michael Heerdegen
2019-06-14 7:15 ` Nicolas Petton
2019-06-15 0:25 ` Enhance seq-min and seq-max (was: stream.el) Michael Heerdegen
2019-06-15 6:27 ` Eli Zaretskii
2019-06-15 23:00 ` Enhance seq-min and seq-max Michael Heerdegen
2019-06-16 2:38 ` Eli Zaretskii
2019-06-15 23:46 ` Michael Heerdegen
2019-06-16 20:11 ` Nicolas Petton
2019-06-16 23:21 ` Michael Heerdegen [this message]
2019-06-17 7:46 ` Nicolas Petton
2019-06-25 21:22 ` Michael Heerdegen
2019-06-26 7:52 ` Nicolas Petton
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sgs9glqb.fsf@web.de \
--to=michael_heerdegen@web.de \
--cc=emacs-devel@gnu.org \
--cc=nicolas@petton.fr \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.