Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
9
Task/Ternary-logic/JavaScript/ternary-logic-3.js
Normal file
9
Task/Ternary-logic/JavaScript/ternary-logic-3.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
trit = {false: 'F', maybe: 'U', true: 'T'}
|
||||
nand = (a, b) => (a == trit.false || b == trit.false) ? trit.true : (a == trit.maybe || b == trit.maybe) ? trit.maybe : trit.false
|
||||
not = (a) => nand(a, a)
|
||||
and = (a, b) => not(nand(a, b))
|
||||
or = (a, b) => nand(not(a), not(b))
|
||||
nor = (a, b) => not(or(a, b))
|
||||
implies = (a, b) => nand(a, not(b))
|
||||
iff = (a, b) => or(and(a, b), nor(a, b))
|
||||
xor = (a, b) => not(iff(a, b))
|
||||
Loading…
Add table
Add a link
Reference in a new issue