emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-25 1d4887a: Improve documentation of 'pcase'


From: Stefan Monnier
Subject: Re: emacs-25 1d4887a: Improve documentation of 'pcase'
Date: Mon, 25 Jan 2016 11:15:38 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> FWIW Drew mentioned that it maybe could be cool if the equivalence
> predicate could be specified locally for a pcase form like
> (pcase my-string #'string-collate-equalp
>    ("Noël" "Christmas"))

We can already do that in the following way:

 (pcase my-string
   ((or (pred (string-collate-equalp "Noël"))
        (pred (string-collate-equalp "Christmas")))
    ...))

And if you think that's too verbose, you can define your own pcase-macro
so it can turn into something like:

 (pcase my-string
   ((or (my-string "Noël")
        (my-string "Christmas"))
    ...))


-- Stefan




reply via email to

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