Skip to content

Instantly share code, notes, and snippets.

@socalledsound
socalledsound / booleans.js
Created August 15, 2021 16:31 — forked from beoliver/booleans.js
javascript boolean matches (and / nand / or / nor / xor / iff / all / any / none )
function id(x) {
// id :: a -> a
return x }
function anyBool(pred,bool,xs) {
/* a better name would be - if predicate is True then bool, else not bool.
using basic logic we can now create logic functions that compute only as much as required */
// anyBool :: (a -> Bool) -> Bool -> [a] -> Bool
for (var i = 0; i < xs.length; i++) {
if (pred(xs[i]) === bool) {