haskell sorting
- by snorlaks
Hello,
How can it be done in most simply way to write (or maybe there is something embedded in haskell) function which takse as arguments list of tuples (String, Int) and Int x and return top x tuples as list according to x value.
I wonder if its possible to write a function which also takes 3 argument which is the name of (or index) of filed in tuple according to which sorting has to be done.
What are best solutions to make it quite generic, Im new to haskell I would do somethink like that in imperative languages without any problems but I want to know how to write it in quite good way in haskell,
thanks for help