Skip to content

Instantly share code, notes, and snippets.

View moh-slimani's full-sized avatar
🏠
Working from home

Mohamed moh-slimani

🏠
Working from home
View GitHub Profile
@moh-slimani
moh-slimani / booleans.js
Created January 23, 2018 14:45 — 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) {