Filter function

The filter function is implemented similarly to map. However, there are some differences, which are given as follows:

        filter f (x:xs)
| f x = x : filter f xs
| otherwise = filter f xs
We have used the library function odd to test whether a number is odd. Also, notice the use of let in the do block. In the do block, let is used to bind identifiers to value. This let function is different from the let..in block.