In this assignment you will continue learning the basics of Haskell by writing a lot of simple functions.
Read the first four chapters of the Gentle Introduction to Haskell if you haven't already.
For this week, you will be solving a number of simple problems by writing
a bunch of simple functions in a file called lab2.hs
. We've
provided a template for your code in this file. What
you have to do is to fill in the function definitions marked "TODO". In each
case, we supply the type signature of the function which your code has to
adhere to.
Here are the problems you have to solve:
foldl
.foldr
.foldr
. The resulting list's
elements should be in the same order as the original lists i.e. this
function should have the same semantics as the "++
"
operator.map2
that works on two lists. This is
trivially done using the zipWith
function, so don't use
that.map2
.Your program lab2.hs
.