Edit this page Backlinks This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== L07. For expressions ====== In this lab, we will use matrices to encode Bitmap images. The format is called BPM, and more details are available [[https://en.wikipedia.org/wiki/Netpbm#File_formats|here]]. Our format will be grayscale only. Each pixel of the matrix is encoded as an integer, with values from 0 to 255. Some examples are shown below: <code> 0 0 1 0 0 0 1 0 1 0 0 1 1 1 0 letter A 1 0 0 0 1 1 0 0 0 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 shader 5 4 3 2 1 5 4 3 2 1 </code> Add the following type definition for the rest of your lab: <code scala> type Img = List[List[Int]] </code> Also, in order to benefit from visualisation, instead of using a worksheet, you can create a new Scala project, containing an object with a main method: <code scala> object Matrix { // define your functions here def main(args: Array[String]) = { // write your tests here } } </code> **7.1.** Write a function