Pangram checker: Difference between revisions
→{{header|AppleScript}}: Small adjustment
(→{{header|AppleScript}}: Small adjustment) |
|||
Line 185:
From OSX 10.10 onwards, we can, however, use ObjC functions from AppleScript by importing the Foundation framework. We do this below to get a toLowerCase() function. If we also add generic filter and map functions, we can write and test a simple isPangram() function as follows:
<lang AppleScript>use framework "Foundation" -- ( for case conversion function )
on run▼
map(isPangram, {¬▼
"is this a pangram", ¬▼
"The quick brown fox jumps over the lazy dog"})▼
end run▼
-- isPangram :: String -> Bool
on isPangram(s)
property lowerCaseString : my toLowerCase(s)
{lowerCaseString:toLowerCase(s)}), ¬▼
on
end lambda
end script
length of filter(charUnUsed, "abcdefghijklmnopqrstuvwxyz") = 0
end isPangram
-- TEST
▲on run
▲ map(isPangram, {¬
▲ "is this a pangram", ¬
▲ "The quick brown fox jumps over the lazy dog"})
--> {false, true}
▲end run
Line 276 ⟶ 282:
end if
end unwrap
</lang>
{{Out}}
<
=={{header|AutoHotkey}}==
|