Looking for a dyadic foo
with
4 = (3!:0) x NB. x is integer
(# x) = 2 = #$ x NB. x has 2 items and has rank 2
(# y) = +/{: x
0 < <./{. x NB. {.x is positive
such that
({.x) -: L."0 x foo y NB. {.x is level of leaves
({:x) -: # S:0 x foo y NB. {:x is tally of leaves
Example:
(1 2 3 2 3 1,:2 1 3 2 1 3) foo i.12
+---+---+---------+-----+-----+-------+
|0 1|+-+|+-------+|+---+|+---+|9 10 11|
| ||2|||+-----+|||6 7|||+-+|| |
| |+-+|||3 4 5|||+---+|||8||| |
| | ||+-----+|| ||+-+|| |
| | |+-------+| |+---+| |
+---+---+---------+-----+-----+-------+
R.E. Boss
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm