Variadic Comparisons in Emacs Lisp

One of the ways that Emacs Lisp differs from other Lisps is that it doesn't support multiple arguments for comparisons. That is, you can't write things like

(if (= a b c) do-this else-do-that)


(when (< a b c) ...)

You can still express those comparisons, of course, but you have to connect two or more two-argument comparisons with and.

Now, as Bozhidar Batsov points out, that's about to change. Emacs 24.4 will support variadic comparisons. That's not a huge change but it does bring Elisp in line with other Lisps and makes it easier to express complex comparisons concisely and clearly. As I wrote before, I'm really impressed with this release and looking forward to its availability.

This entry was posted in Programming and tagged . Bookmark the permalink.
  • Tamas Papp

    I have always found variadic /= a bit weird (eg with the semantics as in CL). I guess that is because all other relations are transitive, and thus a variadic extension is straightforward, while /= isn't. Bozhidar Batsov's post does not mention /=, so I am wondering if it will be extended in Emacs, too (I am not for or against it, just curious).