Debian Codegraph @

ipl/packs/loadfuncpp/examples/hexwords.icn

raw
1 procedure printable(word)
2 if ("" == word) then {
3 return "";
4 } else {
5 return map(map(word, "oOiIzZeEsStT", "001122335577"), &lcase, &ucase);
6 }
7 end
8 procedure main(arg)
9 word_file := "/usr/share/dict/words";
10 find := '0123456789abcdefABCDEFoOiIzZeEsStT';
11 usage := "Finds all the words in a word file that can be written using /^[A-Fa-f0-9$/";
12 words := open(word_file) | stop("Unable to open: " || word_file)
13 while word := trim(read(words)) do {
14 if ('' == word -- find) then {
15 write(printable(word) || " " || word);
16 }
17 }
18 end