From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jay Sulzberger Newsgroups: gmane.lisp.guile.user Subject: Re: Python slices in Scheme Date: Fri, 23 Jun 2023 13:26:50 +0000 () Message-ID: References: <5A5012F2-7712-49AD-9337-D688F0F2CC27@sarc.name> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35245"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jay Sulzberger To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Jun 23 15:27:41 2023 Return-path: Envelope-to: guile-user@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 1qCgpB-0008xx-7X for guile-user@m.gmane-mx.org; Fri, 23 Jun 2023 15:27:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCgoR-0000RR-W1; Fri, 23 Jun 2023 09:26:56 -0400 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 1qCgoP-0000JM-KV for guile-user@gnu.org; Fri, 23 Jun 2023 09:26:53 -0400 Original-Received: from mailbackend.panix.com ([166.84.1.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qCgoN-00038a-TQ for guile-user@gnu.org; Fri, 23 Jun 2023 09:26:53 -0400 Original-Received: from panix3.panix.com (panix3.panix.com [166.84.1.3]) by mailbackend.panix.com (Postfix) with ESMTP id 4QndLf3FQqzrxJ; Fri, 23 Jun 2023 09:26:50 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=panix.com; s=panix; t=1687526810; bh=+QqKqtn10/K+t5cczOUlZdMzxZs57Z+EfPz2GU0KMRo=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=Rs4fME3f6ObdOqYQZiWYOup+ZN83ee1pU0Bf5SutdeIN4sOBiaMjx65LnREf1viGp M/o+zswiyJInDA2B0D+MzHtJsLAOA5Nzx79YXV7UZlRE5PTEjDqRQMkSzv9mOEeQt8 urDESw6Cd8SL0+w0t3dLNcAwVLPNnxs+eSGYzI1o= Original-Received: by panix3.panix.com (Postfix, from userid 7271) id 4QndLf4Fhgz1QXM; Fri, 23 Jun 2023 09:26:50 -0400 (EDT) Original-Received: from localhost (localhost [127.0.0.1]) by panix3.panix.com (Postfix) with ESMTP id 4QndLf4DYLz1QX9; Fri, 23 Jun 2023 09:26:50 -0400 (EDT) In-Reply-To: <5A5012F2-7712-49AD-9337-D688F0F2CC27@sarc.name> Received-SPF: pass client-ip=166.84.1.89; envelope-from=jays@panix.com; helo=mailbackend.panix.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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19063 Archived-At: On Mon, 19 Jun 2023, lloda wrote: > My library guile-newra (1) has quite general multidimensional array > slicing. The indices < can be linear ranges or arbitrary integer > arrays and they can have any rank. You can also use the indexed > array as write target. If all the indices are linear ranges then the > operation is done without copies. It also has placeholders, so you > can skip axes, like : and ... in numpy. guile-newra's arrays are > applicative, so you can do (thearray firstindex secondindex ...), > without special brackets. Dear lloda, I have not yet run your code, but I just now ran my eyes over https://lloda.github.io/guile-newra/#Slicing Heaven forwarding, I will run some of your code before the snows come. Thank you! oo--JS. > > You need wrappers to use it with Guile's native array types, so it > may not be as convenient. Or maybe you don't need to handle > arbitrary rank, then it might not be the best option. It's also far > from finished, although the stuff I mentioned above does work. > > I didn't adopt Pythons -1 = end convention because in Guile arrays can have any > base index, not necessarily 0 (whether that's a good idea or not). > > (1) https://lloda.github.io/guile-newra/#Slicing > https://github.com/lloda/guile-newra/ > https://notabug.org/lloda/guile-newra