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

Remember to use a generic function name so you don’t give it away e.g. foo, bar

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)

  1. Finds the first element of any list
  2. Puts the elements of a list into another list
  3. Counts the elements in a list
  4. Takes 3 numbers and calculates the Pythagoras theorem
  5. Finds the last element of any list
  6. Reverses the elements of a list
  7. Checks if a list is a set (no duplicates)
  8. Define a record type of your choice
  9. Finds the number of elements of any list
  10. Inserts an element into a list given an index (remember counting starts from 0)
  11. Removes duplicates in a list
  12. Inserts a value into a list given a particular index
  13. Finds if a number is even or odd
  14. Takes a list and a predicate, and returns the elements of the list where the predicate is satisfied
  15. Takes two functions and combines them into a single composite function
  16. Checks if a list is an ordered set (no duplicates, assumes (Num a) => a with all elements in order from increasing to decreasing)
  17. Adds all elements of a list (assuming (Num a) => a)
  18. Write the filter higher-order function
  19. Takes two numbers, adds them together, multiples by 75, and divides by the first number
  20. Applies a function over all elements in a list