-- safe tail, with conditional expression. awkward....
safetailCond :: [a] -> [a]
safetailCond xs = if length xs == 0 then [] else drop 1 xs

-- safe tail with guards. a bit better....
safeTailGuards :: [a] -> [a]
safeTailGuards xs | length xs == 0	= []
		  | otherwise		= drop 1 xs

-- safe tail with patterns -- now we're talking
safeTailPattern :: [a] -> [a]
safeTailPattern [] = []
safeTailPattern (x:xs) = xs

-- my or, as I would do it
myOr :: Bool -> Bool -> Bool
myOr True = \_ -> True
myOr False = \x -> x

-- antoher version, no lambdas
myOrAgain :: Bool -> Bool -> Bool
myOrAgain True _ = True
myOrAgain False x = x

-- really dumbed down version, still better than putting down all cases.
myOrDumb :: Bool -> Bool -> Bool
myOrDumb False False = False
myOrDumb _ _ = True

-- redifining and with conditionals
myAnd :: Bool -> Bool -> Bool
myAnd x = \y -> if x then y else False

-- redefining and with conditionals, a slighty different version
myAndAgain :: Bool -> Bool -> Bool
myAndAgain x = \y -> if x && y then True else False

-- a function halve, which halves a list, using library functions
halve :: [a] -> ([a],[a])
halve xs = splitAt ((length xs) `div` 2) xs

-- mult of 3 arguments with lambdas
mult :: Num a => a -> a -> a -> a
mult x = \y -> \z -> x*y*z
