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

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

Re: Lists composed of equal number and kind of elements


From: Barry Margolin
Subject: Re: Lists composed of equal number and kind of elements
Date: Tue, 28 Jul 2015 10:34:00 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.7498.1438041516.904.help-gnu-emacs@gnu.org>,
 Emanuel Berg <embe8573@student.uu.se> wrote:

> John Mastro <john.b.mastro@gmail.com> writes:
> 
> >> 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?
> 
> No: (cl-set-exclusive-or '(1) '(1 1)) ; nil

It can only happen if there are duplicates in one of the lists. The OP 
said that this is specifically for the result of (window-list), which 
can't return duplicates. So he doesn't need a fully general solution.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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