martin odersky | 5 Jan 10:14 2008

Re: Blog: My verdict on the Scala language

On Jan 4, 2008 8:21 PM, Jamie Webb <j <at>> wrote:
> On 2008-01-04 10:48:23 Ian Clarke wrote:
> > I'm not sure I agree, I think the problem is the use of the '/:'
> > method, because it really has no inherent meaning, and unless you
> > already know what it means (I sure didn't), how do you even begin to
> > figure it out?
> I agree. I have no idea why that operator has been included (given
> that it's just an alias for a named method), and I've complained about
> it before.

That was my fault. I included it because I liked it, and that for two reasons:

1. (z /: xs) (op) looks like an abbreviation of a left leaning tree
with a `z' on the lower left end (at least to me). I.e. something like

     /    \
   op    x1
  /  \
 z   x0

That's the tree I always draw when I explain fold left.

2. (z /: xs) has the operands in the ``right'' order.

Generally, I also think folds are beyond the comfort threshold of most
people (me included). I won't be cross with anyone who replaces them
with accumulating loops in his or her code.


 -- Martin