This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |