[erlang-questions] Idiom for multiple case matches

Richard O'Keefe ok@REDACTED
Tue Nov 11 01:08:07 CET 2008


On 8 Nov 2008, at 7:25 am, Valentin Micic wrote:

> Wouldn't this be a good candidate for a macro?
>
> -define( IS_WOVEL( C ),		lists:member(C,"aeiouy") ).
>
> It would save one function call that just makes another call.
> Maybe you'd like to run it against your benchmark?

I'm extremely puzzled.

The set of vowels in English is commonly defined as
"aeiou", not including "y", which is called a "semi-vowel"
and usually listed among the consonants.  Basically,
some "y"s are vowels and some are not, and you can't tell
whether a particular character is acting as a vowel or not
by looking only that that character.  For example,
"Union" begins with the vowel _letter_ U but the
consonantal "y" _sound_; "hour" begins with the consonant
_letter_ "h" but the vowel "ow" _sound_.

Then there's the fact that most Western European languages
include rather more vowel letters; considering the origins
of Erlang it's relevant that Swedish is one of them.
For that matter, the English writing system allows
words like "naïve", "coöperate", "Penelopë", and so on.
I have a sister-in-law called "Chéri" who would like the
third letter of her name treated as a vowel, and my
father's middle name "Æneas" starts with a vowel.  Come
to think of it, we all have "hæmoglobin" in our veins,
so there's another vowel.

For what purpose are "aieouy" to be considered vowels and
not all the other vowels in ISO Latin 1, let alone Unicode?
For what purpose should "y" be considered a vowel even
though it very often functions as a consonant?

And now that we have PCRE (sigh) as a library, why is this
not being handle by some sort of regular expression (which
might, just _might_, have some hope of classifying letters
with enough context inspected for the results to be reliable)?




More information about the erlang-questions mailing list