A plurivalent logic engine inspired by "Beyond true and false".
Not yet published to npm. Placeholder.
npm install --production --save plur
jasmine
Other versions coming. For now use require. The unit tests full exercise the library.
// TODO: Use your own path until this is on npm.
var plur = require('plur')
var True = plur.True();
var False = plur.False();
var Paradox = plur.Paradox();
var Empty = plur.Empty();
var Ineffable = plur.Ineffable();
console.log(...True.iter()); // true
console.log(...False.iter()); // false
console.log(...Paradox.iter()); // true false
console.log(...Empty.iter()); //
console.log(...Ineffable.iter()); // NaN
// Test equality with "is". TODO: Better chaining. Currently this
// leads to unfortunate constructions such as "True.not().is(False)".
console.log(Paradox.is(Paradox)); // true
console.log(Paradox.not().is(Paradox)); // false
// Boolean operations work the same.
console.log(...True.and(False).iter()); // false
console.log(...True.or (False).iter()); // true
console.log(...True.not().iter()); // false
// See unit tests for complete truth table.
// Paradox is "both true and false".
// Empty is "neither true nor false".
console.log(...Paradox.or (Empty).iter()); // true false
console.log(...Paradox.and(Empty).iter()); //
// See unit tests for complete truth table.
// Ineffable is "none of the above", "inapplicable".
console.log(...Ineffable.and(True).iter()); // NaN
console.log(...Ineffable.or(Paradox).iter()); // NaN
console.log(...Ineffable.and(Empty).iter()); // NaN
// See unit tests for complete truth table.