[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pcase on multiple conditions
From: |
Emanuel Berg |
Subject: |
Re: pcase on multiple conditions |
Date: |
Sun, 30 Oct 2022 13:55:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Michael Heerdegen wrote:
>>> Is this the way to test for two values to perform the
>>> same operation?
>>>
>>> (pcase complt
>>> ((or 3 4)
>>> (myfunc)))
>>
>> With `or' it will become true if any of values is true.
>
> `pcase' patterns are not values. Your interpretation of the
> semantics of this `or` pattern is wrong.
The syntax and semantics are not easy to understand but here
is an example of `pcase' use that should be simple enough, at
least what it does and how to use it.
(defun insert-mail (&optional delim)
(interactive "P")
(pcase-let ((`(,delim-beg ,delim-end) (if delim '("<" ">") '("" ""))))
(insert (format "%s%s%s" delim-beg user-mail-address delim-end)) ))
;; (insert-mail) ; incal@dataswamp.org
;; (insert-mail t) ; <incal@dataswamp.org>
--
underground experts united
https://dataswamp.org/~incal
- pcase on multiple conditions, Heime, 2022/10/28
- Re: pcase on multiple conditions, Jean Louis, 2022/10/28
- Re: pcase on multiple conditions, Michael Heerdegen, 2022/10/28
- Re: pcase on multiple conditions, Jean Louis, 2022/10/28
- Re: pcase on multiple conditions, Michael Heerdegen, 2022/10/28
- Re: pcase on multiple conditions, Stefan Monnier, 2022/10/28
- Re: pcase on multiple conditions, Emanuel Berg, 2022/10/30
- Re: pcase on multiple conditions, Jean Louis, 2022/10/30
- Re: pcase on multiple conditions,
Emanuel Berg <=
Re: pcase on multiple conditions, Emanuel Berg, 2022/10/30