View Source LogicGates.Not (Logic Gates v0.7.1)

Summary

Functions

Executes an NOT gate on an input which is either a boolean or an anonymous function that returns either :ok and a boolean, or :error and a reason. The input can also be a list with exactly one element of the type described above.

Functions

@spec exec(boolean() | (function() -> {:ok, boolean()} | {:error, any()})) ::
  {:ok, boolean()} | {:error, binary()}

Executes an NOT gate on an input which is either a boolean or an anonymous function that returns either :ok and a boolean, or :error and a reason. The input can also be a list with exactly one element of the type described above.

An NOT gate returns true if the input value evaluates to false, and vice versa.

If any input value function returns an error on evaluation, this function will return an error.

Truth table

iex> LogicGates.Not.exec(false)
{:ok, :true}

iex> LogicGates.Not.exec(true)
{:ok, :false}