emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pcase-dolist


From: Michael Heerdegen
Subject: pcase-dolist
Date: Wed, 08 Jul 2015 14:20:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]