I'm pretty new to Scala and I want to add a function to a list. I have the following:
var l2: List[() => Unit] = List() def foo() { println("In foo") } And now I want to add a method to the list.
() => println("x") :: l2 It compiles but it doesn't work at runtime.
Next question: Why doesn't the following compile?
l2 = foo :: l2 Thanks.
l2 = (foo) :: l2compile?