I am looking at the Scala Stream API, and I noticed that Stream.cons is implemented as an embedded object. What advantage does this have for implementing it as a function? Under what circumstances should you consider using this technique?
Greetings.
source share