Why (copy) appending to Seq in Scala is defined as :+ and not just + as in Set and Map?
scala, scala-collections
Solution
Map and Set has no concept of prepending (`+:`) or appending (`:+`), since they are not ordered. To specify which one (appending or prepending) you use, `:` was added.
scala> Seq(1,2,3):+4
res0: Seq[Int] = List(1, 2, 3, 4)
scala> 1+:Seq(2,3,4)
res1: Seq[Int] = List(1, 2, 3, 4)
Don't get confused by the order of arguments, in scala if method ends with : it get's applied in reverse order (not a.method(b) but b.method(a))
Problem
Scala's Map and Set define a `+` operator that returns a copy of the data structure with a single element appended to it. The equivalent operator for `Seq` is denoted `:+`. Is there any reason for this inconsistency?