Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- triple x = 3 * x
- sgn x | x > 0 = 1
- | x < 0 = -1
- | otherwise = 0
- nor :: Bool -> Bool -> Bool
- nor False False = True
- nor _ _ = False
- nand :: Bool -> Bool -> Bool
- nand True True = False
- nand _ _ = True
- fib 0 = 0
- fib 1 = 1
- fib n = fib (n - 1) + fib (n - 2)
- fib' n = fib'' 0 1 n
- where fib'' a _ 0 = a
- fib'' a b n = fib'' b (a+b) (n-1)
- fac' _ 0 = 1
- fac' f n = n * f (n - 1)
- fac = fix fac'
- sumsq = on (+) (^2)
Add Comment
Please, Sign In to add comment