Sample.hs
import Prelude hiding(max) max :: Int -> Int -> Int max x y = if (x >= y) then x else y getMaximum :: Int -> Int -> Int -> Int getMaximum x y z = (x `max` y) `max` z
*Main> :load Sample.hs [1 of 1] Compiling Main ( Sample.hs, interpreted ) Ok, modules loaded: Main. *Main> *Main> getMaximum 10 20 30 30 *Main> getMaximum 10 30 20 30 *Main> getMaximum 30 20 10 30 *Main> getMaximum 30 30 40 40 *Main> getMaximum 30 30 30 30
No comments:
Post a Comment