Reverse words in a string: Difference between revisions
m
→{{header|AppleScript}}: Updated primitives
(Added Kotlin) |
m (→{{header|AppleScript}}: Updated primitives) |
||
Line 214:
=={{header|AppleScript}}==
<lang AppleScript>on run
unlines(map(reverseWords, |lines|("---------- Ice and Fire ------------
Line 226:
Frost Robert -----------------------")))
end run
-- GENERIC FUNCTIONS ---------------------------------------------------------
-- reverseWords :: String -> String
Line 281 ⟶ 284:
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
set
end
▲end map</lang>
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
if class of f is script then
▲ f
▲ else
script
property lambda : f
end script
end if
end mReturn
</lang>
{{out}}
|