I came accross the following interview question and have no idea how to solve it:
def cons(a, b):
    def pair(f):
        return f(a, b)
    return pair
Given a pair, e.g cons(6,8) I am requested to return a and b separetely, e.g in this case 6, 8 respectively.
Meaning, for example,
def first(pair):
    pass
    #would return pair's `a` somehow
def second(pair):
    pass
    #would return pair's `b` somehow
How can this be done?
 
     
     
     
     
    