help-gnu-emacs
[Top][All Lists]
Advanced

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

Fwd: Lists composed of equal number and kind of elements


From: John Mastro
Subject: Fwd: Lists composed of equal number and kind of elements
Date: Mon, 27 Jul 2015 16:55:56 -0700

>> Anyway, to answer your question, try this:
>>
>>     (defun set-equal (list-1 list-2)
>>       (and (null (cl-set-exclusive-or list-1 list-2))
>>            (= (length list-1)
>>               (length list-2)) ))
>>
>> Note: Depending what is deemed faster and/or more
>> likely to tell the correct state, the order of the
>> `and' arguments could be reversed...
>
>If `cl-set-exclusive-or' returns nil, aren't the two lists guaranteed to
>have the same length?

Doh! I just realized my error:

    (cl-set-exclusive-or '(a a b) '(a b)) ;=> nil

-- 
john


reply via email to

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