Home › Forums › kdb+ › Challenge 3 The Runner-Up › Re: Challenge 3 The Runner-Up
-
q)list1:4 7 9 7 2 8 9 q)ru:@[;1] desc distinct:: /runner-up q)ru list1 8
Using general list notation (items separated by semicolons and embraced by parentheses) suggests a list is general; better to write a vector as a vector literal.
Composition
ru
is a sequence of three unaries. In evaluation order: select the distinct items; sort descending; select second item.