> For boxed arguments, that's a bit more difficult, but I
> could use numbers that sort the same way, for example
> perhaps something like /:^:2"1&.|:  (That would work for
> a 2 dimensional array, but is probably not quite right for
> higher dimensions.)

/:^:2 does not handle ties correctly, but the
following would:
   ranking=: i.!.0~ { /:@/:
More efficient would be to use /: or \: on each
column depending on whether the sort is up or down. 
See http://www.jsoftware.com/jwiki/Essays/Inverted_Table#grade_and_sort




----- Original Message -----
From: Raul Miller <[EMAIL PROTECTED]>
Date: Thursday, May 17, 2007 2:52 pm
Subject: Re: [Jprogramming] Multi sort

> On 5/17/07, Roger Hui <[EMAIL PROTECTED]> wrote:
> > What if the argument is not numeric?
> 
> I would use numeric placeholders.
> 
> For character arguments, that's fairly simple -- I could
> use a.i.]
> 
> For boxed arguments, that's a bit more difficult, but I
> could use numbers that sort the same way, for example
> perhaps something like /:^:2"1&.|:  (That would work for
> a 2 dimensional array, but is probably not quite right for
> higher dimensions.)
> 
> Hypothetically speaking, the boxed mechanism would
> also work for character args (though not so fast).
> 
> And, if I wanted something fully general, I guess I'd have to
> make myself a verb which distinguishes these types to
> control an agenda.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to