Activity1v2
Activity1v2
This is an ungraded activity. We will go over the solutions in class. Solutions will not be posted online.
Name your file Act1Functions.hs with the first line:
ghc act1Verifier.hs
act1Verifier
1. Write a Haskell function called “range” that produces a consecutive list of numbers that starts with
the number n given as an argument and ends at 1 [n…1] . You can assume that n ≥ 0. For example:
2. Write a Haskell function called “copies” that produces a list of n copies of a list of integers. You can
assume that n ≥ 0. For examples:
3. Write a Haskell function called “greaterList” that produces a list of of elements from a list (second
argument) that are greater than the first argument n. For example:
4. Write a Haskell function called “allSame” that returns True if the characters in a list (or String) are all
the same. If the characters differ or the list is empty the function evaluates to False.
5. Write a Haskell function called “minmax” that returns as a pair the minimum and maximum value
from a list of integers. Assume that the minimum and maximum of an empty list is (0,0). See the
examples below.