[Jprogramming] Unboxing a matrix
Ric Sherlock
tikkanz at gmail.com
Sun Nov 27 16:46:19 HKT 2011
I agree that if the boxed matrix contains all literal data (which is
likely if this is data read from a text file) then there won't be a
domain error from ( ;:inv"1 mat ). However if Skip's example matrix
ts2 contained only text then there wouldn't be a domain error from ( >
ts2 ) or ( ; ts2 ).
On Sun, Nov 27, 2011 at 9:34 PM, Aai <agroeneveld400 at gmail.com> wrote:
> I think not. I suspect Skip is working on one of his previous thread subjects
> (finding multiple sequential strings). But he should say if so or not. :-)
>
> Hallo Ric Sherlock, je schreef op 27-11-11 09:27:
>> I suspect that will also produce a domain error because the contents
>> of ts2 appear to be of mixed type.
>>
>> If the idea is to write the result to file then the other issue is
>> that it will produce a rectangular matrix with extra spaces padding
>> lines shorter than the longest one. I solve this by boxing each line
>> adding the LF and then razing the boxed list.
>> ;<@(LF ,~ ;:inv)"1 mat
>>
>> On Sun, Nov 27, 2011 at 9:16 PM, Aai<agroeneveld400 at gmail.com> wrote:
>>> e.g.
>>>
>>> ;: inv"1 mat
>>>
>>>
>>>
>>> Hallo Skip Cave, je schreef op 27-11-11 08:58:
>>>> I have a 5 x 2 boxed array ts2:
>>>>
>>>> ts2
>>>> ┌───┬────────────────┐
>>>> │355│ freeways │
>>>> ├───┼────────────────┤
>>>> │356│ traffic │
>>>> ├───┼────────────────┤
>>>> │357│ ninety one west│
>>>> ├───┼────────────────┤
>>>> │358│ yes │
>>>> ├───┼────────────────┤
>>>> │361│ sixty │
>>>> └───┴────────────────┘
>>>>
>>>> $ts2
>>>> 5 2
>>>>
>>>> I want to unbox it so the result is a text array with carriage returns:
>>>>
>>>> 355 freeways
>>>> 356 traffic
>>>> 357 ninety one west
>>>> 358 yes
>>>> 361 sixty
>>>>
>>>> I tried lots of stuff:
>>>> ; ts2
>>>> |domain error
>>>> | ;ts2
>>>>
>>>> > ts2
>>>> |domain error
>>>> |>ts2
>>>>
>>>> , ts2
>>>> ┌───┬─────────┬───┬────────┬───┬────────────────┬───┬────┬───┬──────┐
>>>> │355│ freeways│356│ traffic│357│ ninety one west│358│ yes│361│ sixty│
>>>> └───┴─────────┴───┴────────┴───┴────────────────┴───┴────┴───┴──────┘
>>>>
>>>> Nothing seems to work. Any ideas?
>>>>
>>>> Skip
>>>> ----------------------------------------------------------------------
>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>> --
>>> Met vriendelijke groet,
>>> @@i=Arie Groeneveld
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> --
> Met vriendelijke groet,
> @@i=Arie Groeneveld
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list