1
0
Fork 0
mirror of https://github.com/Lyxal/Keta.git synced 2024-08-14 23:53:13 +00:00

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

View file

@ -1,4 +1,4 @@
dyads = "*+-/%" dyads = "*+-/%@"
monads = list(map(chr, range(ord("A"), ord("Z") + 1))) monads = list(map(chr, range(ord("A"), ord("Z") + 1)))
nilads = "1234567890" nilads = "1234567890"
@ -16,10 +16,12 @@ for char in source:
exprs = [] exprs = []
expr = [] 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 = "" pattern = ""
while len(arities): while len(arities):
if pattern in patterns: if pattern in patterns and pattern + str(arities[-1][0]) not in patterns:
exprs += [pattern, expr] exprs += [pattern, expr]
expr = [] expr = []
pattern = "" pattern = ""
@ -28,7 +30,7 @@ while len(arities):
expr.append(arities[-1][1]) expr.append(arities[-1][1])
arities.pop() arities.pop()
if not exprs and pattern in patterns: if expr and pattern in patterns:
exprs += [pattern, expr] exprs += [pattern, expr]
expr = [] expr = []
pattern = "" pattern = ""