Skip to content

Instantly share code, notes, and snippets.

@Eugeny
Created November 7, 2011 15:34
Show Gist options
  • Save Eugeny/1345286 to your computer and use it in GitHub Desktop.
Save Eugeny/1345286 to your computer and use it in GitHub Desktop.
def a(x,y): return x and y
def o(x,y): return x or y
def s(x,y): return not(x and y) // sheffer
def n(x): return not x
def c(fx):
r = 2
for x1 in [True, False]:
for x2 in [True, False]:
for x3 in [True, False]:
for x4 in [True, False]:
r *= 10
if fx(x1,x2,x3,x4):
r += 1
print r
c(lambda x1,x2,x3,x4: s(s(x1,x2),x3))
c(lambda x1,x2,x3,x4: n(x1 and x2 and x3))
c(lambda x1,x2,x3,x4: n(a(a(n(x1),x2),x3)))
c(lambda x1,x2,x3,x4: s(a(n(x1),x2),x3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment