September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,4 +1,4 @@
on run {}
on run
unlines(map(reverseWords, |lines|("---------- Ice and Fire ------------
@ -13,6 +13,9 @@ Frost Robert -----------------------")))
end run
-- GENERIC FUNCTIONS ---------------------------------------------------------
-- reverseWords :: String -> String
on reverseWords(str)
unwords(|reverse|(|words|(str)))
@ -65,13 +68,24 @@ end intercalate
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
script mf
property lambda : f
end script
set lst to {}
set lng to length of xs
repeat with i from 1 to lng
set end of lst to mf's lambda(item i of xs, i, xs)
end repeat
return lst
tell mReturn(f)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to lambda(item i of xs, i, xs)
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
f
else
script
property lambda : f
end script
end if
end mReturn