Note: This is a group activity - a Haskell-version Chinese Whispers. The first person will write the FUNCTION (in Haskell), the next will write a DESCRIPTION (in English), etc. (Haskell, English, Haskell, …). Don’t worry about specifics - just use the data definition or syntax you are most familiar with, this is supposed to be fun

When writing a function, call it foo or bar so that it isn’t obvious!

Pick one of the following problems (don’t tell anyone your choice!) and begin the cycle by writing it in Haskell to the best of your ability! (You’ve probably seen all these functions before, many are Prelude functions)

Polymorphism themed Qs:

  1. Finds the first element of any list
  2. Returns the number of elements in any list
  3. Reverses the elements of any list
  4. Takes two functions and combines them into a single composite function
  5. Takes a list and a predicate (true/false condition), and returns the elements of the list where the predicate is satisfied
  6. Checks if a number of the typeclass integral is even or odd
  7. Adds all elements of a list (assuming (Num a) => a)
  8. Takes two numbers, adds them together, multiples by 75, and divides by the first number (how general can you make the type?)
  9. Applies a function over all elements in a list
  10. Inserts a value into any list given a particular index
  11. Combines two lists without using (++)
  12. Takes 3 numbers and calculates the Pythagoras theorem