main_marking4/knight1_test4.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Thu, 10 Nov 2022 19:41:04 +0000
changeset 442 c86e7dd198bf
parent 424 daf561a83ba6
child 463 0315d9983cd0
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
424
Christian Urban <christian.urban@kcl.ac.uk>
parents: 391
diff changeset
     1
import M4a._
391
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)