Re: [Felix-language] array indicies

2012-04-11 Thread john skaller
How's this look? i a // i'th member of array value a a + i // pointer to i'th member of array object a Works for array, varray,darray. carray isn't an array (no length). === var x = (1,2,3,4); var px = &x; proc vtst[V,T with ArrayValue[T,V]] (x:T, s:string) { pr

Re: [Felix-language] array indicies

2012-04-11 Thread john skaller
On 10/04/2012, at 10:12 PM, john skaller wrote: > Unfortunately it's a no-go. New theory .. a + i <- a . j; RHS uses a.j notation (or, j i). This is sustainable for opaque array types. It can work for array[] as well. LHS can be implemented for opaque types. For array object, we hav

Re: [Felix-language] array indicies

2012-04-10 Thread john skaller
On 10/04/2012, at 9:11 AM, john skaller wrote: > > On 10/04/2012, at 7:59 AM, john skaller wrote: > >> Dang .. this works! > > > OMG .. this is even nicer: Unfortunately it's a no-go. It works for array, because array as value is "array" and array as object is "&array". But varray, for

Re: [Felix-language] array indicies

2012-04-09 Thread john skaller
On 10/04/2012, at 7:59 AM, john skaller wrote: > Dang .. this works! > > > fun apply[t,n] (i:int,a:array[t,n]) => a.[i]; > > val x = 11,22,33,44; > println$ 2 x; BTW: the idea here is that "2" is a projection function. So writing x.2 is just reverse application. Of course here 2 isn't r

Re: [Felix-language] array indicies

2012-04-09 Thread john skaller
On 10/04/2012, at 7:59 AM, john skaller wrote: > Dang .. this works! OMG .. this is even nicer: fun apply[t,n] (i:int,a:array[t,n]) => a.[i]; var x = 11,22,33,44; println$ 2 x; println$ x . 2; var i = 1; println$ i x; println$ x . i; fun apply[t,n] (i:int,pa:&array[t,n]) => pa.stl_

[Felix-language] array indicies

2012-04-09 Thread john skaller
Dang .. this works! fun apply[t,n] (i:int,a:array[t,n]) => a.[i]; val x = 11,22,33,44; println$ 2 x; println$ x . 2; var i = 1; println$ i x; println$ x . i; / As you may know I recently simplified tuple access to (1,2,3) . 1 i.e. you can select the i'th component by just wri