Cheryl's birthday: Difference between revisions

m
Line 2,123:
of (Month, Day) pairs.
'''
return lambda f: list(f(
)) (
( dictFromPairs(xs), dictFromPairs(map(swap, xs)))
))
dictFromPairs(
[(b, a) for (a, b) in xs]
)
''' )
)
 
 
Line 2,167 ⟶ 2,172:
'''
return tpl[1]
 
 
# swap :: (a, b) -> (b, a)
def swap(tpl):
'''Swapped components of a pair.
'''
return (tpl[1], tpl[0])
 
 
9,655

edits