From: Noah Lavine <noah.b.lav...@gmail.com> >Hello, >>On Wed 23 Jan 2013 13:20, Daniel Llorens <daniel.llor...@bluewin.ch> writes: >> >>> In [2]: a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >> >>> In [4]: a[1] >>> Out[4]: array([4, 5, 6]) >>> In [5]: a[1, 1] >>> Out[5]: 5 >>> >>> array-ref can be extended very simply to do that. It accumulates on the >>> position as it is done now, but if the index list comes up short it >>> makes a shared array with the remaining axes instead of giving a rank >>> error. So it shouldn't be any slower than array_ref. >> >>It could make sense, yes. What do others think? What happens for >>array-set!? Care to propose a patch? > > > 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]] Or maybe that's already in Scheme. I'll admit I've never done matrices in scheme. -Mike
- Re: propose deprecation of generalized-vector-* Daniel Llorens
- Re: propose deprecation of generalized-vector-* Daniel Llorens
- Re: propose deprecation of generalized-vector-* Andy Wingo
- Re: propose deprecation of generalized-vecto... Daniel Llorens
- Re: propose deprecation of generalized-vecto... Andy Wingo
- Re: propose deprecation of generalized-vecto... Ludovic Courtès
- Re: propose deprecation of generalized-vector-* Andy Wingo
- Re: propose deprecation of generalized-vector-* Daniel Llorens
- Re: propose deprecation of generalized-vecto... Andy Wingo
- Re: propose deprecation of generalized-vecto... Noah Lavine
- Re: propose deprecation of generalized-vecto... Mike Gran
- Re: propose deprecation of generalized-vecto... Noah Lavine
- Re: propose deprecation of generalized-vecto... David Pirotte
- Re: propose deprecation of generalized-vecto... Mike Gran
- Re: propose deprecation of generalized-vecto... Daniel Hartwig
- Problems with 'number->string' (was Re: p... Mark H Weaver
- Re: propose deprecation of generalized-vecto... Daniel Llorens
- Re: propose deprecation of generalized-vecto... Noah Lavine
- Re: propose deprecation of generalized-vecto... Daniel Llorens
- Re: propose deprecation of generalized-vecto... Noah Lavine
- Re: propose deprecation of generalized-vecto... Noah Lavine