Skip to content

Instantly share code, notes, and snippets.

@LdBeth
Last active May 27, 2021 14:45
Show Gist options
  • Save LdBeth/237039ad30ae37a8492d5f7d0c6e152b to your computer and use it in GitHub Desktop.
Save LdBeth/237039ad30ae37a8492d5f7d0c6e152b to your computer and use it in GitHub Desktop.
&anchor = 1
char = len(1) . ch
white = span(' ')
word = break(' ') white
count = table(100)
loop line = input :f(stat)
lc = lc + 1
copy = line ' '
copy white =
skip copy word = :f(nchar)
wc = wc + 1 :(skip)
nchar line char = :f(loop)
ch notany(' ') :f(nchar)
chc = chc + 1
count<ch> = count<ch> + 1
n = count<ch>
max = lt(max,n) n :f(nchar)
maxch = ch :(nchar)
:(loop)
stat
output = 'Line count: ' lc
output = 'Max char: ' maxch ', occured ' max
output = 'Word count: ' wc
output = 'Avg ws: ' (((chc * 10) / wc) / 10.)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment