[erlang-questions] Idiom for multiple case matches
Tue Nov 11 17:57:24 CET 2008
>>> and what you mean is presumably that 'is_vowel' is a function that
>>> returns 'true' if its argument is a member of the list "aeiou",
>>> otherwise 'false'.
>>> the fact that this is a fairly common task is of course the reason
>>> why lists:member/2 exists in the first place. so by not using
>>> lists:member/2 here, you are obfuscating the fact that you are
>>> indeed testing if something is a member of a list.
>> Well, if you want to be pedantic, that's completely wrong. There's
>> nothing list-like about the collection of vowels. It's a set.
> i believe a list without duplicates is a set. no?
Almost, but not exactly. But since your goal was to eschew
obfuscation, why would you rely on the maintainer of the code noticing
there are no duplicates, when instead you could express the constraint
explicitly by using the proper data structure?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions