Fox matrix indexing, one can use 0 and get a full slice:
m = [ 1 2 , 3 4];
m[0,1]; // [1, 3]
For Data tables this works as well:
test = new table("test",
add rows(10),
new column("col1",Character, set each value({"A","B","C"}[random integer(3)])),
new column("col2", set each value(random uniform(5))));
test[4,0]
For lists of lists, this is not possible:
list= {{"A", 3},{"B", 5}};
list[0,1]
Sure, there are many lists of lists where such slicing is not possible, like {{"A", 3},{"B"}}.
On the other hand, there ARE many lists of list that would allow it.
Where it gets really interesting: Associative arrays of associative arrays.
Like with lists, the concept of Associative Arrays is more flexible than what we can do with a matrix or data table - so slicing will not work for them. But like with lists, there ARE Associative arrays where slicing will work ...
Is there a function in JSL, something like myAssociativeArray[0, "weight"], which does this job?
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
dt << Save( "$DOWNLOADS/test.json" );
// for sake of simplicity we accept to lose 1x ROBERT
myIndex=dt[0,"name"]
myAssociativeArray = Associative Array(myIndex,ParseJSON(Load text file ( "$DOWNLOADS/test.json")));
// cool, but not what we want
mapToWeight = Transform Each({{key, value}}, aa, value["weight"]);
SliceAssociativeArray= Function({aa, indexname},
Transform Each({value}, aa << get values, value[indexname])
);
SliceAssociativeArray(myAssociativeArray ,"weight") //myAssociativeArray [0, "weight"]