did #6 in haskell
did #56 in haskell