The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

lembark (6) [Avatar] Offline
#1
Q: If "::" is normally called "cons", what is "tens"?


scala> val listB = 40 :: tens
listB: List[Int] = List(40, 10, 20, 30)

The :: is a function that adds an element to
the front of the list, and returns a new list.
In FP languages it commonly called ‘cons’.
aslam.khan (50) [Avatar] Offline
#2
Re: Not sure what "tens" indicates on p. 46
It's a typo, as noted in another thread. It should be

[pre]
val listB = 40 :: listA
[/pre]