haskell sorting
Posted
by snorlaks
on Stack Overflow
See other posts from Stack Overflow
or by snorlaks
Published on 2010-05-07T11:34:00Z
Indexed on
2010/05/07
11:38 UTC
Read the original article
Hit count: 196
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
© Stack Overflow or respective owner