Well, admittedly,
table =. ,. each <"1 & |: i. 4 3
(>,.&.>/table) ; |:;"2 table NB. The results look the same
+-------+-------+
|0 1 2|0 1 2|
|3 4 5|3 4 5|
|6 7 8|6 7 8|
|9 10 11|9 10 11|
+-------+-------+
(>,.&.>/table) -: |:;"2 table NB. but aren't
0
$|:;"2 table NB. because
4 3
$>,.&.>/table
1 1 4 3
In my experience, extra, singleton axes are as much a
nuisance as anything else.
Of course, maybe they are present in the original array for a reason
and need to be retained?
$table
3 1 1
On 3/30/07, Dan Bron <[EMAIL PROTECTED]> wrote:
RM = Raul Miller, DM = Devon McCormick
RM> Personally, I would phrase that as
RM> >,.&.>/table
DM>I think
DM> |:;"2 table
Tsk. That's like recommending a book you haven't read. Try running that
line...
By the way, Leigh, if you promise that table is a vector of at least two
boxes, then you can shorten your verb a bit:
,.&:>/ table
But the general case is much nicer with >@:(,.&.>/) which is faster and
leaner anyway.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm