On Wed, Jan 28, 2009 at 9:10 PM, Saaa <[email protected]> wrote:
> char[][] data;
> data=cast(char[][])splitlines(cast(invariant
> char[])read(`data\parsed.dat`));
>
> bool[][] dataIn = new bool[][](data.length, 3);
>
> for(int i; i<data.length; i++)
> {
>  int[3] temp = to!(int[])(split(data[i][14..19].idup,`,`)); // 14..19 =
> `0,0,1`
>  foreach(index, t; temp)
>  {
>  dataIn[i][index] = cast(bool) t;
>  }
> }
> writefln(data[0][14..19]);
> writefln(dataIn[0]);

Sorry, can't help but post this:

local data = io.readFile("data/parsed.dat").splitLines().apply$
        \line -> line[14 .. 19].split(",").apply$
                \item -> toBool$ toInt$ item

writeln$ data[0]

It's a one-liner (one-..statementer) in MiniD!  <_<

Reply via email to