Function to add to Data.List

Andreas Abel andreas.abel at ifi.lmu.de
Sun Apr 6 07:41:57 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

+1

On 05.04.2014 23:53, John Wiegley wrote:
> I heard a talk that mentioned this transform today at Hac NYC, and
> was surprised it wasn't already in Data.List:
> 
> -- | Sort a list using a key on each element.  This implements the 
> --   decorate-sort-undecorate paradigm, also called a Schwarzian
> transform. sortByKey :: Ord b => (a -> b) -> [a] -> [a] sortByKey f
> = map snd . sortBy (comparing fst) . map (\x -> (f x, x))
> 
> I would like to propose adding it.
> 
> John _______________________________________________ Libraries
> mailing list Libraries at haskell.org 
> http://www.haskell.org/mailman/listinfo/libraries
> 


- -- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Department of Computer Science and Engineering
Chalmers and Gothenburg University, Sweden

andreas.abel at gu.se
http://www2.tcs.ifi.lmu.de/~abel/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlNBBUUACgkQPMHaDxpUpLOqPgCffZM+OVZjGR59UoRJGHKJGNDP
SKwAniDCMgEVOmk4ILOV2GOnKmVOU5VB
=jUNT
-----END PGP SIGNATURE-----


More information about the Libraries mailing list