author | Christian Urban <christian.urban@kcl.ac.uk> |
Mon, 08 Nov 2021 01:03:09 +0000 | |
changeset 401 | 9471c3b7ea02 |
parent 391 | 0930e4555b60 |
child 424 | daf561a83ba6 |
permissions | -rw-r--r-- |
391
0930e4555b60
added main4 marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1 |
import CW9a._ |
0930e4555b60
added main4 marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2 |
|
0930e4555b60
added main4 marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
3 |
|
0930e4555b60
added main4 marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
4 |
val f_urban = (x:(Int, Int)) => if (x._1 > 3) Some(List(x)) else None |
0930e4555b60
added main4 marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
5 |
|
0930e4555b60
added main4 marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
6 |
assert(first(List((1,0),(2,0),(3,0),(4,0)), f_urban) == Some(List((4,0)))) |
0930e4555b60
added main4 marking
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
assert(first(List((1,0),(2,0),(3,0)), f_urban) == None) |