guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: name an array function


From: tomas
Subject: Re: name an array function
Date: Mon, 21 Nov 2016 14:24:05 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

-----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, <address@hidden> <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]