unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: tomas@tuxteam.de
To: Daniel Llorens <daniel.llorens@bluewin.ch>
Cc: guile-user@gnu.org
Subject: Re: name an array function
Date: Mon, 21 Nov 2016 14:24:05 +0100	[thread overview]
Message-ID: <20161121132405.GA14580@tuxteam.de> (raw)
In-Reply-To: <89CFAA9E-77F7-4428-AA59-72F9AB8796D7@bluewin.ch>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Nov 21, 2016 at 02:10:12PM +0100, Daniel Llorens wrote:
> 
> On 21 Nov 2016, at 13:55, <tomas@tuxteam.de> <tomas@tuxteam.de> wrote:
> 
> > > 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.
> > 
> > Understandable... but a pity, really.
> 
> yeah...
> 
> > Uh, oh. That's NSFW material ;-) My head exploded (faint memories
> > of APL).
> 
> check out ‘J for C programmers’, I think it has good explanations.
> 
> > I do like slice. But I'm perhaps off because I don't quite understand
> > your mumblings about "the rank of the result would be positive".
> > What do they return otherwise? Do they throw an exception?
> 
> They return the element itself. E.g.
> 
> (array-from #2((a b) (c d)) 0) => #1(a b)
> (array-from #2((a b) (c d)) 0 0) => a
> 
> the rank of the second result would be zero (so #0(a)) if the result was always a ‘slice’. This is what I meant. There's a variant which always returns a ‘slice’:
> 
> (array-from* #2((a b) (c d)) 0) => #1(a b)
> (array-from* #2((a b) (c d)) 0 0) => #0(a)

OK, got it.

So should "slice" prevail, it'd make sense to "invert" the star
(array-slice corresponding to array-from* and vice-versa)?

Slice still feels way better to me, but I'll take them with any
name :-D

Had I to look it up by name without any idea of what to look
for, I'd never come up with array-from, whereas I'd have a faint
chance of coming up with array-slice; that said, the most
ergonomic choice would still be (an extension of) array-ref et
al. or some close relative.

thanks
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlgy9XUACgkQBcgs9XrR2kY9zQCeMkQZK2OPXtAlTMC56dW0HLDg
Y9sAnR0tKAJ8C6iQYwbKlLQh4fBBIB9A
=eb31
-----END PGP SIGNATURE-----



  reply	other threads:[~2016-11-21 13:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 10:32 name an array function Daniel Llorens
2016-11-21 12:37 ` Stefan Israelsson Tampe
2016-11-21 12:55 ` tomas
2016-11-21 13:10   ` Daniel Llorens
2016-11-21 13:24     ` tomas [this message]
2016-11-21 13:42       ` Daniel Llorens
2016-11-21 13:56         ` tomas
2016-11-23 16:07           ` Daniel Llorens
2016-11-23 20:32             ` tomas
2016-11-23 20:48             ` David Pirotte
2016-12-15 11:12               ` Daniel Llorens
2016-12-15 11:30                 ` tomas
2016-11-21 14:01 ` Panicz Maciej Godek
2016-11-21 14:38   ` Daniel Llorens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161121132405.GA14580@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=daniel.llorens@bluewin.ch \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).