I think I'll hold out for an intrinsic notation, like x[k,\cdot,\cdot], or x[k,\vdots,\vdots].
Or x[k,_,_] I'd enjoy writing array manipulations more without squeeze's interspersed. On Wednesday, September 3, 2014 1:51:13 PM UTC-5, Tim Holy wrote: > > Sure, if you want to be reckless you can put this into your .juliarc.jl: > > import Base: squeeze > squeeze(A::AbstractArray) = squeeze(A, filter(i->size(A,i)==1, > 1:ndims(A))) > > You can of course choose to submit the second line as a pull request, and > see > what folks think. > > --Tim > > On Wednesday, September 03, 2014 11:35:48 AM David Smith wrote: > > Ok, so you can continue using the old squeeze. Us reckless types can > use > > the aggressive one. ;-) > > > > I don't see why it shouldn't be available. Is there a fear that new > users > > will run into subtle errors and hate Julia because of it? > > > > What I hate is typing squeeze(x, 1) all the time. > > > > On Wednesday, September 3, 2014 1:21:56 PM UTC-5, Tim Holy wrote: > > > On Wednesday, September 03, 2014 10:57:16 AM David Smith wrote: > > > > Also, why don't we have a squeeze(A::AbstractArray{T,N}) method that > > > > eliminates all singleton dimensions? If we had that, indexing > returning > > > > singleton dimensions wouldn't be as bad. Currently, having to write > > > > squeeze(a[k,:,:],1) is terrible. That is something where Matlab > wins. > > > > > > It wins, until the day that the a that gets returned by some other > > > algorithm > > > happens, on one iteration out of 10^4, to have size (K, M, N) with M > =1. > > > At > > > that point, Matlab's squeeze delivers you an Nx1 array rather than the > 1xN > > > array you wished you had. > > > > > > I can't tell you how many times I got bit by that, until I stopped > using > > > squeeze altogether and just used reshape(). Which is more tedious yet > than > > > Julia's squeeze(). > > > > > > --Tim > >