Implement a function,
that takes two numbers and return them in ascending order.
Sample.hs
type MinMax = (Integer, Integer) getMinMax :: Integer -> Integer -> MinMax getMinMax x y = if (x <= y) then (x, y) else (y, x)
Prelude> :load Sample.hs [1 of 1] Compiling Main ( Sample.hs, interpreted ) Ok, modules loaded: Main. *Main> *Main> getMinMax 10 20 (10,20) *Main> getMinMax 20 10 (10,20) *Main> getMinMax 10 10 (10,10) *Main>
No comments:
Post a Comment