From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: What's missing in ELisp that makes people want to use cl-lib? Date: Wed, 15 Nov 2023 01:07:27 +0000 Message-ID: References: <8734xetjkk.fsf@yahoo.com> <87cywhsrcf.fsf@yahoo.com> <87cywgx1z0.fsf@web.de> <83wmuowwp3.fsf@gnu.org> <8334xcwank.fsf@gnu.org> <320999cc-6c83-2315-0044-cc0403400af3@gutov.dev> <9ab5d2bd-a648-cae0-a4a7-ae86be10af0f@gutov.dev> <87r0kuqxbf.fsf@gmail.com> <54e115a2-fc36-3056-a030-0dbf32416ddb@gutov.dev> <43f290b0-4119-597b-c89a-0fb4c7db1665@gutov.dev> 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="36617"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?Q?Gerd_M=C3=B6llmann?= , Eli Zaretskii , michael_heerdegen@web.de, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 15 02:08:33 2023 Return-path: Envelope-to: ged-emacs-devel@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 1r34OP-0009Jx-EJ for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Nov 2023 02:08:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r34Ne-0003WN-Pk; Tue, 14 Nov 2023 20:07:46 -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 1r34Nc-0003IN-DA for emacs-devel@gnu.org; Tue, 14 Nov 2023 20:07:44 -0500 Original-Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r34Na-0006qS-K7; Tue, 14 Nov 2023 20:07:44 -0500 Original-Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-507f1c29f25so8530669e87.1; Tue, 14 Nov 2023 17:07:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700010460; x=1700615260; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GBSmQDdyvJxFCdBZeB7BU8nvSgkQ6RUsuruS1ga7Dng=; b=fwKudZQQ/7ES72XSLE7AFUIZv35ulKQKGVCixzild01huO9OvFJ3clFtREjaOHgATO JoiSGvEPuBKzRx7TT6BFUtEForyWfW1JipB4A0zQuC9b3rwyWVcrVrZ6oUsQ8KKF8+Tq CaJEmU8ldQgTtiiZ+owSaRB5zBoL1VgGeIMq+fddUx+1AUOpBS5m+Fsz4BvCx5u96wrG 1qikM7rNfZLvVHuuVMT0bIasPtnuybh6CfUeRdm+mvjEz6F5x07WX+v8bOMZW6S83G6G 1OruErZ+OEqTiR20VENxuVA4Zbxu+rgqyDqaCnH1y/W5REROQyk9jZipbhMoTYsHPWWg z7Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700010460; x=1700615260; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GBSmQDdyvJxFCdBZeB7BU8nvSgkQ6RUsuruS1ga7Dng=; b=chNuyZ0xQhZpIlnl0mqG5bm4Qs8jgCjoHwRQP9QJkGfFlai17R8a9alK32mMW6PIUU OAcF7JDDke0gvlm9cQRg5FT1b6XmHq5rwbgjfRSVJmRIer+PijcjMcTM2tePzOXZG7lC yGEhHQcOMkhSJIWZfSfbkutFtMhBYJB/CixCdR+LAILRdbqBFsi4MGE6vv/JNBqje3bR 4hsSBK7w9qjcKAgHHs7+cN6q0UsSKDrb1zOMNL3FnzJkw8Sb9VlHOSAkurSe36p4/MCS m9j+pUnrYxFfG0YvgFq1093DkYNAa/1nTaTFV3YQLoedITd7iGnU5OU5ZAdoRgh5B8of YEHA== X-Gm-Message-State: AOJu0Yy4JFR4hyEAuuJBeRbA21u2JYBovjEylYab7doskMaLwrlARbmF 7lrI3+5U8+j/VpXyK/V7Ih+g9EF5tsc8qpZaSt4= X-Google-Smtp-Source: AGHT+IFs4rig8vvxywSi6+3dqR+Fn50NLu5y+wO4yG+e3i4ahAIKopWI+CHhFfo0fxrwo5dv+DS1WZffFlQiwwcIABM= X-Received: by 2002:a05:6512:3f03:b0:509:1067:c20d with SMTP id y3-20020a0565123f0300b005091067c20dmr9881736lfa.39.1700010459800; Tue, 14 Nov 2023 17:07:39 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=joaotavora@gmail.com; helo=mail-lf1-x135.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:312746 Archived-At: On Wed, Nov 15, 2023 at 12:46=E2=80=AFAM Dmitry Gutov wr= ote: > Then it must have a seq-do implementation that yields :secret-voodoo one > or several times. Not really. Only if I use my seq in contexts where I need that generic, and being second argument to seq-difference doesn't count. So why should I bother implementing that when my code is working fine today? But say I did that seq-do, then what is the seq-contains-p generic good for then? Why some many redundant generics that the user learns the hard way have to be consistent with each other? > And then the seq-contains-pred implementation will do > right by it (the default one, not the specialization for lists). > > >> This is not documented, > > > > You don't say? :-) i think we should get started on documenting all > > these ad-hoc rules (sorry but in this case they are quite literally > > ad-hoc). Better than nothing, I guess, since as to actually enforcing > > them, I think that train has left the station a long time ago and is > > now in a voodoo swamp in monkey island. > > Not sure "enforcing them" is the right phrase: I wonder if there's ever > been a change proposed to seq.el which would break them. I think it's pretty easy to do, especially if these optimziations want going to go all the way to cl-lib's easier-to-get optimal performance. What about this? Is this toy implementation of compressed space-saving lists legal? (cl-defmethod seq-do (function (l (head :m6-sparse))) (mapc (lambda (e) (if (eq e :double-o-seven) (progn (funcall function 0) (funcall function 0) (funcall function 7)) (funcall function e))) (cdr l))) (cl-defmethod seq-reverse ((l (head :m6-sparse))) (let (res) (seq-do (lambda (e) (push e res)) l) res)) (seq-difference '(:m6-sparse 1 2 :double-o-seven 4) '(7)) ;; =3D> (1 2 0 0 = 4) Again, not implementing all the generics, just the ones I need to get my desired effect, which in this case is passing a custom sequence type as a first argument to seq-difference. Jo=C3=A3o