From: Thierry Volpiatto <thievol@posteo.net>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: pcase bindings in patterns with complicated logic
Date: Sun, 14 Jan 2024 17:54:50 +0000 [thread overview]
Message-ID: <87le8riyvp.fsf@posteo.net> (raw)
In-Reply-To: <871qajsx5z.fsf@localhost> (Ihor Radchenko's message of "Sun, 14 Jan 2024 16:21:44 +0000")
[-- Attachment #1: Type: text/plain, Size: 915 bytes --]
Ihor Radchenko <yantar92@posteo.net> writes:
> Thierry Volpiatto <thievol@posteo.net> writes:
>
>>>> [ BTW I don't understand why `app` pattern exists as long as now `pred` is
>>>> supporting an extra arg ]
>>>
>>> Isn't it explained right in the manual?
>>>
>>> ‘(app FUNCTION PATTERN)’
>>> Matches if FUNCTION called on EXPVAL returns a value that matches
>>> PATTERN. FUNCTION can take one of the forms described for ‘pred’,
>>> above. Unlike ‘pred’, however, ‘app’ tests the result against
>>> PATTERN, rather than against a boolean truth value.
>>
>> Perhaps it is right but I don't understand it, an example in the manual
>> would be welcome (if there is one I missed it).
>
> Does this example help?
>
> (pcase '(1 2 3)
> ((app cdr `(2 ,c)) (format "Match: %S" c)))
>
> You cannot easily do the same with pred.
Yes, thanks.
--
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]
next prev parent reply other threads:[~2024-01-14 17:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-13 3:54 pcase bindings in patterns with complicated logic Richard Stallman
2024-01-13 19:58 ` Ihor Radchenko
2024-01-14 6:58 ` Thierry Volpiatto
2024-01-14 7:27 ` Thierry Volpiatto
2024-01-14 15:42 ` Ihor Radchenko
2024-01-14 15:58 ` Thierry Volpiatto
2024-01-14 16:21 ` Ihor Radchenko
2024-01-14 17:54 ` Thierry Volpiatto [this message]
2024-01-16 3:32 ` Richard Stallman
2024-01-16 13:18 ` Ihor Radchenko
2024-01-18 3:37 ` Richard Stallman
2024-01-18 13:13 ` Ihor Radchenko
2024-01-20 3:39 ` Richard Stallman
2024-01-20 12:48 ` Ihor Radchenko
2024-01-21 3:06 ` Richard Stallman
2024-01-21 14:06 ` Ihor Radchenko
2024-01-23 13:40 ` Richard Stallman
2024-01-23 15:08 ` Stefan Monnier via Emacs development discussions.
2024-01-23 19:59 ` Stefan Monnier via Emacs development discussions.
2024-01-15 3:13 ` Richard Stallman
2024-01-14 7:03 ` Thierry Volpiatto
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=87le8riyvp.fsf@posteo.net \
--to=thievol@posteo.net \
--cc=emacs-devel@gnu.org \
--cc=rms@gnu.org \
--cc=yantar92@posteo.net \
/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.