Here is an array from the L: Level At page in the Dictionary. Below is a tree
display representing the array and showing levels (square brackets) and leaves.
Your mission, should you decide to accept it, is to write a verb boxtree such
that "boxtree array" produces as much of the tree display as is practical.
To begin with, just produce the bare tree. Each 'o' represents a box. We can
work on adding level markers, leaves, and the name of the array later.
I hope the array and tree display well in your email reader. I sent them in
Unicode Courier New as defined by Microsoft's WordPad and transformed by
Thunderbird (email program).
Kip
] y=: (<<2 3 4),<(5 6 ; <<i. 2 3)
+-------+-------------+
|+-----+|+---+-------+|
||2 3 4|||5 6|+-----+||
|+-----+|| ||0 1 2|||
| || ||3 4 5|||
| || |+-----+||
| |+---+-------+|
+-------+-------------+
y
. [3]
/ \
/ \
/ \
/ \
/ \
/ \
/ \
[1] o o [2]
| / \
| / \
| / \
| / \
[0] o [0] o o [1]
2 3 4 5 6 |
|
|
o [0]
0 1 2
3 4 5
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm