From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Finding repetitions of 8-tuples Date: Sun, 01 Jan 2023 10:00:26 -0600 Message-ID: References: <1399831366.706043.1672506045023@ichabod.co-bxl> Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39807"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.13; emacs 30.0.50 Cc: Hans Lonsdale , help-gnu-emacs@gnu.org To: Arthur Miller Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 01 17:04:16 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pC0oq-000A6R-27 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 01 Jan 2023 17:04:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pC0oJ-0006N0-43; Sun, 01 Jan 2023 11:03:43 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pC0oE-0006M0-Fc for help-gnu-emacs@gnu.org; Sun, 01 Jan 2023 11:03:39 -0500 Original-Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pC0oD-00013v-0c for help-gnu-emacs@gnu.org; Sun, 01 Jan 2023 11:03:38 -0500 Original-Received: from fw.net.yu.netyu.xyz ( [73.133.126.255]) by netyu.xyz (OpenSMTPD) with ESMTPSA id e2d52641 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 1 Jan 2023 16:03:30 +0000 (UTC) In-reply-to: Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FROM_SUSPICIOUS_NTLD=0.499, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142084 Archived-At: Arthur Miller writes: > Hans Lonsdale writes: > >> I have 16 collections of 8 numbers >> >> (11 12 11 44 11 12 11 23) >> (12 21 11 44 11 12 11 23) >> and so on >> >> I want to find whether there are repetitions of each 8-tuple. >> The order in which the numbers occur is not important. > > Have you looked at "lists as sets" chapter in the manual? > > There is a 'cl-subsetp' you could start with: > > cl-subsetp is an autoloaded native-compiled Lisp function in =E2=80=98c= l-seq.el=E2=80=99. > > (cl-subsetp LIST1 LIST2 [KEYWORD VALUE]...) > > Return true if LIST1 is a subset of LIST2. > I.e., if every element of LIST1 also appears in LIST2. > > Keywords supported: :test :test-not :key > > > (defvar l1 '(11 12 11 44 11 12 11 23)) > (defvar l2 '(12 21 11 44 11 12 11 23)) > > (cl-subsetp l1 l2) ;; returns t I looked around and found out that `seq-set-equal-p' might be more suitable for this task: this function performs a set-equality check between the two lists (or, more broadly, sequences) whereas `cl-subsetp' checks for subsets, as you have noted later in your message. > [...] Best, RY