Pangram checker: Difference between revisions

Content added Content deleted
(Add BCPL)
Line 216: Line 216:
<lang AppleScript>use framework "Foundation" -- ( for case conversion function )
<lang AppleScript>use framework "Foundation" -- ( for case conversion function )


-- PANGRAM CHECK -------------------------------------------------------------
---------------------- PANGRAM CHECK ---------------------


-- isPangram :: String -> Bool
-- isPangram :: String -> Bool
Line 227: Line 227:
end script
end script
length of filter(charUnUsed, "abcdefghijklmnopqrstuvwxyz") = 0
0 = length of filter(charUnUsed, ¬
"abcdefghijklmnopqrstuvwxyz")
end isPangram
end isPangram




-- TEST ----------------------------------------------------------------------
--------------------------- TEST -------------------------
on run
on run
map(isPangram, {¬
map(isPangram, {¬
Line 240: Line 241:
end run
end run



-- GENERIC FUNCTIONS ---------------------------------------------------------
-------------------- GENERIC FUNCTIONS -------------------


-- filter :: (a -> Bool) -> [a] -> [a]
-- filter :: (a -> Bool) -> [a] -> [a]
Line 254: Line 256:
end tell
end tell
end filter
end filter



-- map :: (a -> b) -> [a] -> [b]
-- map :: (a -> b) -> [a] -> [b]
Line 267: Line 270:
end map
end map



-- Lift 2nd class handler function into 1st class script wrapper
-- Lift 2nd class handler function into
-- 1st class script wrapper
-- mReturn :: Handler -> Script
-- mReturn :: Handler -> Script
on mReturn(f)
on mReturn(f)
Line 278: Line 283:
end if
end if
end mReturn
end mReturn



-- toLower :: String -> String
-- toLower :: String -> String