If a function literal consists of one statement that takes a single argument, you need not explicitly name and specify the argument. Thus, the following code also works:
List has a method named ‘:::’ for list concatenation.
1
2
3
4
5
valoneTwo=List(1,2)valthreeFour=List(3,4)valoneTwoThreeFour=oneTwo:::threeFourprintln(""+oneTwo+" and "+threeFour+" were not mutated.")println("Thus, "+oneTwoThreeFour+" is a new list.")
Adding elem to the beginning
List has a method ‘::’ named ‘cons’. It adds element to the beginning of the list.