Questions tagged [pcase]

ML-style pattern-matching macro for Elisp

Filter by
Sorted by
Tagged with
3
votes
1answer
45 views

pcase matches with rx but not with regex

(rx bos (1+ (in "0-2")) eos) evaluates to "\\`[0-2]+\\'", so I expected these two functions to be equivalent: (defun with-rx (s) (pcase s ((rx bos (1+ (in "0-2")) eos) "matched") (t "not ...
0
votes
2answers
59 views

pcase pred not acting right

I've got this (defun testor (s) (if (or (< s 1) (> s 21)) (message "Bad") (message "good"))) which works. But a similar (defun test2 (n) (pcase n ((pred (< n 1)) (message "bad")...
2
votes
0answers
60 views

byte-compiling in presence of pcase patterns

TIL that trying to compile anything with pcase matching in it may lead to an explosion of code generated during expansion. Even the most innocent looking patterns may generate hundreds of branches and ...
1
vote
1answer
66 views

Using pcase to recursively parse nested lists

So I'm trying to process the following nested list... (setq *test* '("mt" "trello" ("b" "board" ("l" org-trello-show-board-labels) ("d" org-trello-sync-buffer-down) ("u" org-...
1
vote
1answer
63 views

Define negating pcase patterns

I am interested in extending pcase with patterns which: Complement an existing pattern, e.g. (not (pred string-empty-p)). Such a pattern would match where the non-negated form does not match and vice ...
3
votes
2answers
151 views

Match against a variable with pcase

I'm trying to get pcase to match against a let-bound variable. However, I can't seem to get pcase to recognize the variable correctly. See this minimal example: (let ((a 1)) (pcase 2 (a 7))) => ...