Talk:Top rank per group

From Rosetta Code

Task Description is just about missing

What does the task require one to do? What group? What do you mean by ranker? --Paddy3118 12:46, 5 December 2008 (UTC)

It looks like the SMMEQL example was the original, definitive example on the page, so a new task description should be written with that as a basis. I'll get to it tomorrow on my lunch break, if nobody beats me to it. --Short Circuit 07:41, 10 February 2009 (UTC)

I just changed the task description to show "department" instead of "group" because I thought it was unclear originally. I was going to explain it in my edit comment, but I tapped enter by accident when putting in a quote mark. --Mwn3d 20:57, 25 March 2010 (UTC)

J

The task description does not seem to qualify the output if the sorted values within one department were as follows:

9 8 8 7 7 7 7 7 6 6 6 5 5 4

--TBH 05:22, 4 December 2008 (UTC)

I'm going to be away the next couple weeks, but here's an approach in J.
Using the following input:
   Employees=: (<;.1~ (#{.,~@:1:);+./@:(;: E.S:0 ])@:{.) ];._2 noun define
EMP_NAME        EMP_ID HIRE_DATE SALARY DEPT EXEMPT INTERESTS 
Tyler Bennett   E10297 19770601  32000  D101 Y                
John Rappl      E21437 19870715  47000  D050 Y               1
George Woltman  E00127 19820807  53500  D101 Y               2
Adam Smith      E63535 19880115  18000  D202 N                
Claire Buckman  E39876 19851123  27800  D202 Y                
David McClellan E04242 19820727  41500  D101 Y               3
Rich Holcomb    E01234 19830601  49500  D202 Y                
Nathan Adams    E41298 19880215  21900  D050 N                
Richard Potter  E43128 19860412  15900  D101 N                
David Motsinger E27002 19850505  19250  D202 N                
Tim Sampair     E03033 19871202  27000  D101 Y                
Kim Arlich      E10001 19850730  57000  D190 Y                
Timothy Grove   E16398 19850121  29900  D190 Y                
)
The top earners in each dept are:
   ('`',,;:^:_1:N=:{.Employees)  =: , (_&{"1)`'' ([^:(_ -: ])L:0)"0 _~ i.# E=:{:Employees
   N , (<@:>"1@:|:@:((6 <. #) {. ] \: SALARY)/.~ DEPT) |: <"1&> E
--DanBron 15:13, 4 December 2008 (UTC)