I’m pretty certain you can’t do this in elm. The ellie is for f [] and f
[3,9,2] whereas the question is for f [] and f [3] [9] [2] []
In the latter example, you need f [] to return an integer and f [3] to
return a function that takes two lists of integers and a list of any type
and returns an
It's not quite what you asked for, but Kris Jenkins' Formatting[0] library
does some interesting stuff with variadic functions. In that library, the
`print` function's arity depends on the value of its first argument.
Here's the idea applied to this problem (code lifted straight from the
Formattin
I like the calls and resolves! Nice.
On Monday, November 6, 2017 at 8:45:48 PM UTC-8, David Andrews wrote:
>
> Sorry I misread your example as a single list argument.
>
> Strictly speaking, you can not call a function with no arguments in Elm,
> but some functions take Unit as an argument.
>
> Th
Sorry I misread your example as a single list argument.
Strictly speaking, you can not call a function with no arguments in Elm,
but some functions take Unit as an argument.
There are a couple of roadblocks preventing this exact functionality in
Elm. Firstly, Elm does not allow recursive types
<
Thanks but I was looking not for the obvious, practical approach for
summing integers but was interested in the puzzle of arbitrary-length
currying. When called with no arguments, the function should yield its sum
so far. When called with a single argument, the function should return a
function
The solution for the list version is very straightforward in elm:
https://ellie-app.com/g4DpfMDxPa1/0
On Sun, Nov 5, 2017 at 10:39 PM, Ray Toal wrote:
> There's an interesting problem on the Programming Puzzles and Stack
> Exchange on arbitrary length currying here: https://codegolf.
> stackexch
There's an interesting problem on the Programming Puzzles and Stack
Exchange on arbitrary length currying
here:
https://codegolf.stackexchange.com/questions/117017/arbitrary-length-currying.
It asks for a function f behaving as follows:
f () = 0
f (3)(9)(2)() = 14
This is trivial in d