String case: Difference between revisions
Content deleted Content added
m →{{header|AppleScript}}: Slight reordering, updated primitives |
|||
Line 334:
<lang applescript>use framework "Foundation"
on run▼
map(testCase, {my toUpperCase, my toLowerCase, my toCapitalized})▼
end run▼
-- toUpperCase :: Text -> Text
Line 364 ⟶ 358:
--
-- testCase :: Handler -> String
Line 371 ⟶ 365:
end testCase
▲on run
▲end run
-- GENERIC FUNCTIONS ▼
▲-- GENERIC FUNCTIONS
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to
end repeat
return lst
end tell
end map
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
if class of f is script then
else
property lambda : f▼
▲ property lambda : f
end mReturn</lang>▼
end script
end if
</lang>
|