Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

These operators such as ++ (concatenation) etc are uniformly available in all collections. It has inherited these operators from base sequence classes/traits specifically TraversableLike.

http://www.scala-lang.org/api/rc/scala/collection/Traversabl...

If you write a fancy skiplist and add a TraversableLike trait you will get these operators and the associated methods for free!

Check the source code for NodeSeq. https://lampsvn.epfl.ch/trac/scala/browser/scala/tags/R_2_9_...

It does not implement any of these operators. It just inherits some features extends immutable.Seq[Node] with SeqLike[Node, NodeSeq] with Equality

provides an equality operator and a builder and gets all the other collection operators for free. These operators have the same semantics and implementation across all collection classes unless you specifically override them.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: