Usefulness of the "not in" operator

Alain Ketterlin alain at dpt-info.u-strasbg.fr
Mon Oct 10 09:01:16 EDT 2011


Alec Taylor <alec.taylor6 at gmail.com> writes:

> On Sun, Oct 9, 2011 at 3:08 AM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:

>> def true(x, y):
>>    return x
>>
>> def false(x, y):
>>    return y
[...]
>> def Nand(a, b):
>>    return (lambda c: lambda x, y: c(y, x))(a(b, a))
>>
>> and we're done. [...]

> Awesome

Yes, that's how Church defined booleans in the lambda calculus. See
http://en.wikipedia.org/wiki/Church_encoding for encodings of natural
numbers and lists.

-- Alain.



More information about the Python-list mailing list