unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* pcase-dolist
@ 2014-07-11 10:35 Sebastian Wiesner
  2014-07-11 13:47 ` pcase-dolist Stefan Monnier
  0 siblings, 1 reply; 22+ messages in thread
From: Sebastian Wiesner @ 2014-07-11 10:35 UTC (permalink / raw)
  To: emacs-devel

Hi,

I just noticed that pcase.el has a `pcase-dolist' macro, which looks quite useful.

However, unlike `pcase’ and `pcase-let’ it’s neither autoloaded nor documented, which suggests that it is somehow internal and should not be used in Emacs Lisp code.

Is this merely an oversight, or are we not supposed to use this macro in Emacs Lisp code for some reason?

Greetings,
Sebastian Wiesner


^ permalink raw reply	[flat|nested] 22+ messages in thread
* pcase-dolist
@ 2015-07-08 12:20 Michael Heerdegen
  2015-07-08 13:54 ` pcase-dolist Stefan Monnier
  0 siblings, 1 reply; 22+ messages in thread
From: Michael Heerdegen @ 2015-07-08 12:20 UTC (permalink / raw)
  To: Emacs Development

Hello,

I was recently bitten by unexpected behavior of `pcase-dolist'.
Like `pcase-let' (which is used internally by `pcase-dolist'), AFAICT it
assumes that the pattern always matches, e.g.

(pcase-dolist ((and x (pred < 0)) '(-1 0 1 2))
  (message "%s" x))

prints all members of the sequence.

Apart from the question whether this semantic is useful: with the
current semantic, a name that includes "case" is irritating considering
such a behavior.  Maybe "pdolist" (and "plet", "plet*") would be better
names?

Anyway, an idea that came to my mind more than once: `when-let',
`if-let' should really be `pcase-when-let' , `pcase-if-let'.  They would
be much more useful than the plain versions I think.

Then `pcase-dolist' could be reimplemented using `pcase-when-let'.


Michael.



^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2015-07-10 19:04 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11 10:35 pcase-dolist Sebastian Wiesner
2014-07-11 13:47 ` pcase-dolist Stefan Monnier
2014-07-11 13:50   ` pcase-dolist Sebastian Wiesner
2014-07-11 14:14     ` pcase-dolist Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2015-07-08 12:20 pcase-dolist Michael Heerdegen
2015-07-08 13:54 ` pcase-dolist Stefan Monnier
2015-07-08 17:32   ` pcase-dolist Michael Heerdegen
2015-07-08 18:26     ` pcase-dolist Tassilo Horn
2015-07-08 21:27       ` pcase-dolist Stefan Monnier
2015-07-09  6:05         ` pcase-dolist Tassilo Horn
2015-07-09  9:55           ` pcase-dolist Thierry Volpiatto
2015-07-09 10:17             ` pcase-dolist Tassilo Horn
2015-07-09 12:19               ` pcase-dolist Thierry Volpiatto
2015-07-09 13:34                 ` pcase-dolist Tassilo Horn
2015-07-09 13:40                   ` pcase-dolist Thierry Volpiatto
2015-07-09 19:26           ` pcase-dolist Stefan Monnier
2015-07-09 20:27             ` pcase-dolist Michael Heerdegen
2015-07-10 18:51               ` pcase-dolist Stefan Monnier
2015-07-10 14:44             ` pcase-dolist Tassilo Horn
2015-07-10 19:04               ` pcase-dolist Stefan Monnier
2015-07-08 19:44     ` pcase-dolist Artur Malabarba
2015-07-08 20:50       ` pcase-dolist Michael Heerdegen

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).