This is nice. That's something that I had in mind:
inverted table represenation.
Are there unit tests of samples for this class?
If the data intended for J comes from the database,
wouldn't be logical to use DataReader instead of
DataTable, which created a second cache of the whole
result in memory? However, the logic will have to
be regrouped to be able to fill separate columns
in parallel. There is an improvement in .NET 3.0
to support thin dynamically emitted methods for that.
Boxed result is interesting and J boxed arrays construction
in .NET too. But it might be more efficient to use native
homogenous .NET vectors for columns and pass them natively
into J unboxed with fixing and SetM.
--- Raul Miller <[EMAIL PROTECTED]> wrote:
> Hypothetically speaking, the J datastructure which best
> matches a .Net DataTable would be an N,3 array of
> boxes where N is the number of columns.
>
> The three boxes which would describe a column are:
>
> 0 { The name of the column.
>
> 1 { A boolean list with 1 for non-null and 0 for null values.
> This can be a scalar 1 for columns which do not allow nulls.
>
> 2 { A list containing the elements within that column
> (using fill elements for null values).
>
> Playing around with SetB/GetB, it looks like they do not deal
> with nested arrays. However for many cases you can treat
> a data table as N*3 flat arrays, instead.
>
> Alternatively, you can supply a literal value to SetB and convert
> that to a boxed array using 3!:2. I'm going to attempt to attach
> to this message an example of how you might put a DataTable
> into this format.
>
> The value produced by the GetBytes() method of the JConvert
> class is suitable as the second argument for j.SetB(,) and
> is intended to be an argument to 3!:2 within the J session.
>
> That said, this is alpha quality software. It seems to work for
> me, but I've not tested all code paths. Also, when I display
> the array, it looks funny inside J, so I suspect I messed
> something up -- something which J does not treat as an
> error case but nevertheless assumes something different... or
> maybe I'm just worrying about nothing.
>
> FYI,
>
> --
> Raul
> > using System;
> using System.Data;
> using System.Collections.Generic;
> using System.Runtime;
> using System.Text;
>
> namespace JSoftware {
> public class JConvert {
...
> }
____________________________________________________________________________________
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm