Understanding infix method call and cons operator(::) in Scala
I'm quite new to Scala programming language, and was trying something out stucked in my mind while I was following the lecture notes at here . I think I couldn't really understand how cons operator works, here are some things I tried: I've created a pseudo-random number generator, then tried to create a list of one random value: scala> val gen = new java.util.Random gen: java.util.Random = java.util.Random@1b27332 scala> gen nextInt 3 :: Nil <console>:7: error: type mismatch; found : List[Int] required: Int gen nextInt 3 :: Nil ^ But it tried to pass List(3) to nextnt method. When i used