From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: What's missing in ELisp that makes people want to use cl-lib? Date: Wed, 15 Nov 2023 03:32:43 +0200 Message-ID: <417f01b8-6440-f166-c592-5e1eace1d41f@gutov.dev> References: <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; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33135"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: =?UTF-8?Q?Gerd_M=c3=b6llmann?= , Eli Zaretskii , michael_heerdegen@web.de, emacs-devel@gnu.org To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 15 02:33:48 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 1r34mp-0008Mc-8Z for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Nov 2023 02:33:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r34m1-0006Go-7W; Tue, 14 Nov 2023 20:32:57 -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 1r34lz-0006Fk-G4 for emacs-devel@gnu.org; Tue, 14 Nov 2023 20:32:55 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r34lu-0004xl-9y; Tue, 14 Nov 2023 20:32:55 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 331545C0106; Tue, 14 Nov 2023 20:32:47 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 14 Nov 2023 20:32:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1700011967; x=1700098367; bh=A0Co6Sk5AvG6LWGzNmbcJgPlGzg8NOGY8P0 Yw2ny+lM=; b=oheGP8R/amTNOXAFJ6JW8q2gV5VMH8j+3RMh/eZGkPhn6rc5E14 0dzHkLyXaBwM1JAapqB/DHAtWjhQRaJAuvuCnDG8MB5Ir9Mrl4deswUADZNb1zOv A6rQOd+qloFOlvzxnWQpO0Sxoe14FMK7ioFA3p5GEncRYI3zH1sAjfCBD5CqRHCd Mi12t3x4VIcz/7rSy3dDJ8FUtvz7B8GRffZQnbYzZwnXmeaAw+5grNt6Gw9pPYkN fE+WkFMnCw9SBpB5g85euxSDy5UuFT7QmkW819wpG/V3NAj+sQeKBKKwFAwVYqKx eXGIS0wijX/ewjGA9ttjPgse8Ze7astMbdg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1700011967; x=1700098367; bh=A0Co6Sk5AvG6LWGzNmbcJgPlGzg8NOGY8P0 Yw2ny+lM=; b=dEDV4hz5W9POB7xZ1wFCS9YVyK8ULIzV6hZDVaR+FqnxkYaGeOt Co6N3lPxCu6fBTBZN3jVS0woi8JXrX5V9r2KEIYxDDRzg4svNq0/TTiY/8FNpnsO XiYJaYcgBwSlIUp5B26pc33nXY+nssa6sEk2pE5za0GqsLD4A8eIGOlfIOCtkswP DmnshAwdVVZXgZLuyPjnkFzvBgm0bYEaVn7/fdw6RJ+nk5Y6bZ2OMniU/0a1zONs hdebReQPCqhIo5k+mdPlklDlPrvQBaqXFZKElUZ6vzEKpiBUwe901up09ns7d2tc 7PXHyxyBxZkUNBKVX34aacm1w5RvWJKWDGw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudefgedgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhephfffheeljeffgeffueeghfekkedtfffgheejvdegjeettdduheeufffggfef jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Nov 2023 20:32:45 -0500 (EST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=66.111.4.29; envelope-from=dmitry@gutov.dev; helo=out5-smtp.messagingengine.com X-Spam_score_int: -64 X-Spam_score: -6.5 X-Spam_bar: ------ X-Spam_report: (-6.5 / 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, NICE_REPLY_A=-3.695, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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:312749 Archived-At: On 15/11/2023 03:17, João Távora wrote: > On Wed, Nov 15, 2023 at 1:07 AM João Távora wrote: > >> 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? > > Let me answer that for you... It could be, maybe even likely, that the > code was trying to get out of seq-do for some types of operation, because in > the case of lazy lists, seq-do would mandate the list be completely expanded. > > So, while the code works, you seq-difference-3 now calls seq-do on the > second argument, and kills my laziness, naughty naughty. Indeed, it might as well be that a type had a specialized fast implementation for seq-contains-p and doesn't have one for seq-contains-pred, and the switchover would tank the performance of its callers. As long as the observable behavior stays the same (aside from performance), that seems fine. The type's author will need to implement seq-contains-pred. Hopefully such migrations will remain rare enough. > Actually for this point to make sense, it doesn't even have to be > a bizarre voodoo list. The lazy list may just be expanded enough already > for me to know in seq-contains-p that there's a given element > there without having to call the generator for more list elements. > > So seq-contains-p was indeed an optimization, in more or less > the sense you described, which is now lost when you tried to optimize > for bare Lisp sequences. Right. The author will now need to optimize seq-contains-pred, getting even better performance than previously in return.