@inscribe
+ @FunctionWrapper
+ def gcd2(stack, expression, dictionary):
+ '''Compiled GCD function.'''
+ (v1, (v2, stack)) = stack
+ tos = True
+ while tos:
+ v3 = v2 % v1
+ tos = v3 > 0
+ (v1, (v2, stack)) = (v3, (v1, stack))
+ return (v2, stack), expression, dictionary
+
+
+ @inscribe
@SimpleFunctionWrapper
def choice(stack):
- '''
- Use a Boolean value to select one of two items.
- ::
+ '''
+ Use a Boolean value to select one of two items.
+ ::
- A B False choice
- ----------------------
- A
+ A B False choice
+ ----------------------
+ A
- A B True choice
- ---------------------
- B
+ A B True choice
+ ---------------------
+ B
- Currently Python semantics are used to evaluate the "truthiness" of the
- Boolean value (so empty string, zero, etc. are counted as false, etc.)
- '''
- (if_, (then, (else_, stack))) = stack
- return then if if_ else else_, stack
+ Currently Python semantics are used to evaluate the "truthiness" of the
+ Boolean value (so empty string, zero, etc. are counted as false, etc.)
+ '''
+ (if_, (then, (else_, stack))) = stack
+ return then if if_ else else_, stack
@inscribe