elmw/extra-boolean/1.3.5

NOTE: the latest version is 1.3.6

Renamed to nodef/extra-boolean.elm. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as elmw/extra-boolean still install under that name. 20 versions of 20 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/nodef/extra-boolean.elm.

What we checked: The repo moved to github.com/nodef/extra-boolean.elm. Rebuilt with git archive from commit dd841ccc5b0c of https://github.com/nodef/extra-boolean.elm (zip prefix elmw-extra-boolean-ab6380c/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 13b55c741cacc5681741c1be2dee582e18f5f19d.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/elmw/extra-boolean/zipball/1.3.5/

Boolean data type has two possible truth values to represent logic.
:package: Package, :blue_book: Wiki.

Here is my implementation of digital logic gates in software. That includes the basic gates not, and, or, xor; their complements nand, nor, xnor; and 2 propositional logic (taught in discrete mathematics) gates imply, eq; and their complements nimply, neq. There is also a multiplexer, called select, and a true counter, called count. count can help you make custom gates, such as an alternate concept of xnor which returns true only if all inputs are the same (standard xnor returns true if even inputs are true). All of them can handle upto 8 inputs.

parse is influenced by "boolean" package, and is quite good at translating string to boolean. It can also handle double negatives, eg. not inactive. You know the and of 2-inputs, but what of 1-input? What of 0? And what of the other gates? I answer them here.

Stability: Experimental.


import Boolean exposing (..)

parse "1"
parse "truthy"
parse "not off"
-- True

parse "not true"
parse "inactive"
parse "disabled"
-- False

imply True False
-- False

eq False False
-- True

xor3 True True True
-- True

select3 1 True False True
-- False         ^

count3 True True False
-- 2    ^    ^


Index

FunctionAction
parseConverts string to boolean.
notChecks if value is false.
andChecks if all values are true.
orChecks if any value is true.
xorChecks if odd no. of values are true.
nandChecks if any value is false.
norChecks if all values are false.
xnorChecks if even no. of values are true.
eqChecks if antecedent ⇔ consequent.
neqChecks if antecedent ⇎ consequent.
implyChecks if antecedent ⇒ consequent.
nimplyChecks if antecedent ⇏ consequent.
selectChecks if ith value is true.
countCounts no. of true values.