Greatest subsequential sum: Difference between revisions
Content added Content deleted
m (→{{header|AppleScript}}: Updated primitives – max and gt) |
|||
Line 126: | Line 126: | ||
end tell |
end tell |
||
end foldl |
end foldl |
||
-- gt :: Ord a => a -> a -> Bool |
|||
on gt(x, y) |
|||
set c to class of x |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end gt |
|||
-- fst :: (a, b) -> a |
-- fst :: (a, b) -> a |
||
Line 150: | Line 160: | ||
-- max :: Ord a => a -> a -> a |
-- max :: Ord a => a -> a -> a |
||
on max(x, y) |
on max(x, y) |
||
if gt(x, y) then |
|||
⚫ | |||
⚫ | |||
⚫ | |||
set {a, b} to {x, y} |
|||
⚫ | |||
⚫ | |||
x |
x |
||
else |
else |