Slide 45
Slide 45 text
assert( concatenate(List(1,2,3))(List(4,5)) == List(1,2,3,4,5) )
assert( concat(List(List(1,2), List(3), List(4,5))) == List(1,2,3,4,5) )
assert( reverse(List(1,2,3,4,5)) == List(5,4,3,2,1) )
assert( length(List(0,1,2,3,4,5)) == 6 )
assert( sum(List(2,3,4)) == 9 )
val mult: Int => Int => Int = a => b => a * b
assert( map(mult(10))(List(1,2,3)) == List(10,20,30))
Here a some sample tests for the
Scala functions on the previous slide.