Can I call a function that has a number of arguments specified at runtime?
I would have thought it possible with currying. But this doesn’t compile:
Can I call a function that has a number of arguments specified at runtime?
I would have thought it possible with currying. But this doesn’t compile:
Ah, but if I write f in curried form I should not need apply:
let f = a => (b => (c => (d => (e => a+b+c+d+e))))
Can I use reduce with that?
What type is the apply
function supposed to return?
It’s not compiling because the branches of this conditional return different types. a2(lst[2])
is int
and a2
is int => int
if n > 2 {
a2(lst[2])
} else {
a2
}