Maximum triangle path sum: Difference between revisions
m
→{{header|AppleScript}}: Tidying.
Alextretyak (talk | contribs) (Added 11l) |
m (→{{header|AppleScript}}: Tidying.) |
||
Line 183:
=={{header|AppleScript}}==
{{Trans|JavaScript}}
<lang AppleScript>
-- Working from the bottom of the triangle upwards,
Line 221:
on run
Line 249:
-- foldl :: (a -> b -> a) -> a -> [b] -> a
Line 262:
end tell
end foldl
-- foldr1 :: (a -> a -> a) -> [a] -> a
Line 278 ⟶ 279:
end if
end foldr1
-- head :: [a] -> a
Line 287 ⟶ 289:
end if
end head
-- max :: Ord a => a -> a -> a
Line 296 ⟶ 299:
end if
end max
-- min :: Ord a => a -> a -> a
Line 305 ⟶ 309:
end if
end min
-- minimum :: [a] -> a
Line 320 ⟶ 325:
foldl(min, missing value, xs)
end minimum
-- Lift 2nd class handler function into 1st class script wrapper
Line 332 ⟶ 338:
end if
end mReturn
-- tail :: [a] -> [a]
Line 341 ⟶ 348:
end if
end tail
-- zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
|