June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,25 +1,20 @@
function makepangramchecker{T<:String}(a::T)
abet = sort(unique(split(uppercase(a), "")))
alen = length(abet)
function ispangram{T<:String}(s::T)
alen <= length(s) || return false
ps = filter(c->(c in abet), unique(split(uppercase(s), "")))
return length(ps) == alen
function makepangramchecker(alphabet)
alphabet = Set(uppercase.(alphabet))
function ispangram(s)
lengthcheck = length(s) ≥ length(alphabet)
return lengthcheck && all(c in uppercase(s) for c in alphabet)
end
return ispangram
end
tests = ["Pack my box with five dozen liquor jugs.",
"The quick brown fox jumps over a lazy dog.",
"The quick brown fox jumps\u2323over the lazy dog.",
"The five boxing wizards jump quickly.",
"This sentence contains A-Z but not the whole alphabet."]
const tests = ["Pack my box with five dozen liquor jugs.",
"The quick brown fox jumps over a lazy dog.",
"The quick brown fox jumps\u2323over the lazy dog.",
"The five boxing wizards jump quickly.",
"This sentence contains A-Z but not the whole alphabet."]
isenglishpang = makepangramchecker("abcdefghijklmnopqrstuvwxyz")
is_english_pangram = makepangramchecker('a':'z')
for s in tests
print("The sentence \"", s, "\" is ")
if !isenglishpang(s)
print("not ")
end
println("a pangram.")
println("The sentence \"", s, "\" is ", is_english_pangram(s) ? "" : "not ", "a pangram.")
end