Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
32
Task/Pangram-checker/CLU/pangram-checker.clu
Normal file
32
Task/Pangram-checker/CLU/pangram-checker.clu
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
pangram = proc (s: string) returns (bool)
|
||||
letters: array[bool] := array[bool]$fill(0,26,false)
|
||||
for c: char in string$chars(s) do
|
||||
if c>='a' & c<='z' then
|
||||
c := char$i2c(char$c2i(c) - 32)
|
||||
end
|
||||
if c>='A' & c<='Z' then
|
||||
letters[char$c2i(c) - 65] := true
|
||||
end
|
||||
end
|
||||
for seen: bool in array[bool]$elements(letters) do
|
||||
if ~seen then return(false) end
|
||||
end
|
||||
return(true)
|
||||
end pangram
|
||||
|
||||
start_up = proc ()
|
||||
po: stream := stream$primary_output()
|
||||
examples: array[string] := array[string]$[
|
||||
"The quick brown fox jumps over the lazy dog.",
|
||||
"The five boxing wizards dump quickly.",
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
]
|
||||
|
||||
for example: string in array[string]$elements(examples) do
|
||||
stream$puts(po, "\"" || example || "\" is")
|
||||
if ~pangram(example) then
|
||||
stream$puts(po, " not")
|
||||
end
|
||||
stream$putl(po, " a pangram.")
|
||||
end
|
||||
end start_up
|
||||
Loading…
Add table
Add a link
Reference in a new issue