Jump to content

Pangram checker: Difference between revisions

Add CLU
(Added solution for Action!)
(Add CLU)
Line 1,006:
(let [letters (into #{} "abcdefghijklmnopqrstuvwxyz")]
(= (->> s .toLowerCase (filter letters) (into #{})) letters)))</lang>
 
=={{header|CLU}}==
<lang clu>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</lang>
{{out}}
<pre>"The quick brown fox jumps over the lazy dog." is a pangram.
"The five boxing wizards dump quickly." is not a pangram.
"abcdefghijklmnopqrstuvwxyz" is a pangram.</pre>
 
=={{header|COBOL}}==
2,121

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.