RosettaCodeData/Task/Letter-frequency/Quackery/letter-frequency.quackery
2023-07-01 13:44:08 -04:00

25 lines
660 B
Text

[ [] 26 times [ 0 join ] ] is makecountnest ( --> [ )
[ char A char Z 1+ within ] is ischar ( c --> b )
[ char A -
2dup peek 1+ unrot poke ] is tallychar ( [ c --> [ )
[ makecountnest swap
witheach
[ upper dup ischar iff
tallychar
else drop ] ] is countchars ( $ --> [ )
[ say "Letter count:" cr
witheach
[ say " "
i^ char A + emit
say ":" echo
cr ] ] is echocount ( [ --> )
[ sharefile 0 = if
[ $ " not found."
join fail ]
countchars
echocount ] is fileletters ( $ --> )