2021年1月5日星期二

How Scala cons `::` operator notation works under the hood?

How does the following notation works in scala:

1 :: List(2, 3) = List(2, 3).::(1) = List(1, 2, 3)  

Is 1 :: List(2, 3) an infix notation ? what makes it that we can write :: in some sort of infix notation ??

I would think that the infix would be List() :: 1

am I missing something or is it some special case ?

https://stackoverflow.com/questions/65590048/how-scala-cons-operator-notation-works-under-the-hood January 06, 2021 at 12:05PM

没有评论:

发表评论