[Haskell-cafe] Sorting Integers

Donald Bruce Stewart dons at cse.unsw.edu.au
Mon Feb 13 06:37:04 EST 2006


jamie.edwards:
> 
> I have 3 integers, a b c that I want to pass to a function, and I want the
> function to return the 3 integers sorted, from largest to smallest - any
> idea how to do this?

    Prelude> let sort3 x y z = List.sort [x,y,z]
    Prelude> sort3 8 2 0
    [0,2,8]

Cheers,
   Don


More information about the Haskell-Cafe mailing list