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:
parent
15a2665023
commit
147c611fef
1 changed files with 9 additions and 2 deletions
11
chainify.py
11
chainify.py
|
@ -22,7 +22,7 @@ patterns = ["020", "021", "022", "02", "10", "11", "12", "20", "21", "22",
|
||||||
pattern = ""
|
pattern = ""
|
||||||
while len(arities):
|
while len(arities):
|
||||||
if pattern in patterns and pattern + str(arities[-1][0]) not in patterns:
|
if pattern in patterns and pattern + str(arities[-1][0]) not in patterns:
|
||||||
exprs += [pattern, expr]
|
exprs.append([pattern, expr])
|
||||||
expr = []
|
expr = []
|
||||||
pattern = ""
|
pattern = ""
|
||||||
|
|
||||||
|
@ -31,8 +31,15 @@ while len(arities):
|
||||||
arities.pop()
|
arities.pop()
|
||||||
|
|
||||||
if expr and pattern in patterns:
|
if expr and pattern in patterns:
|
||||||
exprs += [pattern, expr]
|
exprs.append([pattern, expr])
|
||||||
expr = []
|
expr = []
|
||||||
pattern = ""
|
pattern = ""
|
||||||
|
|
||||||
print(exprs)
|
print(exprs)
|
||||||
|
|
||||||
|
|
||||||
|
for exp in exprs:
|
||||||
|
pattern, fns = exp
|
||||||
|
|
||||||
|
if pattern == "020":
|
||||||
|
print(fns[1] + "(" + fns[0] + ",", fns[2] + ")")
|
||||||
|
|
Loading…
Reference in a new issue