KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to understand the implementation of List s in Scala. In particular I'm trying to get my head around how you can write match expressions using an infix operator, for example: a match { case Nil => "An empty list" case x :: Nil => "A list without a tail" case x :: xs => "A list with a tail" } How is the match expression allowed to be x :: xs rather than List(x, xs) ?
Tags (comma-separated)
Save Edits
Cancel