[Jprogramming] data manipulation pointers
Raul Miller
rauldmiller at gmail.com
Wed Jun 22 06:32:37 HKT 2011
On Tue, Jun 21, 2011 at 4:38 PM, Johann Hibschman
<jhibschman+j at gmail.com> wrote:
> Raul Miller <rauldmiller at gmail.com> writes:
>
>> For starters, I would parse your data like this:
>>
>> 'area source year qtr hpi'=:|:}.<;._2@,&',';._2 htData
>> 'year qtr hpi'=:".L:0 year;qtr;hpi
>
> Thanks, that's interesting. It took me a depressingly long time to
> understand that first phrase, but it was illuminating. I'd not used
> cut at all before. For the second, I'll have to work on understanding
> L: more. My first impulse would be to use something like ".@< . I
> still don't quite understand when L: is appropriate.
each (or &.>) would also work here.
>> That said, I think tables in J are best represented as columns -- each
>> column has a name (it's a variable) and columns from the same table
>> are the same length (indices on one column work on the other columns
>> from that table).
>
> Well, I was thinking that if I had the entire table stored as a boxed
> array of some sort, then I could do selections on the entire table at
> once. For example, when I was trying to extract just the subset that
> had area-.'US', if I could do
You could do that but then you have to deal with extracting columns
every time you use it.
A better idea, I think, if you want to tightly associate the columns,
would be to make them all names in the same locale. But if you are
only working with a small number of tables, I think that bundling them
is more work than it is worth.
--
Raul
More information about the Programming
mailing list