LGA-09: High Order Functions

Everyone should complete all of the required questions. You should not split this assignment between your group.

Required Questions

  1. Come up with a clever use of the $ function to share with your group.
  2. Using one of Haskell’s fold functions, implement a function minimum' which extracts the minimum element from a list. Your function should behave equivalently to Haskell’s builtin minimum function.
  3. Using one of Haskell’s fold functions, implement a function elem' which indicates whether a certain element is in a list. Your function should behave equivalently to Haskell’s builtin elem function.

Challenge Questions

These questions are not required, but fun to take a stab at if you have the extra time and want to play around.

  1. Using one of Haskell’s fold functions, implement a function reverse' which reverses a sequence of elements. Your function should behave equivalently to Haskell’s builtin reverse function. Hint: my solution makes clever use of the cons (:) function.
  2. Implement a function called zipWith' which behaves equivalently to Haskell’s builtin zipWith function using the map and zip functions.