Name Boolean ops.
So they don't overshadow the defs for the short-circuiting combinators.
This commit is contained in:
parent
1089ab7c24
commit
373666bf39
|
|
@ -933,7 +933,7 @@ def swap(stack):
|
||||||
return (a1, (a2, stack))
|
return (a1, (a2, stack))
|
||||||
|
|
||||||
|
|
||||||
def BinaryLogicWrapper(f):
|
def BinaryLogicWrapper(f, name=None):
|
||||||
'''
|
'''
|
||||||
Wrap functions that take two numbers and return a single result.
|
Wrap functions that take two numbers and return a single result.
|
||||||
'''
|
'''
|
||||||
|
|
@ -946,6 +946,9 @@ def BinaryLogicWrapper(f):
|
||||||
result = f(b, a)
|
result = f(b, a)
|
||||||
return (result, stack), expression, dictionary
|
return (result, stack), expression, dictionary
|
||||||
|
|
||||||
|
if name:
|
||||||
|
BinaryLogicWrapper_inner.__name__ = name
|
||||||
|
|
||||||
return BinaryLogicWrapper_inner
|
return BinaryLogicWrapper_inner
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1030,9 +1033,9 @@ for F in (
|
||||||
##╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝
|
##╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝
|
||||||
UnaryWrapper(bool), # Convert any value to Boolean.
|
UnaryWrapper(bool), # Convert any value to Boolean.
|
||||||
# (The only polymorphic function.)
|
# (The only polymorphic function.)
|
||||||
BinaryLogicWrapper(operator.xor),
|
BinaryLogicWrapper(operator.xor, name='_\\/_'),
|
||||||
BinaryLogicWrapper(operator.and_),
|
BinaryLogicWrapper(operator.and_, name='/\\'),
|
||||||
BinaryLogicWrapper(operator.or_),
|
BinaryLogicWrapper(operator.or_, name='\\/'),
|
||||||
UnaryLogicWrapper(operator.not_),
|
UnaryLogicWrapper(operator.not_),
|
||||||
##███╗ ███╗ █████╗ ████████╗██╗ ██╗
|
##███╗ ███╗ █████╗ ████████╗██╗ ██╗
|
||||||
##████╗ ████║██╔══██╗╚══██╔══╝██║ ██║
|
##████╗ ████║██╔══██╗╚══██╔══╝██║ ██║
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue