On Fri, 15 Oct 2021, Katrina Scialdone wrote:
<"0&> input ; (parens input) ; (depthOf input)
NB. you can remove redundancies here using a fork:
<"0&> (] ; parens ; depthOf) input
Its behavior is quite similar to ,[0.5] in Dyalog APL, which was the
inspiration for finding a J equivalent.
If your lists are homogenous, you can use ,: instead:
x=. i.5
y=. -x
z=. *:x
w=. -:x
x , y , z ,: w
0 1 2 3 4
0 _1 _2 _3 _4
0 1 4 9 16
0 0.5 1 1.5 2
(Whoever thought the axis operator was a good idea, I have no idea... :)
Is this a known technique, and is there a common name for this?
I don't know of a specific name for it, but using boxes to format tables
is definitely common.
The dictionary uses something similar to demonstrate the 'table' adverb
(https://www.jsoftware.com/help/dictionary/intro03.htm).
-E
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm