View Source LogicGates.Nor (Logic Gates v0.1.0)
Summary
Functions
Executes a NOR gate on an input list. The list may contain either boolean values or anonymous functions that return either :ok and a boolean, or :error and a reason.
Functions
@spec exec([boolean() | (function() -> {:ok, boolean()} | {:error, any()})]) :: {:ok, boolean()} | {:error, binary()}
Executes a NOR gate on an input list. The list may contain either boolean values or anonymous functions that return either :ok and a boolean, or :error and a reason.
A NOR gate returns true if all of the input values evaluate to false. Otherwise it returns false.
If any input value function returns an error on evaluation, this function will return an error.
Truth table with three input values
iex> LogicGates.Nor.exec([false, false, false])
{:ok, :true}
iex> LogicGates.Nor.exec([false, false, true])
{:ok, :false}
iex> LogicGates.Nor.exec([false, true, false])
{:ok, :false}
iex> LogicGates.Nor.exec([false, true, true])
{:ok, :false}
iex> LogicGates.Nor.exec([true, false, false])
{:ok, :false}
iex> LogicGates.Nor.exec([true, false, true])
{:ok, :false}
iex> LogicGates.Nor.exec([true, true, false])
{:ok, :false}
iex> LogicGates.Nor.exec([true, true, true])
{:ok, :false}