Pascal Jasmin wrote:
> If I do not know the shape of items in advance,
> how would I box each item?
Solution:
boxItems =: < items
boxItems (;~"0 i.5)
+-----+-----+-----+-----+-----+
|+-+-+|+-+-+|+-+-+|+-+-+|+-+-+|
||0|0|||1|1|||2|2|||3|3|||4|4||
|+-+-+|+-+-+|+-+-+|+-+-+|+-+-+|
+-----+-----+-----+-----+-----+
The utility "items" is defined in the standard library. You could satisfy your
curiosity by just checking out its definition. But can you figure out what it
is without peeking? Hint: it's very simple; in fact, it is defined in only two
words.
Bigger hint: http://www.jsoftware.com/jwiki/Essays/A%20Fine%20Line
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm