steven at REMOVE.THIS.cybersource.com.au
Wed Jun 17 04:44:19 EDT 2009
On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote:
> I was staring at a logic table the other day, and I asked myself, "what
> if one wanted to play with exotic logics; how might one do it?"
This might be useful for you, and if not useful, at least it might blow
your mind like it did mine.
(This is not original to me -- I didn't create it. However, I can't find
the original source.)
Imagine for a moment that there are no boolean values.
There are no numbers. They were never invented.
There are no classes.
There are no objects.
There are only functions.
Could you define functions that act like boolean values? And could you
define other functions to operate on them?
def true(x, y):
def false(x, y):
print b("true", "false")
def not_b(x, y):
return b(y, x)
def And(a, b):
return a(b, a)
def Or(a, b):
return a(a, b)
More information about the Python-list