[Jprogramming] Re: Rank and Sort on a Specific Column
R.E. Boss
r.e.boss at planet.nl
Mon May 8 21:29:33 HKT 2006
One sort suffices, than index in nub of the sorted items.
R.E. Boss
-----Oorspronkelijk bericht-----
Van: programming-bounces at jsoftware.com
[mailto:programming-bounces at jsoftware.com] 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
More information about the Programming
mailing list