Lambda in parameters

Abdur-Rahmaan Janhangeer arj.python at gmail.com
Thu Dec 17 14:52:07 EST 2020


Greetings list,

Here is a famous question's solution

def cons(a, b):
    def pair(f):
        return f(a, b)
    return pair

def car(c):
    return c(lambda a, b: a)

print(cons(1, 2)(lambda a, b: a))
print(car(cons(1, 2)))

The aim of car is to return 1


but i don't understand how lambda achieves this

Kind Regards,


Abdur-Rahmaan Janhangeer

https://www.github.com/Abdur-RahmaanJ

Mauritius

sent from gmail client on Android, that's why the signature is so ugly.


More information about the Python-list mailing list