Pascal's triangle: Difference between revisions
Content added Content deleted
m (→{{header|AppleScript}}: updated primitive) |
|||
Line 358: | Line 358: | ||
-- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] |
-- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] |
||
on zipWith(f, xs, ys) |
on zipWith(f, xs, ys) |
||
set |
set nx to length of xs |
||
set ny to length of ys |
|||
if nx < 1 or ny < 1 then |
|||
⚫ | |||
{} |
|||
else |
|||
set lng to cond(nx < ny, nx, ny) |
|||
set |
set lst to {} |
||
tell mReturn(f) |
|||
⚫ | |||
repeat with i from 1 to lng |
|||
⚫ | |||
set end of lst to lambda(item i of xs, item i of ys) |
|||
⚫ | |||
⚫ | |||
end tell |
|||
end if |
|||
end zipWith |
end zipWith |
||
-- cond :: Bool -> (a -> b) -> (a -> b) -> (a -> b) |
|||
on cond(bool, f, g) |
|||
if bool then |
|||
f |
|||
⚫ | |||
g |
|||
end if |
|||
end cond |
|||
-- intercalate :: Text -> [Text] -> Text |
-- intercalate :: Text -> [Text] -> Text |