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