x = 2 add x = 1 + x and a b = if a ==b then a else False and2 True True = True and2 _ _ = False plus x y = x + y inc = plus 1 factorial 0 = 1 factorial n = n * factorial (n - 1) cnsum [] = 0 cnsum (x:xs) = x + cnsum xs first (x:xs) = x rest (x:xs) = xs cnfoldl f x [] = x cnfoldl f x (y:ys) = cnfoldl f (f x y) ys cnsum2 = cnfoldl plus 0 mulgeek a b = a * b geekmul = cnfoldl mulgeek 1 cnmap f [] = [] cnmap f (x:xs) = f x : cnmap f xs bind [] x = [] bind (f:fs) x = f x : bind fs x