Department numbers: Difference between revisions
m
→{{header|Python}}: (defined bind in terms of operator.add)
m (→{{header|Python}}: (defined bind in terms of operator.add)) |
|||
Line 1,925:
14: 6 5 1 </pre>
Or,
<lang python>from functools import (reduce)
from operator import (add)
Line 1,960 ⟶ 1,961:
# bind (>>=) :: [a] -> (a -> [b]) -> [b]
def bind(xs):
return lambda f: reduce(add, map(f, xs), [])
|