1 2 3 4 5 6 7
applyN :: (a -> a) -> a -> Int -> a applyN f arg count | count == 1 = f arg | count > 1 = f (applyN f arg (pred count)) | otherwise = error "Ugh? What did you expect by executing a command less or equal to 0 times? ;)"