From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Re: seq.el and the complexity of Emacs Lisp. Date: Thu, 9 Nov 2023 15:49:01 -0800 Message-ID: <656f8d5f-2850-062c-1b38-3b50367c64d5@gmail.com> References: <2879d846-b711-ada0-cdc4-9adcb4e56040@gmail.com> 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="23742"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?Q?Gerd_M=c3=b6llmann?= , Richard Stallman , paaguti@gmail.com, 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 Fri Nov 10 00:49:59 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 1r1Emd-00060l-Cw for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Nov 2023 00:49:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r1Elr-0001e5-OX; Thu, 09 Nov 2023 18:49:12 -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 1r1Elp-0001dq-PH for emacs-devel@gnu.org; Thu, 09 Nov 2023 18:49:09 -0500 Original-Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r1Eln-0004CI-6i; Thu, 09 Nov 2023 18:49:08 -0500 Original-Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1cc3c51f830so12896185ad.1; Thu, 09 Nov 2023 15:49:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699573745; x=1700178545; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=tJ2mcxHZV1sd+gf0+8yl0os8ZCjVCjG16xqzlWYwcNY=; b=m/hx4QtcwpkrX2v9k69g67Zr44pwZD8ObI+JwkDU9sN1V5lpnoiSJD78b1bCCVo8o9 SQG5kDKUVFsLHA/VfeIAySjukRi5g/w5YmuSQAlaYA/b5ObKl8LqFXB13e12C4dwQW7a Dz+F826YV40vbpxq9Ko1owm4CeoA7ADHeOEDykkoocbwYfwj1uA4RaJxNfDYQAVhkSJK mpGlba2xcBDpaaGPL2WlPT2aMs0knmaFvWP8xBRYws+ydvziLrIHy0hbrKNVF4VHX+0C fyd/rqwhf3q0jkh701znb1jrm3ecfPG4zFphTqr2S3wiO8P5DsPU6lOu9tgCIzF/4Y5C sJ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699573745; x=1700178545; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tJ2mcxHZV1sd+gf0+8yl0os8ZCjVCjG16xqzlWYwcNY=; b=cyfa1SXAOLcQdA8A8qSSaG4GbSEqEgDXOYzS852diMw789HWFIC+xc+XCWrBydo5yC /4FxUmy3cG2qjJhrEXW6o58C6sAMJHfBZzYUpWISbCQjq6QABkpeVM/RT/BmJ8vqIg9l mAsmfel5z0GyjxOb9Bpe7gNvVgwRTYl8v9iCzt3vsY8KLArxs+LcJUKf7+o53tNcWh/v am5cUIf6wp932Ar4lJ7oq+Q88J7NKXVHVhMFaGk5jRaBNQxZbSJTScgBTkew2+xsoH6y 4mqlOcF+H5XgAV9yH8THloFg67Eyt1G1ILMrUJc8E65n92/hw5CMI+xigg9ZqsW47dFo feEQ== X-Gm-Message-State: AOJu0YxcEFKZE56mZeXTe1GCr/XgT7Xt0+wYYc4skBriDegR1H5nF7bh mKkvdJ9kaeJk5eW4aBXTAREEdpT+Fcg= X-Google-Smtp-Source: AGHT+IEQhY/9nW7pNC7AZlru8frLN6+Xa0Yohp2hj8jcuHGJ/e555NdSldlLabarKVMWE4+1CVX5EA== X-Received: by 2002:a17:903:298e:b0:1cc:5730:ce55 with SMTP id lm14-20020a170903298e00b001cc5730ce55mr6927253plb.66.1699573744579; Thu, 09 Nov 2023 15:49:04 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id jb22-20020a170903259600b001c7283d3089sm4026325plb.273.2023.11.09.15.49.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Nov 2023 15:49:04 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x62d.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:312446 Archived-At: On 11/9/2023 1:20 PM, João Távora wrote: > Examples could be an implementation of lazy sequences > for example. So it stands to reason that there's no (obvious) reason > to preload seq.el, In fact, I was considering adding support to seq.el for generators, which we could consider a kind of lazy sequence. I'm not entirely sure I *need* it yet, but it could make a few things in Eshell easier. For example, Eshell has a for loop. It'd be nice if you could iterate over an Elisp generator, or even just repeatedly call a regular function that returns some new value each time[1]. If seq.el supported generators, I *think* Eshell could just call 'seq-map' (really, we'd want 'seq-mapc', but that's another story), and the code would do the right thing. This would make it easy for Eshell for loops to iterate over a range of integers without having to pre-build a list of all those integers. I haven't done this yet though, so it's possible there's something else that would throw a wrench into this. (In particular, Eshell's internals are a bit finicky at times, and I'm not sure how they'd interact with generators.) > Also I'm not an eshell uses and I don't understand how eshell users > benefit from this, i.e. why using any other sequence-manipulation > library, such as cl-lib.el, in esh-vars.el wouldn't do the job just > as well for them. Maybe you could explain? Currently, Eshell's use of seq.el is pretty basic, but 'seq-elt' in particular is nice since it automatically decides whether to use 'nth' or 'aref' as appropriate. I don't see any similar cl-lib function that would do this. This lets an Eshell user use a subscript like "$foo[1]" for anything that would make sense to index. (Though again, we need to special-case rings.) [1] Though this would probably necessitate a "break" statement to exit the loop.