{- Equational reasoning: sum [1..5] == expand .. sum [1,2,3,4,5] == expand sum 1 + 2 + 3 + 4 + 5 == def of + 15 -} {- Wrong version: N = a ’div’ length xs where a = 10 xs = [1,2,3,4,5] -} n = a `div` length xs where a = 10 xs = [1,2,3,4,5] -- Define the function last using the combinators introduced in the lecture last' xs = head (reverse xs) last'' xs = head (drop (length xs - 1) xs) last''' xs = xs !! (length xs - 1) -- All other interactive examples are covered in the slides!