That said, maybe the README does lack a bit of introductory text, especially if their targeted audience is programmers in general.
This is standard syntax in functional languages. A->B is a function from A to B. A->B->C is a function from A that returns a function B->C. This is the standard curried function application, like used in OCaml, and it enables you to easily partially apply and compose functions.
addCandidate's type is indeed Int->Int->Int, it's simply not declared that way. In OCaml, the following two syntaxes are equivalent:
let addCandidate = fun A:Int B:Int -> ...body...
let addCandidate A:Int B:Int = ...body...
I imagine this language is similar.There are two reasons for there not being explanations in the README:
1. I foolishly thought it would be obvious.
2. I wanted to focus on the implementation, not the language itself.
In any case, I've added them now, thanks.
A nice thing with Elixir is that it lures OO developers like me into the realm of functional languages with a familiar syntax. Int -> Int is not familiar to me. I could guess what it is but then I also see an Int, Int and feel a little puzzled. If one of the goals of this language is to "convert" OO developers maybe you should consider a syntax they are fully familiar with. You could make long time functional developers feel not at home though. Maybe it's a trade-off that's impossible to avoid. It's your call.
I can imagine that this
means that addCandidate has two arguments of type Int, but what does the ~ mean? I'll have to read the docs.However I have really no idea of the meaning of
It's a function bar taking arithFn as argument, which is a function with... what arguments?From the demo program it looks like a function with two int arguments returning an int, but why the -> signs and why isn't addCandidate defined as (Int -> Int -> Int) too? Where is it's return type. Maybe inferred?
It's quite puzzling and there are no explanations about that in the README.
Is the ~ necessary? Could it be removed and save one character that's not even on some keyboards around the world?
Apart from that lack of explanations, it could a perfectly nice language and it's a great project for sure.