When you come across Julia, and know (a bit of) Haskell, comparisons are
inevitable. Haskell has only functions with one argument, but the function
value may be another function. It takes some time to wrap your brain around
that idea, but hey, it works.
Another type of functions with just one argument, possibly a tuple, may
work as well, I guess, and that seemed to be the choice for Julia:
uncurried.
So let's define a function taking a pair: f=(x,y)->x*y, and define a pair:
p=(2,3), and feed it to our function: f(p)
ERROR: wrong number of arguments
Oops...
Suppose we have an array, sqr=[i^2 for i=1:5], and want to filter it, but
depending on the index, too. There's a function for that, enumerate. Let's
assume we want only those values where the index plus value (square) isn't
divisible by 4. Check enumerate: [e for e in enumerate(sqr)]:
5-element Array{(Int64,Any),1}:
(1,1)
(2,4)
(3,9)
(4,16)
(5,25)
Ok, those are pairs, so let's filter:
filter((x,y)->(x+y)%4!=0,[e for e in enumerate(sqr)])
You guessed it, same "oops" as above.
Well, you can work around that mess, naturally, but looking at the
candidates...
filter(p->(p[1]+p[2])%4!=0,[e for e in enumerate(sqr)])
filter(p->(first(p)+last(p))%4!=0,[e for e in enumerate(sqr)])
filter(p->((x,y)->(x+y)%4!=0)(p...),[e for e in enumerate(sqr)])
All of them work, but what would be your favorite obfuscation of a simple
thought? The last example suggests that the whole mess may be collateral
damage from supporting varargs, but... is it worth that?
Don't get me wrong, I like Julia, there's a lot of nice and powerful
concepts, like multipe dispatch, but why does she have to have those warts
right on her nose? ;-)