[erlang-questions] Idiom for multiple case matches

David Mercer dmercer@REDACTED
Mon Nov 10 18:27:30 CET 2008


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. :-)




More information about the erlang-questions mailing list