News for hackers. Stuff that matters.
Re:Scala Feels like EJB 2 by pivo on Tuesday November 22, 2011 @03:59PM (#3267336)
The :: is Scala's cons operator, the Nil means end-of-list. It's actually much more common in Scala to create a list like so:

  val nn = List("Jim","Bob")
This creates the same list that the example using :: did. It doesn't need to be explicitly terminated with Nil.
Re:Scala Feels like EJB 2 by _Y_ on Tuesday November 22, 2011 @04:45PM (#3267523)
What does cons operator mean? Concatenation? Constructor? Other than hello world I haven't done much Scala.
Re:Scala Feels like EJB 2 by tvorryn on Tuesday November 22, 2011 @05:57PM (#3267823)
Cons is short for construct and comes from Lisp which has weird names for things; things like car and cdr.

It means construct a new list.

A cons A (or A :: B) means create a new list with A before B, where B can be a list item or a list itself and A is a list item.

The :: operator is right associative so "Jim" :: "Bob" :: Nil actually works like ("Jim" :: ("Bob" :: Nil) ) (Actually all operators that end in : are right associative in Scala.)

For more see: http://en.wikipedia.org/wiki/Cons