main_marking4/knight1_test4.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Sun, 31 Jan 2021 00:18:14 +0000
changeset 391 0930e4555b60
child 424 daf561a83ba6
permissions -rw-r--r--
added main4 marking
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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)