3 ms·
Scala used + for an element and ++ for another collection scala> 1 +: List(2, 3) ++: List(4, 5) :+ 6 res0: List[Int] = List(1, 2, 3, 4, 5, 6) where +: is
by erik_seaberg 6y ago
Scala used + for an element and ++ for another collection
scala> 1 +: List(2, 3) ++: List(4, 5) :+ 6
res0: List[Int] = List(1, 2, 3, 4, 5, 6)
where +: is right-associative and implemented by the list rather than the element.