From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Fwd: Lists composed of equal number and kind of elements Date: Mon, 27 Jul 2015 16:55:56 -0700 Message-ID: References: <55B5D99B.9080100@easy-emacs.de> <87egjt41q9.fsf@nl106-137-147.student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1438041394 6476 80.91.229.3 (27 Jul 2015 23:56:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jul 2015 23:56:34 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 28 01:56:29 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZJsFw-00036j-MI for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Jul 2015 01:56:28 +0200 Original-Received: from localhost ([::1]:56269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJsFw-0006YS-64 for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Jul 2015 19:56:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJsFl-0006YA-Rf for help-gnu-emacs@gnu.org; Mon, 27 Jul 2015 19:56:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJsFl-0003Xo-2J for help-gnu-emacs@gnu.org; Mon, 27 Jul 2015 19:56:17 -0400 Original-Received: from mail-ob0-x234.google.com ([2607:f8b0:4003:c01::234]:33627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJsFk-0003Xk-TX for help-gnu-emacs@gnu.org; Mon, 27 Jul 2015 19:56:16 -0400 Original-Received: by obdeg2 with SMTP id eg2so72008634obd.0 for ; Mon, 27 Jul 2015 16:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=9WR8m5UC/nlAIqbJm5uWWUFKsn8V6H3lQQNOpAiNpeY=; b=ISDAVysg97cIQoSyReu9V3yEPtXb5uRTSiL0m9m4VuM0/rfJsewCYRzpuNGDolXR8n IuqnoNPgz+nTGYMobt8yNaUcUrgYf2CnPlxtNVq+z+fC2MBm/8kZ9KqXqB6AhvKOrvxi Z4MRyjlOSmXVmGLXKyTb0bXV+zXhJzDEivbyRQU9GyCNiMQiDlCB8s4DhyJv1sXnUaYl SyhUIaWiiKMv6O23ksIDve33zxpSh1h3b0Fk4l1mxAvRhm4bbLpBpscOS/TvDslrM7+d KON6aI/kJ8JmpwQ4c9HBwDq+L0l6Tcc4bdRJ5s/HEyZXxjg8pQS0fLuaIoVcsvCilcxZ VkNA== X-Received: by 10.182.112.163 with SMTP id ir3mr30315372obb.44.1438041376406; Mon, 27 Jul 2015 16:56:16 -0700 (PDT) Original-Received: by 10.76.168.70 with HTTP; Mon, 27 Jul 2015 16:55:56 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::234 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106044 Archived-At: >> 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