This commit is contained in:
Simon Forman 2021-10-26 10:32:19 -07:00
parent 1cf82b8bcb
commit 1d59095245
1 changed files with 13 additions and 0 deletions

View File

@ -423,6 +423,19 @@ def take(stack):
return x, stack
@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):