Thank you Bill. That was just what I needed to understand (".) better,
in the spirit of what I was trying to do.

Thank you also, Raul, Roger and Devon. These furnish me with
counterparts to techniques familiar to me in APL+Win.
I shall have a use for all of them in my current project.

Ian


On Tue, Apr 6, 2010 at 10:50 AM, bill lam <[email protected]> wrote:
> For your particular case, since ". is rank-1, it is sufficient to coerce
> result from it to rank-1 so that the assembled will be rank-2.
>
>   ,@". ":i.3 1
> 0
> 1
> 2
>
>   ,@". ":i.3 2
> 0 1
> 2 3
> 4 5
>
> mar, 06 Apr 2010, Ian Clark skribis:
>> I was afraid that would be the answer.
>>
>> The inconvenience to my code is negligible. It just needs one more
>> line, with an (if.) in it. What distresses me is my failure to
>> understand why it happens. It makes me suspicious of my whole
>> data-storage approach.
>>
>> I need to store a 2-D integer array, call it z, in an ascii text file
>> and recover it on reloading the file.
>> Suppose 'a b'=:$z
>> Proviso: z is one of several arrays of mixed data. I want to retain a
>> visual check on the file contents that they all match-up by rows
>> (numbered: i.a). Without this proviso, a sensible thing to do is to
>> store the contents of z as a vector and reconstruct it from a
>> knowledge of the number of rows, (a).
>> Taking a simple minded approach, however, I can use (":) to stuff z in
>> a file, and (".) to recover it again from the (2-D) file image. This
>> seems adequate and reliable provided a>1 and b>1. I just wouldn't have
>> anticipated it breaking down for b=1, which is not an uncommon case to
>> arise.
>>
>> Clearly this is not the approach an experienced J-er would take, and
>> I'd like to know what that is.
>>
>> I don't want to drag this thread off-topic. It just seemed related in
>> my mind to the problem of predicting the number of display-lines in z
>> -- or do I mean (":z)? Or (". ":z)?
>>
>> Ian
>>
>>
>> On Tue, Apr 6, 2010 at 12:29 AM, Roger Hui <[email protected]> wrote:
>> [---=| TOFU protection by t-prot: 55 lines snipped |=---]
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to