Exotic Logics

Lie Ryan lie.1296 at gmail.com
Wed Jun 17 12:37:04 EDT 2009


Steven D'Aprano wrote:
> 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):
>     return x
> 
> def false(x, y):
>     return y
> 
> def print_bool(b):
>     print b("true", "false")
> 

String isn't considered object?

Also, b/true()/false() is a function object, isn't it? Unless function
is first-class, you can't pass them around like that, since you need a
function pointer (a.k.a number); but if function is first-class then
there it is an object.



More information about the Python-list mailing list