For higher dimensional arrays I use to_literal which builds a vector
with line feeds to look as though j displayed it. This is suitable for
transfer to file. For gnuplot two successive blank lines separate the
index groups.
rank =: #@:$
to_literal=: ([:,/,.&LF)"2^:(0>.<:@:rank)@:": NB. as a dyad x is x
of ":
to_literal i. 2 3 4
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
$ to_literal i. 2 3 4
74
On 02/20/2016 11:05 PM, [email protected] wrote:
Date: Sun, 21 Feb 2016 00:39:21 +0100
From: Louis de Forcrand<[email protected]>
To:[email protected]
Subject: [Jprogramming] Formatting tables
Message-ID:<[email protected]>
Content-Type: text/plain; charset=us-ascii
From what I read in the dictionary, all formatting primitives format
tables and higher rank arrays into a frame of 1-cells. Is there a way
to format a table using LFs between rows, so as to be easy to write to
a file?
I tried formatting a (huge) rank-2 array of coordinates for gnuplot using
farray=: ":!.20 array
text=: (, LF&,)/ farray
and it's been running for a while now.
The funny thing is that the actual initial formatting took under five
seconds; I'm pretty sure there's a better way to do this.
Louis
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm