From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Daniel Llorens Newsgroups: gmane.lisp.guile.user Subject: name an array function Date: Mon, 21 Nov 2016 11:32:28 +0100 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1479724391 3385 195.159.176.226 (21 Nov 2016 10:33:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 21 Nov 2016 10:33:11 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Nov 21 11:33:05 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c8luK-0007fG-VX for guile-user@m.gmane.org; Mon, 21 Nov 2016 11:33:05 +0100 Original-Received: from localhost ([::1]:48521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8luJ-0003JY-QO for guile-user@m.gmane.org; Mon, 21 Nov 2016 05:33:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8ltv-0003I8-O0 for guile-user@gnu.org; Mon, 21 Nov 2016 05:32:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c8lts-0004NW-KK for guile-user@gnu.org; Mon, 21 Nov 2016 05:32:39 -0500 Original-Received: from vimdzmsp-sfwd02.bluewin.ch ([195.186.227.134]:55144 helo=smtpauths.lb.bluewin.ch) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c8lts-0004Lm-DU for guile-user@gnu.org; Mon, 21 Nov 2016 05:32:36 -0500 Original-Received: from 4box.hq.corp.viasat.com ([213.193.80.99]) by vimdzmsp-sfwd02.bluewin.ch Swisscom AG with SMTP id 8ltncyn92Jm1f8ltnc4p3p; Mon, 21 Nov 2016 11:32:32 +0100 X-Bluewin-Spam-Analysis: v=2.1 cv=XbUptNN5 c=1 sm=1 tr=0 a=DzaHVtLsrNCQ5PccsnG91A==:117 a=DzaHVtLsrNCQ5PccsnG91A==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=N659UExz7-8A:10 a=U5rPHJkfAAAA:8 a=mDV3o1hIAAAA:8 a=PVjRH4yo-xn5ODtaSFkA:9 a=pILNOxqGKmIA:10 a=56MxVoPhC-cA:10 a=QU3gAnU3qzQA:10 a=_VGt5asjOhojwZUgu1DP:22 a=_FVE-zBwftR9WsbkzFJk:22 X-Bluewin-Spam-Score: 0.00 X-FXIT-IP: IPv4[213.193.80.99] Epoch[1479724352] X-Bluewin-AuthAs: dll@bluewin.ch X-Mailer: Apple Mail (2.1878.6) X-CMAE-Envelope: MS4wfEJiflRoF73nTP4MeB3igVPLCoUlSuYJMoUB/ktp+u61xZjpo0zWyNXl/n1H5/AhOO16PzqX3ECTt9iXs713TdkZPEFX9vXli9FMkvFDnHinOt5nxmYB CljqtySFJoigAAU2kf0kEdEFSUgeUxIVPSvC+fWFNQ156Z52LAqKfpIaQtREzROzU8lxQdfk0M/D1A== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.186.227.134 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12994 Archived-At: Hello, version 2.2 of Guile will (I hope) include rank-polymorphic versions of = array-ref, array-set! and array-for-each. What this means is that = instead of requiring as many indices as the rank of the array, with = these functions you can give fewer indices and get a subarray (a =91prefix= slice=92). If you give all the indices, they behave just as the current = versions. My original intention was for these functions to replace array-ref and = array-set!. That's how a number of array languages/libraries do it = (numpy, to mention a popular one. You don't need to say A[i, :, :], you = can just say A[i].). However, the maintainers spoke against this, so = these functions need different names. The names I chose are array-from, array-amend! and array-for-each-cell. = These names are taken from the J docs = (http://www.jsoftware.com/help/dictionary/d520.htm, = http://www.jsoftware.com/help/dictionary/d530n.htm), because the = behavior is based on J and I consider J to be =91the source=92 when it = comes to these concepts. civodul has proposed array-slice instead of array-from. However, = array-from only returns a slice when the rank of the result would be = positive. wingo has pointed out that it is unusual to have a function = name ending in a preposition.=20 What do *you* think should be the names of these functions? Thanks, lloda PS: The justification for these functions is given in the documentation, = but in short: 1) other than the creation of the subarray descriptors, = they don't cost any more than the rank-strict versions, 2) the only way = to reproduce them in current Guile is with make-shared-array, which is = very slow and cumbersome, 3) they recover a functionality that used to = be part of Guile but was removed (=91enclosed arrays=92).=20 PPS: You can check out the functions at = http://git.savannah.gnu.org/gitweb/?p=3Dguile.git;a=3Dshortlog;h=3Drefs/he= ads/lloda-squash1. I rebase this branch on master periodically. The = maintainers have reviewed it, but any extra reviews would of course be = appreciated, especially of the doc.