I\'m learning Scala at the moment (Programming Scala, 2nd Edition, Odersky).
When building a list using the cons operator we have to write:
val l = 1
In concept, a List in Scala is either
::
is to create a new list with a head element and a tail list. And it is right associative.
So
1 :: 2 :: 3 :: 4 :: Nil
will be compiled as
1 :: (2 :: (3 :: (4 :: Nil)))
Starting from the right, the first list is constructed with 4 and Nil, making a new list [4]. Then adding 3 as the head of the tail list [4], making a new list [3, 4]. And so on...
To answer your question, Scala needs an empty list to construct the 1st list. Cause that's how the list is defined in Scala.