[Top][All Lists]

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

Lisp: Functions for multiple comparisons

From: Greg Hill
Subject: Lisp: Functions for multiple comparisons
Date: Wed, 20 Nov 2002 13:14:16 -0800

I am aware of the built-in functions memq and member. But what I really want is a pair of special forms that work more like 'or and 'and. The first argument would be compared against all of the rest using either 'eq or 'equal, returning 't if any match was found.

For example, a special form using an 'eq comarison might be named 'meq and be called like:

        (meq (char-syntax (following-char)) ?w ?_)

instead of using

        (memq (char-syntax (following-char) '(?w ?_)))
(or (eq (char-syntax (following-char)) ?w) (eq (char-syntax (following-char)) ?_))
(let ((syntax (char-syntax (following-char)))) (or (eq syntax ?w) (eq syntax ?_)))

Is there already something like that that I simply am not yet aware of? If not, am I wrong in thinking that the kind of special forms I am imagining would be computationally more efficient than any of the alternatives shown above?


reply via email to

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