[erlang-questions] Idiom for multiple case matches
Ulf Wiger (TN/EAB)
ulf.wiger@REDACTED
Mon Nov 10 19:29:50 CET 2008
So try it with the absolutely wonderful and indispensable
parse transform utility ct_expand. ;-)
http://forum.trapexit.org/viewtopic.php?p=20260#20260
BR,
Ulf W
David Mercer skrev:
> For completeness, I did run some benchmarking. I hesitate to put my name to
> my solution, since it was suggested in jest, but I am vindicated because it
> performed as expected:
>
> 1,000,000 Iterations:
> Virding: Run-Time/Wall-Clock: 94/94 milliseconds
> Cronqvist: Run-Time/Wall-Clock: 141/141 milliseconds
> Mercer: Run-Time/Wall-Clock: 14547/14547 milliseconds
>
> Cheers,
>
> David
>
>> -----Original Message-----
>> From: David Mercer [mailto:dmercer@REDACTED]
>> Sent: Monday, November 10, 2008 11:05
>> To: 'mats cronqvist'; 'Michael Radford'
>> Cc: 'Hynek Vychodil'; 'Erlang Questions'
>> Subject: RE: [erlang-questions] Idiom for multiple case matches
>>
>> Since this is, semantically, a set operation, should we not perhaps use
>> sets:is_element/2 instead? Something like:
>>
>> vowels() -> sets:from_list("aeiou").
>> is_vowel(C) -> sets:is_element(C, vowels()).
>>
>> Just kidding, of course... (Obvious efficiency issues.) :-)
>>
>> DBM
>>
>> P.S. No, Mats, I did not benchmark this. :-)
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list