[Haskell-beginners] Re: [Haskell-cafe] Re: permuting a list

Felipe Lessa felipe.lessa at gmail.com
Sun Feb 15 07:23:57 EST 2009

On Sun, Feb 15, 2009 at 9:47 AM, Heinrich Apfelmus
<apfelmus at quantentunnel.de> wrote:
> It's fair, but may duplicate elements, i.e. it doesn't necessarily
> create a permutation. For example,  rs  could be something like
>   rs = [5,3,3,3,2,4]

But our sort doesn't discard values when the keys are the same. For example,

[1,2,3,4] == map snd . sortBy (compare `on` fst) . zip (repeat 1) $ [1,2,3,4]

Nothing gets duplicated. Or did I miss something?


More information about the Beginners mailing list