[−][src]Function deep_learning_playground::perceptron::single::nand_perceptron
pub fn nand_perceptron() -> Box<dyn Fn(bool, bool) -> bool>
nand_perceptron
generates the logical NAND function.
Let \(p\) and \(q\) are logical variables, nand_perceptron
generates the function which
satisfies the following truth table.
\(p\) | \(q\) | nand_perceptron()( \(p\), \(q\)) |
---|---|---|
\(1\) | \(1\) | \(0\) |
\(1\) | \(0\) | \(1\) |
\(0\) | \(1\) | \(1\) |
\(0\) | \(0\) | \(1\) |
e.g.
assert_eq!(true, deep_learning_playground::perceptron::single::nand_perceptron()(true, false)); assert_eq!(false, deep_learning_playground::perceptron::single::nand_perceptron()(true, true));