Skip to content

Instantly share code, notes, and snippets.

@harms
Created December 7, 2011 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harms/1444658 to your computer and use it in GitHub Desktop.
Save harms/1444658 to your computer and use it in GitHub Desktop.
Counting characters by kind.
whitespace=: 9 10 32 { a.
vowel =: ( , toupper) 'aeiou'
consonant =: vowel -.~ a.{~ , 97 65 +"0 _ i.26
other =: a. -. whitespace, vowel, consonant
kind=: whitespace; vowel; consonant; other
count=: ([: +/ ] e. >@[ )" _1 _
kind count 'Some test text.'
2 4 8 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment