Count how many vowels and consonants occur in a string: Difference between revisions

Content added Content deleted
No edit summary
(Realize in F#)
Line 95:
</pre>
 
=={{header|F_Sharp|F#}}==
<lang fsharp>
// Count how many vowels and consonants occur in a string. Nigel Galloway: August 1th., 202
type cType = Vowel |Consonant |Other
let fN g=match g with 'a'|'e'|'i'|'o'|'u'->Vowel |g when System.Char.IsLetter g->Consonant |_->Other
let n="Now is the time for all good men to come to the aid of their country."|>Seq.countBy(System.Char.ToLower>>fN)
printfn "%A" n
</lang>
{{out}}
<pre>
seq [(Consonant, 31); (Vowel, 22); (Other, 16)]
</pre>
=={{header|Factor}}==
{{works with|Factor|0.99 2021-06-02}}