Scala: How can I create a function that allows me to use dot notation when calling it?
问题 I have been confused about this for a while, even despite reading the Scala Style Guide - Method Invocation several times. I want to be able to call this method def foldRVL[A,B](l: List[A], z: B)(f: (A, B) => B) = //"Right-Via-Left" l.reverse.foldLeft(z)((a, b) => f(b, a)) using dot notation like this List(1,2,3).foldRVL(0)(_ + _) . And not like this: foldRVL(List(1,2,3), 0)(_ + _) . Also, sometimes I've seen code that shows methods that actually either takes zero parameters in their