Cheryl's birthday: Difference between revisions
Content added Content deleted
m (→Python :: Functional: Tidying) |
|||
Line 2,123: | Line 2,123: | ||
of (Month, Day) pairs. |
of (Month, Day) pairs. |
||
''' |
''' |
||
return lambda f: |
return lambda f: f( |
||
⚫ | |||
dictFromPairs(xs), |
|||
⚫ | |||
dictFromPairs( |
|||
[(b, a) for (a, b) in xs] |
|||
) |
|||
⚫ | |||
) |
|||
Line 2,167: | Line 2,172: | ||
''' |
''' |
||
return tpl[1] |
return tpl[1] |
||
# swap :: (a, b) -> (b, a) |
|||
def swap(tpl): |
|||
'''Swapped components of a pair. |
|||
⚫ | |||
return (tpl[1], tpl[0]) |
|||