Update chainify.py

This commit is contained in:
JonoCode9374 2019-12-26 20:56:31 +11:00 committed by GitHub
parent c90ee6ca82
commit 15a2665023
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
dyads = "*+-/%"
dyads = "*+-/%@"
monads = list(map(chr, range(ord("A"), ord("Z") + 1)))
nilads = "1234567890"
@ -16,10 +16,12 @@ for char in source:
exprs = []
expr = []
patterns = ["02", "10", "11", "12", "20", "21", "22"]
patterns = ["020", "021", "022", "02", "10", "11", "12", "20", "21", "22",
"102", "110", "111", "112", "120", "121", "122",
"202", "210", "211", "212", "220", "221", "222"]
pattern = ""
while len(arities):
if pattern in patterns:
if pattern in patterns and pattern + str(arities[-1][0]) not in patterns:
exprs += [pattern, expr]
expr = []
pattern = ""
@ -28,7 +30,7 @@ while len(arities):
expr.append(arities[-1][1])
arities.pop()
if not exprs and pattern in patterns:
if expr and pattern in patterns:
exprs += [pattern, expr]
expr = []
pattern = ""