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: cl-loop and plists vs alists Date: Mon, 26 Dec 2022 00:35:58 +0000 Message-ID: References: <86o7s3lsnx.fsf@mail.linkov.net> <86bknx8783.fsf@mail.linkov.net> <837cylapt4.fsf@gnu.org> <83wn6kamwr.fsf@gnu.org> <83len0aldq.fsf@gnu.org> <83k02kadbv.fsf@gnu.org> <83a63fap35.fsf@gnu.org> <83bknu8tmo.fsf@gnu.org> <18E95AC5-1FFC-4025-B804-7D70DDB1BD75@gmail.com> <87ili1f5vb.fsf@posteo.net> <87h6xjm3au.fsf_-_@posteo.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f05bb705f0b04c98" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7350"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 26 01:35:26 2022 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 1p9bSg-0001g1-I7 for ged-emacs-devel@m.gmane-mx.org; Mon, 26 Dec 2022 01:35:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9bS1-0007ws-2s; Sun, 25 Dec 2022 19:34:45 -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 1p9bRy-0007wb-Mk for emacs-devel@gnu.org; Sun, 25 Dec 2022 19:34:42 -0500 Original-Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9bRw-0003ZS-Ks for emacs-devel@gnu.org; Sun, 25 Dec 2022 19:34:42 -0500 Original-Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-14fe0e9ed11so1625925fac.2 for ; Sun, 25 Dec 2022 16:34:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=w9EQjlE36pguCfhYsTV9+9VQNEv3KjMC7v78i64wkRo=; b=YuDkAYNOA69+ZBvYcbKH/Z18xSgMysc3LxdGFtYPkZJMuRCHNXY7MATVTTZRGlOScn P7XzKISzKwYv+k0TA8BK8MvTDSHB+WR3WBNeMJvJ7Ts0Ob+novwqKJA5dlACuOxs8ZiV AoNzOB/w7wXO1Vex/HNMFKIadgdpkyEkb81R5X/K9Hf0MpX8HKUjIK+pFN1eXyZqluPR fIPNxUpnQZ4n6DdJTDqgRTvag3A56R2oHh8ldzDQkgIn2MpPw+B+Ve6q7cPIbwD49nWH atR5VZ5ZIkzp+P9oAHCcsFENMYV2JJkNFwCOTXXM1yUUyxZhXg5RoSIDIW/UXaA+S0v2 5m1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=w9EQjlE36pguCfhYsTV9+9VQNEv3KjMC7v78i64wkRo=; b=d1KYEKDJ0euumfW7/KzoJKuDy8sX3o9kYvmHcBGvfDNXuwVbv61Pu8bP46w+SXZ7VE WmY8ObU5fOcypMkaqEKxHiaaKbT9lG5qzc5O2kj3Jod3DQk+2maxI9PMdMdptyDBm55+ Z0MMyovd0zvPY5bom+WiNnW3LhfbkSLf28w6PmAc521/j4rXV8mohcczswdgTx3ueFoI 5M9Yg4/vnZ4sPdq8KfXy9WYlxLdB9iNfP8JopVdkBsLuNWRetb71PiArHIuzo69Y3NkI 0I5SyoZGkOm0KSrQaI7PpnCAb5xp76V/Dy+3LjT/2QLchw4ins48UT2HPV7oVm+9R9ZU CMhQ== X-Gm-Message-State: AFqh2krogZRmHS85tF3eOYzPNXxpUjBxGLMZZnHGoPZDwonUXbKDI+Ge dzh4pwMF5kh3azhp87ylx1FEO2NxZnE/h4RVulpc42sl X-Google-Smtp-Source: AMrXdXvpFvdCk77SJhmam/D+AdDi31ZWSECBa8O1Yd3FDgDEe0wnyOQD8AkMEGgYiQN1t6DMyWnqm5jumspZ82Qb/L8= X-Received: by 2002:a05:6870:c985:b0:148:143f:a6b4 with SMTP id hi5-20020a056870c98500b00148143fa6b4mr991216oab.215.1672014879282; Sun, 25 Dec 2022 16:34:39 -0800 (PST) In-Reply-To: <87h6xjm3au.fsf_-_@posteo.net> Received-SPF: pass client-ip=2001:4860:4864:20::30; envelope-from=joaotavora@gmail.com; helo=mail-oa1-x30.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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:301919 Archived-At: --000000000000f05bb705f0b04c98 Content-Type: text/plain; charset="UTF-8" On Mon, Dec 26, 2022 at 12:11 AM Philip Kaludercic wrote: > > Until you step into the real world and you have to. > > Can you elaborate this point? Is this by intrinsic necessity or due to > the "mistakes" of others. Nothing special to elaborate. If a data structure is a plist and you can't change that, and you need to manipulate it, you're in the real world. > Plists are "harder" to iterate, because your > steps are cddrs which is an unusual way to run over a data structure. > Same applies to adding and removing associations from a plist. The > advantage is that they are easier to write. IMO the major advantage is that you can use them for lambda lists. > Maybe somebody knows the history here, why and where which of the two > were used. Again, my hunch is that going by the respective strengths > and weaknesses of the two (in relation to the conventional tools), we > can give some heuristic of when it is /better/ to use which of the two. > Both alists and plists are used intensely in at least two large commercial CL systems I have worked with. I also see them in OSS pretty often. I get your point, but this example is geared towards cl-loop. It is It was your example. I just weaked it trivially to make it slightly more realistic. Of course LOOP isn't for _everything_, else we wouldn't need anything else. It's a very versatile (and very often the most performant) util and that's why it's in the CL standard. The only thing approaching it is the ITERATE macro, modelled directly after LOOP, but that's not nearly as widespread and IMO not improvement enough to be worth investing the effort. --000000000000f05bb705f0b04c98 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Dec 26, 2022 at 12:11 AM Philip Kaludercic <philipk@posteo.net> wrote:
= =C2=A0
> Until you step into the real world and you have to.

Can you elaborate this point?=C2=A0 Is this by intrinsic necessity or due t= o
the "mistakes" of others.=C2=A0

N= othing special to elaborate.=C2=A0 If a data structure is a plist and you c= an't
change that, and you need to manipulate it, you'= ;re in the real world.
=C2=A0
Plists are "harder" to iterate,= because your
steps are cddrs which is an unusual way to run over a data structure.
Same applies to adding and removing associations from a plist.=C2=A0 The advantage is that they are easier to write.=C2=A0

IMO the major advantage is that you can use them for lambda lists.
=C2=A0
Maybe somebody knows the history here, why and where which of the two
were used.=C2=A0 Again, my hunch is that going by the respective strengths<= br> and weaknesses of the two (in relation to the conventional tools), we
can give some heuristic of when it is /better/ to use which of the two.
=

Both alists and plists are used intensely = in at least two large commercial
CL systems I have worked wi= th.=C2=A0 I also see them in OSS pretty often.

I get your point, but this example is geared towards cl-loop.=C2=A0 It is
It was your example. I just weaked it trivially to make= it slightly more
realistic.

Of course L= OOP isn't for _everything_, else we wouldn't need anything else.
It's a very versatile (and very often the most performant) util= and that's why
it's in the CL standard. The only th= ing approaching it is the ITERATE macro,
modelled directly a= fter LOOP, but that's not nearly as widespread and IMO
n= ot improvement enough to be worth investing the effort.
--000000000000f05bb705f0b04c98--