The dyad {&.> has ranks 0 0 .
In   (<tgrade x) {&.> x   the left argument
has rank 0 and so would agree with x .
Moreover, for atom i the computation is
< (><tgrade x) { > i{x   which is correct.

In   (tgrade x) {&.> x    the left argument
has shape ,n and the right argument has shape ,c,
where n is the number of records in a column of x .
A length error is signalled if n~:c .  Moreover,
even if n happens to be equal to c, the computation
for atom i is   < (>i{tgrade x) { >i{x  which is
not the right thing to do.

In the monad   (tgrade x)&{&.> x  the computation 
for atom i is   < (tgrade x)&{ >i{x , equivalent
to    < (tgrade x) { >i{x , which is correct.



----- Original Message -----
From: bill lam 
Date: Thursday, July 19, 2007 7:17
Subject: Re: [Jprogramming] multi column sorting
To: Programming forum 

> thank you for pointer, a related question from that page
> 
> why this work
>    (<tgrade x) {&.> x
> but this will give length error
>    (tgrade x) {&.> x
> 
> I usually use the pattern (tgrade x)&{&.> x
> 
> Sherlock, Ric wrote:
> > Have you checked Roger's Inverted Tables on the wiki? There's 
> a section
> > there on grading & sorting.
> > http://www.jsoftware.com/jwiki/Essays/Inverted_Table 


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to