Flatten a list: Difference between revisions
Content added Content deleted
No edit summary |
m (→{{header|AppleScript}}: Tidying and comments.) |
||
Line 334: | Line 334: | ||
Or, |
Or, to make more productive use of the language ("efficiency" is a function of the scripter's time, rather than the machine's) we can express this in terms of a generic '''concatMap''': |
||
{{trans|JavaScript}} |
{{trans|JavaScript}} |
||
<lang AppleScript>-- flatten :: Tree a -> [a] |
<lang AppleScript>-- flatten :: Tree a -> [a] |
||
Line 345: | Line 345: | ||
end flatten |
end flatten |
||
--------------------------- TEST --------------------------- |
|||
on run |
on run |
||
Line 354: | Line 354: | ||
-------------------- GENERIC FUNCTIONS --------------------- |
|||
-- concatMap :: (a -> [b]) -> [a] -> [b] |
-- concatMap :: (a -> [b]) -> [a] -> [b] |