Cantor set: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: added whitespace, changed some comments. |
m →{{header|AppleScript}}: tidied. Added preamble. |
||
Line 152: | Line 152: | ||
=={{header|AppleScript}}== |
=={{header|AppleScript}}== |
||
⚫ | |||
Using composable library functions whenever possible, for better productivity: |
|||
⚫ | |||
⚫ | |||
on cantor(xs) |
on cantor(xs) |
||
script go |
script go |
||
Line 169: | Line 173: | ||
end cantor |
end cantor |
||
---------------------------- TEST -------------------------- |
|||
⚫ | |||
⚫ | |||
⚫ | |||
-- showCantor :: Int -> String |
-- showCantor :: Int -> String |
||
Line 178: | Line 187: | ||
--------------------- GENERIC FUNCTIONS -------------------- |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
-- concat :: [[a]] -> [a] |
-- concat :: [[a]] -> [a] |
||
Line 200: | Line 203: | ||
acc |
acc |
||
end concat |
end concat |
||
-- concatMap :: (a -> [b]) -> [a] -> [b] |
-- concatMap :: (a -> [b]) -> [a] -> [b] |
||
Line 212: | Line 216: | ||
return acc |
return acc |
||
end concatMap |
end concatMap |
||
-- map :: (a -> b) -> [a] -> [b] |
-- map :: (a -> b) -> [a] -> [b] |
||
Line 224: | Line 229: | ||
end tell |
end tell |
||
end map |
end map |
||
-- Lift 2nd class handler function into 1st class script wrapper |
-- Lift 2nd class handler function into 1st class script wrapper |
||
Line 236: | Line 242: | ||
end if |
end if |
||
end mReturn |
end mReturn |
||
-- iterate :: (a -> a) -> a -> Gen [a] |
-- iterate :: (a -> a) -> a -> Gen [a] |
||
Line 300: | Line 307: | ||
end if |
end if |
||
end take |
end take |
||
-- unlines :: [String] -> String |
-- unlines :: [String] -> String |