Usefulness of the "not in" operator

Nobody nobody at nowhere.com
Tue Oct 11 04:28:51 EDT 2011


On Tue, 11 Oct 2011 04:33:43 +1100, Chris Angelico wrote:

>> The Church numeral for N is a function of two arguments which applies its
>> first argument N times to its second, i.e. (f^N)(x) = f(f(...(f(x))...)).
>>
> 
> Thanks - nice clear explanation. Appreciated. For an encore, can you
> give an example of where this is actually useful? It seems a pretty
> narrow utility.

It's useful insofar as it allows you to define "numbers" given nothing
other than abstraction and application, which are the only operations
available in the lambda calculus.

The particular formulation makes it easy to define addition, which is
just composition:

	(f^(M+N))(x) = (f^M)((f^N)(x))

I.e.:

	def church_add(a, b):
	    return lambda f, x: a(f, b(f, x))




More information about the Python-list mailing list