Re: [julia-users] When does colon indexing get evaluated / converted?

2015-09-21 Thread Tomas Lycken
I recently implemented a similar transformation for array-like objects , in which I decided to create functions bounds(A, dim) = (lbound(A, dim), ubound(A, dim)) which return the end points of the indexing axes; without those, it was

Re: [julia-users] When does colon indexing get evaluated / converted?

2015-09-21 Thread Mauro
I seem to recall that this was discussed recently, probably by Matt, but cannot find it. I did however find this gist: https://gist.github.com/alsam/8283205, maybe of help. On Mon, 2015-09-21 at 06:38, 'Greg Plowman' via julia-users wrote: > To further clarify, I

[julia-users] When does colon indexing get evaluated / converted?

2015-09-20 Thread 'Greg Plowman' via julia-users
Hi, I'm trying to define a custom Array type that can be indexed using arbitrary ranges. e.g. A = MyArray(Int, 3:8) would define a 6-element vector with indexes ranging from 3 to 8, rather than the default 1 to 6. I've made some progress, but am now stuck on how to handle colon indexing.

Re: [julia-users] When does colon indexing get evaluated / converted?

2015-09-20 Thread 'Greg Plowman' via julia-users
To further clarify, I thought I could specialise getindex / setindex! on colon type argument. see below, getindex2 is being called, but getindex is not being called. A[:] calls getindex(A::AbstractArray{T,N},I::AbstractArray{T,N}) at abstractarray.jl:380 presumably after [:] has been converted

Re: [julia-users] When does colon indexing get evaluated / converted?

2015-09-20 Thread Spencer Russell
Can you post the code (or link to the repo) where you define your FArray type? -s > On Sep 21, 2015, at 12:38 AM, 'Greg Plowman' via julia-users > wrote: > > To further clarify, I thought I could specialise getindex / setindex! on > colon type argument. > > see

Re: [julia-users] When does colon indexing get evaluated / converted?

2015-09-20 Thread Spencer Russell
Hi Greg, This doesn’t answer your question directly, but I recommend you check out the Interfaces chapter of the manual for some good info on creating your own array type. To get indexing working the most important parts are:

Re: [julia-users] When does colon indexing get evaluated / converted?

2015-09-20 Thread 'Greg Plowman' via julia-users
Hi Spencer, Thanks for your reply. Actually I'm trying to follow the Interfaces chapter. I'm using Julia v0.3, so that might be a problem. Also I think my problem is mainly for vectors (1-dimensional array), because linear/subscript index has same syntax. For multi-dimensional arrays, I can