I'm working my way through the Coursera course on functional programming in Scala and have encountered behavior that appears to differ from the language's description. According to the lecture on pattern matching, the output of the second println statement should be false rather than true in the following Scala spreadsheet:
object MatchTest {
  def test(char: Char, list: List[Char]): Boolean = list match {
    case char :: tail => true
    case _            => false
  }                                               //> test: (char: Char, list: List[Char])Boolean
  println(test('a', "ab".toList))                 //> true
  println(test('b', "ab".toList))                 //> true
}
Why does the second test match on char :: tail and not match on _?
 
     
    