If I have the given dispatch-style function to represent a pair, how can I implement the same using a one-line lambda
function?
# ADT Level 0 (dispatch-style pair)
def make_pair(x, y):
"""Dispatch-style pair"""
def dispatch(m):
if m == 0:
return x
elif m == 1:
return y
return dispatch