-- well, making choices really -- when writing programs we need to make choices, there are -- 3 key ways to do this, the first is pattern matching -- first we define a function function1 :: Int->Int function1 5 = 7 function1 7 = 2 function1 1 = 0 function1 x = x*2 -- this is evaluated in sequence, if the input is 5, then the -- output is 7, if 7 then 2, if 1 then 0, otherwise input*2 -- another key feature is the idea of the wildcard, that is -- parameters we do not care the value of in the pattern match, -- often used as the last value, as the wildcard matches anything function2 :: Int->Int function2 4 = 2 function2 1 = 9 function2 _ = 0 -- This also works fine with more than one paramters function3 :: Int->Int->Int function3 5 x = x+2 -- so if the first parameter is 5, then... function3 y 6 = y function3 _ _ = 0 -- the other option that are used for more sophisticated forking -- is the "guard" function4 :: Int->Int function4 x | x == 5 = 2 | (x*3) == 8 = 1 | y = 0 = 5 | otherwise = 92 where y = mod x 2 -- finally for very very simple forks we have an if function5 :: Int->Int function5 x = if x == 7 then 4 else 2