main_marking4/knight1_test4.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 08 Nov 2021 01:39:00 +0000
changeset 403 ffce7b61b446
parent 391 0930e4555b60
child 424 daf561a83ba6
permissions -rw-r--r--
updated
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)