[Haskell-cafe] MultiCase alternative
Richard A. O'Keefe
ok at cs.otago.ac.nz
Tue Jun 20 01:38:39 UTC 2017
> On 19/06/2017, at 9:28 PM, Oleg <oleg at okmij.org> wrote:
>
>
> Richard A. O'Keefe wrote:
>
>> Let Pi be the pattern (i,_) | (_,i)
>> In SML,
>> fun f P1 ... Pn (0,0) = true
>> | f _ ... _ _ = false
>>
>> fun g () = f (1,1) (2,2) ... (n,n) (1,1)
>>> (So far it has taken 3 minutes on a fast machine to not
>>> finish compiling these 3 lines of code... I fear the worst.)
>
> I can't speak for SML, but I was curious to try your example in OCaml,
> which also supports OR patterns.
My test case went up to ((20,_)|(_,20)).
Your example goes up only to ((8,_)|(0,8)).
Your version worked fast in F#.
I'm currently trying a full scale example.
F# ground away for a couple of minutes and
then ran out of memory.
ocamlc compiled it too fast to measure accurately.
More information about the Haskell-Cafe
mailing list