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: Re: name an array function Date: Thu, 15 Dec 2016 12:12:58 +0100 Message-ID: References: <20161121125556.GA12982@tuxteam.de> <89CFAA9E-77F7-4428-AA59-72F9AB8796D7@bluewin.ch> <20161121132405.GA14580@tuxteam.de> <464A9A58-83D3-4C53-A936-BC2C83BC402C@bluewin.ch> <20161121135609.GA15712@tuxteam.de> <20161123184856.4c6b276b@capac> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1481800415 17766 195.159.176.226 (15 Dec 2016 11:13:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 15 Dec 2016 11:13:35 +0000 (UTC) Cc: guile-user@gnu.org To: David Pirotte Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Dec 15 12:13:32 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 1cHTyd-0003jb-7x for guile-user@m.gmane.org; Thu, 15 Dec 2016 12:13:31 +0100 Original-Received: from localhost ([::1]:53680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHTyh-0007tm-I2 for guile-user@m.gmane.org; Thu, 15 Dec 2016 06:13:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHTyI-0007ZQ-Sh for guile-user@gnu.org; Thu, 15 Dec 2016 06:13:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cHTyE-0003SB-Qy for guile-user@gnu.org; Thu, 15 Dec 2016 06:13:10 -0500 Original-Received: from vimdzmsp-sfwd03.bluewin.ch ([195.186.120.132]:58070 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 1cHTyE-0003RX-H0 for guile-user@gnu.org; Thu, 15 Dec 2016 06:13:06 -0500 Original-Received: from 4box.hq.corp.viasat.com ([213.193.80.99]) by vimdzmsp-sfwd03.bluewin.ch Swisscom AG with SMTP id HTy9c9KEZqjPOHTy9c9WnD; Thu, 15 Dec 2016 12:13:03 +0100 X-Bluewin-Spam-Analysis: v=2.1 cv=Z99MZClA c=1 sm=1 tr=0 a=DzaHVtLsrNCQ5PccsnG91A==:117 a=DzaHVtLsrNCQ5PccsnG91A==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=8nJEP1OIZ-IA:10 a=zLAK2rZV7IlSHRttfJkA:9 a=wPNLvfGTeEIA:10 X-Bluewin-Spam-Score: 0.00 X-FXIT-IP: IPv4[213.193.80.99] Epoch[1481800383] X-Bluewin-AuthAs: dll@bluewin.ch In-Reply-To: <20161123184856.4c6b276b@capac> X-Mailer: Apple Mail (2.1878.6) X-CMAE-Envelope: MS4wfN78TRtEYpDK9bIEXx/oJcXsoV81ZLDLqaNbp78r/UYCoE89Mm26ydGwOQW5uGz5elE4wysAUr4b11ndXbqQG1mh3HhSRZHPQWpA3/07zYi/h7widc0R lhJcY7sUgLUIQccJQ4uTMLHHAz+17Iz6zPER+eYVcsuIQdNPQjFFJPt0DO2u6jm5ne+dHfWO30vICZbfYoUUyg7OdttnzHsyihdeE74oijjabnZNEpnCHIlX 4eWBCI6MejpoVvRfwz8ipg== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.186.120.132 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:13025 Archived-At: On 23 Nov 2016, at 21:48, David Pirotte wrote: > Le Wed, 23 Nov 2016 17:07:30 +0100, > Daniel Llorens a =E9crit : >=20 >> On 21 Nov 2016, at 14:56, tomas@tuxteam.de wrote: >>=20 >>> I (politely) disagree: the most "commonly" used function is >>> already array-ref, so you would seldomly use array-from/slice >>> for a scalar result (the rank-0 result will be more frequent, >>> because there's no substitute). But hey, as I said. =20 >>=20 >> I don't use array-ref/set! anymore since array-from/amend! generalize = them. I >> actually use a further generalization in a separate library :p >>=20 >> But I have a proposal below that makes this discussion moot, I hope. >>=20 >> | master (current) | meaning | proposal = | >> = |---------------------+----------------------------------+----------------= ------| >> | array-from* | look up subarray, even #0(x) | = array-slice | >> | array-from | look up cell, so x and not #0(x) | = array-cell-ref | >> | array-amend! | set cell | = array-cell-set! | >> | array-for-each-cell | iterate over subarrays | = array-for-each-slice | >=20 > I'd use=20 >=20 > array-slice-ref/set! > array-slice-for-each >=20 > Unless I miss understood something :) >=20 > Cheers, > David The slice/cell distinction is to be able to use the array as a list of = items regardless of whether the items have rank 0 or not. array-slice doesn't need -ref or -set! variants because it always = returns an array object, so you can do (array-copy! B (array-slice A = ...)) or (array-copy! (array-slice A ...) B). On the other hand = array-cell-ref may return a non-array object so the -set! variant is = necessary. array-for-each-cell -> array-slice-for-each is ok I think b/c it really = does iterate over slices and not cells. So what about this? if there's no comment in a week or so I'll take it = as settled. | master (current) | meaning | proposal = | = |---------------------+----------------------------------+----------------= ------| | array-from* | look up subarray, even #0(x) | array-slice = | | array-from | look up cell, so x and not #0(x) | = array-cell-ref | | array-amend! | set cell | = array-cell-set! | | array-for-each-cell | iterate over subarrays | = array-slice-for-each | Thanks Daniel=