Re: Using cl-case on symbols
packrat386 <[email protected]> Mon, 06 Jul 2026 21:41:19 +0000
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <87pl0zzthd.fsf@fg-ct> |
"Heime" <[email protected]> writes: > It has been suggested to me about using the following `cl-case' > construct for checking ACTM against a list of symbols. With > `cond' I would have to use ((or (eq actm 'add) (eq actm 'remove)) > > How is it that `cond' does not work on symbols but `cl-case' does? > Although I have looked at the documentation of `cl-case', there is > no indication on its appropriateness to symbols. > > (cl-case actm > ((add remove) > (funcall hka mdhook #'kronaire-regexp) > (funcall hka mdhook #'outline-minor-mode)) cl-case takes an initial expr, evaluates that and compares it to the KEYLIST. cond evaluates the expression in each branch to see if it's true. So if you know that your condition is an expression that is going to evaluate to one of a number of symbols then cl-case lets you evaluate it only once, where as for cond you have to check if it is eq to one of a number of potential outputs. It doesn't have anything in particular to do with symbols, just in how you think about your condition. cl-case is closer to like a C switch statement where cond is closer to an if ... else if ... else ...