Jump to content

Pascal's triangle: Difference between revisions

m
→‎{{header|AppleScript}}: updated primitive
m (→‎{{header|AppleScript}}: updated primitive)
Line 358:
-- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
on zipWith(f, xs, ys)
set lngnx to length of xs
ifset lngny is notto length of ys then return missing value
if nx < 1 or ny < 1 then
set mf to mReturn(f) {}
set lst to {}else
repeat with i from 1set lng to lngcond(nx < ny, nx, ny)
set end of lst to mf's lambda(item i of xs, item i of ys){}
tell mReturn(f)
end repeat
repeat with i from 1 to lng
return lst
set end of lst to lambda(item i of xs, item i of ys)
end repeat
return lst
end tell
end if
end zipWith
 
-- cond :: Bool -> (a -> b) -> (a -> b) -> (a -> b)
on cond(bool, f, g)
if bool then
f
else
g
end if
end cond
 
-- intercalate :: Text -> [Text] -> Text
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.