>>107708522
pcase adds pattern matching and destructured assignment to elisp.
(defun my-toy-pcase (argument)
"Use `pcase' to return an appropriate response for ARGUMENT."
(pcase argument
(`(,one ,_ ,three)
(message "List where first element is `%s', second is ignored, third is `%s'" one three))
(`(,one . ,two)
(message "Cons cell where first element is `%s' and second is `%s'" one two))
((pred stringp)
(message "The argument is a string of some sort"))
('hello
(message "The argument is equal to the symbol `hello'"))
(_ (message "This is the fallback"))))
Comment too long. Click here to view the full text.