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 integer…


On Monday, November 6, 2017 at 12:23:21 PM UTC, David Andrews wrote:
>
> 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 <[email protected] <javascript:>
> > wrote:
>
>> 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 dynamically typed languages that don't care about the 
>> number of arguments, and is easy to do in statically typed languages which 
>> allow overloading. But what about the ML-like languages?
>>
>> The only ML-like language with a solution is Haskell. Its author says 
>> "Forcing 
>> Haskell's strict type system to allow this requires some magic, namely, 
>> enabling the GHC extension for flexible typeclass instances."
>>
>> Is this problem impossible in Elm?
>>
>> If impossibie, can a solution be found to a related problem, say where 
>> the arguments are lists?, e.g.
>>
>>     f [] = 0
>>     f [3] [9] [2] [] = 14
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Elm Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to