-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbool.js
More file actions
60 lines (50 loc) · 1.26 KB
/
bool.js
File metadata and controls
60 lines (50 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* not : Bool -> Bool
*/
function not(@p) { return !p; }
/**
* negate : (a -> Bool) -> a -> Bool
*/
function negate(@p) { return function(@a) {return !p(a); };}
/**
* equal : a -> a -> Bool
*/
function equal(@x) { return function(@y) { return x === y; };}
/**
* notEqual : a -> a -> Bool
*/
function notEqual(@x) { return function(@y) { return x !== y; };}
/**
* comparing : (a -> b) -> (b -> b -> c) -> a -> a -> c
*/
function comparing(@f) { return function(@p) { return function(@x) { return function(@y) {
return p(f(x))(f(y));
};};};}
/**
* comparingu : (a -> b) -> ((b, b) -> c) -> (a, a) -> c
*/
function comparingu(@f) { return function(@p) { return function(@x, @y) {
return p(f(x), f(y));
};};}
/**
* superior : a -> a -> Bool
*/
function superior(@x) { return function(@y) { return x >= y; };}
/**
* stricltySuperior : a -> a -> Bool
*/
function strictlySuperior(@x) { return function(@y) { return x > y; };}
/**
* inferior : a -> a -> Bool
*/
function inferior(@x) { return function(@y) { return x <= y; };}
/**
* stricltyInferior : a -> a -> Bool
*/
function strictlyInferior(@x) { return function(@y) { return x < y; };}
/**
* bool : (a - False) -> (a - True) -> Bool -> a
*/
function bool(@x) { return function(@y) { return function(@b) {
return b ? y : x;
};};}