One sort suffices, than index in nub of the sorted items. R.E. Boss
-----Oorspronkelijk bericht----- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Mike Day Verzonden: maandag 8 mei 2006 15:06 Aan: Programming forum Onderwerp: Re: [Jprogramming] Re: Rank and Sort on a Specific Column Not really an improvement, but the change in "r", and the idiom for "opent" (cf "line") might be of interest, and there are only two sorts. I don't think you can manage with fewer sorts! lastnum =: {:@".@;@{:@;:&.> NB. last number in each boxed row r =: ] i.~ [: \:~ ~. NB. rank (NB. sort applied _after_ nub) rankt=:,"0~ <@":@>:@r@:lastnum NB. get & prepend ranks to rows opent =: ;:^:_1"1 NB. better than line??? tta =: ((\:~@:opent @:rankt))@: (LF& cut) NB. do the lot Mike ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
