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_begin + i;
var px = &x;
px . i <- 42;
println$ x . i;
x . (i - 1) = 53;
println x;
////////
So no need for x.[i] notation at all now.
[The pa.stl_begin thing is unsafe, however].
The really nice thing is, with a slice object we can do the same trick.
For example
a . slice(1,10)
which can be made to look cooler with say
a . 1 .. 10
or some other notation.
BTW: the important thing here is to get this stuff into the type classes.
That means the notation is automagically inherited for all array types.
--
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language