We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
def go_Not(a): print("if !(%s) && !(%s){\n" "}" % (a, a))
def go_And(a, b): # Pa(a, a) Pa = "!({A}) && !({A}) ".format({"A": a, "B": b}) # Pb(b, b) Pb = "!({B}) && !({B}) ".format({"A": a, "B": b}) # P(Pa, Pb) "" print("if !(%s) && !(%s){\n" "}" % (Pa, Pb))
def go_Or(a, b): Pab = "!({A}) && !({B}) ".format(**{"A": a, "B": b}) print("if !(%s) && !(%s){\n" "}" % (Pab, Pab))
if name == "main": go_Not("a == b") go_And("a == 1", "b == 2") go_Or("a != 1", "b == 2")
pass
The text was updated successfully, but these errors were encountered:
这几行代码是用来将go代码的逻辑运算进行负优化的,思路是用 not not and 来负优化常用的逻辑运算,试想一下git里全是这种东西,再来个大神上AST 开启三级负优化(能力有限只达到了负一级),公司想用继续用你的代码就是个笑话
Sorry, something went wrong.
利害。但我担心code review过不去。
No branches or pull requests
coding=utf-8
def go_Not(a):
print("if !(%s) && !(%s){\n"
"}" % (a, a))
def go_And(a, b):
# Pa(a, a)
Pa = "!({A}) && !({A}) ".format({"A": a, "B": b})
# Pb(b, b)
Pb = "!({B}) && !({B}) ".format({"A": a, "B": b})
# P(Pa, Pb)
""
print("if !(%s) && !(%s){\n"
"}" % (Pa, Pb))
def go_Or(a, b):
Pab = "!({A}) && !({B}) ".format(**{"A": a, "B": b})
print("if !(%s) && !(%s){\n"
"}" % (Pab, Pab))
if name == "main":
go_Not("a == b")
go_And("a == 1", "b == 2")
go_Or("a != 1", "b == 2")
The text was updated successfully, but these errors were encountered: