On Sun, Feb 14, 2010 at 5:49 AM, Ian Clark <[email protected]> wrote:
> 1. If I have a M-by-N table with entries like this
> ...
> {. curlylfdot
>
> {:: curlylfcoco {: curlylfco
> } curlyrt
> ...
>
> how do I neatly slice off the first 3 columns (say) into a boxed list
> of tally M to serve as a lookup index?
In this case, you could cheat by
st=: 0 :0
{. curlylfdot
{: curlylfco
{:: curlylfcoco
} curlyrt
)
]li=: <;._2 st
+--------------+-------------+---------------+-----------+
|{. curlylfdot|{: curlylfco|{:: curlylfcoco|} curlyrt|
+--------------+-------------+---------------+-----------+
]wo=: ;:&> li
+---+-----------+
|{. |curlylfdot |
+---+-----------+
|{: |curlylfco |
+---+-----------+
|{::|curlylfcoco|
+---+-----------+
|} |curlyrt |
+---+-----------+
If you really want to use a fixed width first column, then try
]wo=: 3 ({.;}.)&> li
+---+------------+
|{. | curlylfdot |
+---+------------+
|{: | curlylfco |
+---+------------+
|{::| curlylfcoco|
+---+------------+
|} | curlyrt |
+---+------------+
Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm