emacs-devel
[Top][All Lists]
Advanced

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

Re: Update of pcase docs for the elisp manual


From: Michael Heerdegen
Subject: Re: Update of pcase docs for the elisp manual
Date: Thu, 28 Jan 2016 19:37:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> I understand.  I'm just saying that it would be better to provide an
> example of using 'let' which actually made use of the reason for its
> introduction: binding symbols to values.

It's not easy to find an example for a usage of the let pattern that is
not too complicated and can't be replaced trivially with other patterns,
and does also make at least a bit of sense.

I maybe would suggest something like this:

--8<---------------cut here---------------start------------->8---
(pcase some-list
  ((and (let value (calculate-some-value))
        (or (pred (member  value))
            (pred (assoc   value))))
   value))
--8<---------------cut here---------------end--------------->8---

This tests some-list whether - for a VALUE calculated and bound in a let
pattern, whether either this VALUE is a member of the argument list, or
a key in it interpreted as an alist.  If it is, that value is returned.


How is the state of the documentation now?  Do you need some more
contributions, or should I proofread everything?


Regards,

Michael.



reply via email to

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