On Mon, Feb 18, 2013 at 11:25 AM, Mike Gran <spk...@yahoo.com> wrote:

> From: Noah Lavine <noah.b.lav...@gmail.com>
> > I haven't worked with the array functionality, so I might be missing
> > something, but I don't see why this is natural for array-ref.
>
> One could imagine a Matlab-like syntax where array-ref has to have
> the same number of indices as the underlying array, but, if an
> index were replaced with a symbol, it would return a slice.
>
> if np is [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
> (array-ref np 1 1) -> 5
> (array-ref np 1 :) -> [4, 5, 6]
> (array-ref np : 1) -> [[2], [5], [8]]
>

Yes, that would be cool. But I'm not arguing that we shouldn't have some
cool array-slicing functions - I'm just saying that they might belong in a
separate function, not in array-ref.


> Or maybe that's already in Scheme. I'll admit I've never done matrices
> in scheme.
>

As far as I know, there's no standard Scheme way to do arrays.

I haven't done arrays or matrices in Scheme either, so don't take what I
say too seriously. I would like to do it some time, but it'll probably only
happen if I need to do a lot of array programming for work some time. I
think the only way to get the interface right is to have someone write some
serious array-processing software in Guile, and then basically do whatever
they say. :-)

Noah

Reply via email to