Skip to content

Commit 3170ad7

Browse files
committed
eq -> equal, cmp -> compare
1 parent 7d498f7 commit 3170ad7

File tree

9 files changed

+75
-75
lines changed

9 files changed

+75
-75
lines changed

src/Core__List.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ function every2(l1, l2, p) {
969969
};
970970
}
971971

972-
function cmpByLength(_l1, _l2) {
972+
function compareLength(_l1, _l2) {
973973
while(true) {
974974
var l2 = _l2;
975975
var l1 = _l1;
@@ -989,7 +989,7 @@ function cmpByLength(_l1, _l2) {
989989
};
990990
}
991991

992-
function cmp(l1, l2, f) {
992+
function compare(l1, l2, f) {
993993
var _l1 = l1;
994994
var _l2 = l2;
995995
var p = Curry.__2(f);
@@ -1016,7 +1016,7 @@ function cmp(l1, l2, f) {
10161016
};
10171017
}
10181018

1019-
function eq(l1, l2, f) {
1019+
function equal(l1, l2, f) {
10201020
var _l1 = l1;
10211021
var _l2 = l2;
10221022
var p = Curry.__2(f);
@@ -1386,9 +1386,9 @@ export {
13861386
some ,
13871387
every2 ,
13881388
some2 ,
1389-
cmpByLength ,
1390-
cmp ,
1391-
eq ,
1389+
compareLength ,
1390+
compare ,
1391+
equal ,
13921392
has ,
13931393
getBy ,
13941394
filter ,

src/Core__List.res

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -680,43 +680,43 @@ let rec every2U = (l1, l2, p) =>
680680

681681
let every2 = (l1, l2, p) => every2U(l1, l2, (. a, b) => p(a, b))
682682

683-
let rec cmpByLength = (l1, l2) =>
683+
let rec compareLength = (l1, l2) =>
684684
switch (l1, l2) {
685685
| (list{}, list{}) => 0
686686
| (_, list{}) => 1
687687
| (list{}, _) => -1
688-
| (list{_, ...l1s}, list{_, ...l2s}) => cmpByLength(l1s, l2s)
688+
| (list{_, ...l1s}, list{_, ...l2s}) => compareLength(l1s, l2s)
689689
}
690690

691-
let rec cmpU = (l1, l2, p) =>
691+
let rec compareU = (l1, l2, p) =>
692692
switch (l1, l2) {
693693
| (list{}, list{}) => 0
694694
| (_, list{}) => 1
695695
| (list{}, _) => -1
696696
| (list{a1, ...l1}, list{a2, ...l2}) =>
697697
let c = p(. a1, a2)
698698
if c == 0 {
699-
cmpU(l1, l2, p)
699+
compareU(l1, l2, p)
700700
} else {
701701
c
702702
}
703703
}
704704

705-
let cmp = (l1, l2, f) => cmpU(l1, l2, (. x, y) => f(x, y))
705+
let compare = (l1, l2, f) => compareU(l1, l2, (. x, y) => f(x, y))
706706

707-
let rec eqU = (l1, l2, p) =>
707+
let rec equalU = (l1, l2, p) =>
708708
switch (l1, l2) {
709709
| (list{}, list{}) => true
710710
| (_, list{})
711711
| (list{}, _) => false
712712
| (list{a1, ...l1}, list{a2, ...l2}) =>
713713
if p(. a1, a2) {
714-
eqU(l1, l2, p)
714+
equalU(l1, l2, p)
715715
} else {
716716
false
717717
}
718718
}
719-
let eq = (l1, l2, f) => eqU(l1, l2, (. x, y) => f(x, y))
719+
let equal = (l1, l2, f) => equalU(l1, l2, (. x, y) => f(x, y))
720720

721721
let rec some2U = (l1, l2, p) =>
722722
switch (l1, l2) {

src/Core__List.resi

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -615,24 +615,24 @@ List.some2(list{0, 1}, list{5, 0}, (a, b) => a > b) // true
615615
let some2: (t<'a>, t<'b>, ('a, 'b) => bool) => bool
616616

617617
/**
618-
`cmpByLength(list1, list2)` compare two lists solely by length. Returns `-1` if
618+
`compareLength(list1, list2)` compare two lists solely by length. Returns `-1` if
619619
`length(list1)` is less than `length(list2)`, `0` if `length(list1)` equals
620620
`length(list2)`, and `1` if `length(list1)` is greater than `length(list2)`.
621621
622622
## Examples
623623
624624
```rescript
625-
List.cmpByLength(list{1, 2}, list{3, 4, 5, 6}) // -1
625+
List.compareLength(list{1, 2}, list{3, 4, 5, 6}) // -1
626626
627-
List.cmpByLength(list{1, 2, 3}, list{4, 5, 6}) // 0
627+
List.compareLength(list{1, 2, 3}, list{4, 5, 6}) // 0
628628
629-
List.cmpByLength(list{1, 2, 3, 4}, list{5, 6}) // 1
629+
List.compareLength(list{1, 2, 3, 4}, list{5, 6}) // 1
630630
```
631631
*/
632-
let cmpByLength: (t<'a>, t<'a>) => int
632+
let compareLength: (t<'a>, t<'a>) => int
633633

634634
/**
635-
`cmp(list1, list2, f)` compare elements one by one `f`. `f` returns a negative
635+
`compare(list1, list2, f)` compare elements one by one `f`. `f` returns a negative
636636
number if `list1` is "less than" `list2`, zero if `list1` is "equal to" `list2`,
637637
a positive number if `list1` is "greater than" `list2`.
638638
@@ -645,40 +645,40 @@ zero for all `list1` and `list2`.
645645
## Examples
646646
647647
```rescript
648-
List.cmp(list{3}, list{3, 7}, (a, b) => compare(a, b)) /* (-1) */
648+
List.compare(list{3}, list{3, 7}, (a, b) => compare(a, b)) /* (-1) */
649649
650-
List.cmp(list{5, 3}, list{5}, (a, b) => compare(a, b)) /* 1 */
650+
List.compare(list{5, 3}, list{5}, (a, b) => compare(a, b)) /* 1 */
651651
652-
List.cmp(list{1, 3, 5}, list{1, 4, 2}, (a, b) => compare(a, b)) /* (-1) */
652+
List.compare(list{1, 3, 5}, list{1, 4, 2}, (a, b) => compare(a, b)) /* (-1) */
653653
654-
List.cmp(list{1, 3, 5}, list{1, 2, 3}, (a, b) => compare(a, b)) /* 1 */
654+
List.compare(list{1, 3, 5}, list{1, 2, 3}, (a, b) => compare(a, b)) /* 1 */
655655
656-
List.cmp(list{1, 3, 5}, list{1, 3, 5}, (a, b) => compare(a, b)) /* 0 */
656+
List.compare(list{1, 3, 5}, list{1, 3, 5}, (a, b) => compare(a, b)) /* 0 */
657657
```
658658
659659
**Please note:** The total ordering of List is different from Array,
660660
for Array, we compare the length first and, only if the lengths are equal, elements one by one.
661661
For lists, we just compare elements one by one.
662662
*/
663-
let cmp: (t<'a>, t<'a>, ('a, 'a) => int) => int
663+
let compare: (t<'a>, t<'a>, ('a, 'a) => int) => int
664664

665665
/**
666-
`eq(list1, list2, f)` check equality of `list2` and `list2` using `f` for
666+
`equal(list1, list2, f)` check equality of `list2` and `list2` using `f` for
667667
equality on elements, where `f` is a function that returns `true` if items `x` and
668-
`y` meet some criterion for equality, `false` otherwise. eq `false` if length
668+
`y` meet some criterion for equality, `false` otherwise. equal `false` if length
669669
of `list1` and `list2` are not the same.
670670
671671
## Examples
672672
673673
```rescript
674-
List.eq(list{1, 2, 3}, list{1, 2}, (a, b) => a == b) // false
674+
List.equal(list{1, 2, 3}, list{1, 2}, (a, b) => a == b) // false
675675
676-
List.eq(list{1, 2}, list{1, 2}, (a, b) => a == b) // true
676+
List.equal(list{1, 2}, list{1, 2}, (a, b) => a == b) // true
677677
678-
List.eq(list{1, 2, 3}, list{(-1), (-2), (-3)}, (a, b) => abs(a) == abs(b)) // true
678+
List.equal(list{1, 2, 3}, list{(-1), (-2), (-3)}, (a, b) => abs(a) == abs(b)) // true
679679
```
680680
*/
681-
let eq: (t<'a>, t<'a>, ('a, 'a) => bool) => bool
681+
let equal: (t<'a>, t<'a>, ('a, 'a) => bool) => bool
682682

683683
/**
684684
`has(list, element, f)` returns `true` if the list contains at least one

src/Core__Option.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function isNone(x) {
7878
return x === undefined;
7979
}
8080

81-
function eq(a, b, f) {
81+
function equal(a, b, f) {
8282
var f$1 = Curry.__2(f);
8383
if (a !== undefined) {
8484
if (b !== undefined) {
@@ -91,7 +91,7 @@ function eq(a, b, f) {
9191
}
9292
}
9393

94-
function cmp(a, b, f) {
94+
function compare(a, b, f) {
9595
var f$1 = Curry.__2(f);
9696
if (a !== undefined) {
9797
if (b !== undefined) {
@@ -117,7 +117,7 @@ export {
117117
orElse ,
118118
isSome ,
119119
isNone ,
120-
eq ,
121-
cmp ,
120+
equal ,
121+
compare ,
122122
}
123123
/* No side effect */

src/Core__Option.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ let isSome = x =>
9090

9191
let isNone = x => x == None
9292

93-
let eqU = (a, b, f) =>
93+
let equalU = (a, b, f) =>
9494
switch a {
9595
| Some(a) =>
9696
switch b {
@@ -100,14 +100,14 @@ let eqU = (a, b, f) =>
100100
| None => b == None
101101
}
102102

103-
let eq = (a, b, f) => eqU(a, b, (. x, y) => f(x, y))
103+
let equal = (a, b, f) => equalU(a, b, (. x, y) => f(x, y))
104104

105-
let cmpU = (a, b, f) =>
105+
let compareU = (a, b, f) =>
106106
switch (a, b) {
107107
| (Some(a), Some(b)) => f(. a, b)
108108
| (None, Some(_)) => -1
109109
| (Some(_), None) => 1
110110
| (None, None) => 0
111111
}
112112

113-
let cmp = (a, b, f) => cmpU(a, b, (. x, y) => f(x, y))
113+
let compare = (a, b, f) => compareU(a, b, (. x, y) => f(x, y))

src/Core__Option.resi

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ Option.isNone(Some(1)) // false
198198
let isNone: option<'a> => bool
199199

200200
/**
201-
`eq(opt1, opt2, f)` evaluates two optional values for equality with respect to a predicate function `f`. If both `opt1` and `opt2` are `None`, returns `true`.
201+
`equal(opt1, opt2, f)` evaluates two optional values for equality with respect to a predicate function `f`. If both `opt1` and `opt2` are `None`, returns `true`.
202202
If one of the arguments is `Some(value)` and the other is `None`, returns
203203
`false`.
204204
If arguments are `Some(value1)` and `Some(value2)`, returns the result of
@@ -211,16 +211,16 @@ let clockEqual = (a, b) => mod(a, 12) == mod(b, 12)
211211
212212
open Option
213213
214-
eq(Some(3), Some(15), clockEqual) // true
215-
eq(Some(3), None, clockEqual) // false
216-
eq(None, Some(3), clockEqual) // false
217-
eq(None, None, clockEqual) // true
214+
equal(Some(3), Some(15), clockEqual) // true
215+
equal(Some(3), None, clockEqual) // false
216+
equal(None, Some(3), clockEqual) // false
217+
equal(None, None, clockEqual) // true
218218
```
219219
*/
220-
let eq: (option<'a>, option<'b>, ('a, 'b) => bool) => bool
220+
let equal: (option<'a>, option<'b>, ('a, 'b) => bool) => bool
221221

222222
/**
223-
`cmp(opt1, opt2, f)` compares two optional values with respect to given `f`.
223+
`compare(opt1, opt2, f)` compares two optional values with respect to given `f`.
224224
225225
If both `opt1` and `opt2` are `None`, it returns `0`. If the first argument is `Some(value1)` and the second is `None`, returns `1` (something is greater than nothing).
226226
@@ -239,12 +239,12 @@ let clockCompare = (a, b) => compare(mod(a, 12), mod(b, 12))
239239
240240
open Option
241241
242-
cmp(Some(3), Some(15), clockCompare) // 0
243-
cmp(Some(3), Some(14), clockCompare) // 1
244-
cmp(Some(2), Some(15), clockCompare) // (-1)
245-
cmp(None, Some(15), clockCompare) // (-1)
246-
cmp(Some(14), None, clockCompare) // 1
247-
cmp(None, None, clockCompare) // 0
242+
compare(Some(3), Some(15), clockCompare) // 0
243+
compare(Some(3), Some(14), clockCompare) // 1
244+
compare(Some(2), Some(15), clockCompare) // (-1)
245+
compare(None, Some(15), clockCompare) // (-1)
246+
compare(Some(14), None, clockCompare) // 1
247+
compare(None, None, clockCompare) // 0
248248
```
249249
*/
250-
let cmp: (option<'a>, option<'b>, ('a, 'b) => int) => int
250+
let compare: (option<'a>, option<'b>, ('a, 'b) => int) => int

src/Core__Result.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function isError(x) {
7272
}
7373
}
7474

75-
function eq(a, b, f) {
75+
function equal(a, b, f) {
7676
var f$1 = Curry.__2(f);
7777
if (a.TAG === /* Ok */0) {
7878
if (b.TAG === /* Ok */0) {
@@ -87,7 +87,7 @@ function eq(a, b, f) {
8787
}
8888
}
8989

90-
function cmp(a, b, f) {
90+
function compare(a, b, f) {
9191
var f$1 = Curry.__2(f);
9292
if (a.TAG === /* Ok */0) {
9393
if (b.TAG === /* Ok */0) {
@@ -117,8 +117,8 @@ export {
117117
getWithDefault ,
118118
isOk ,
119119
isError ,
120-
eq ,
121-
cmp ,
120+
equal ,
121+
compare ,
122122
forEach ,
123123
}
124124
/* No side effect */

src/Core__Result.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,25 @@ let isError = x =>
7272
| Error(_) => true
7373
}
7474

75-
let eqU = (a, b, f) =>
75+
let equalU = (a, b, f) =>
7676
switch (a, b) {
7777
| (Ok(a), Ok(b)) => f(. a, b)
7878
| (Error(_), Ok(_))
7979
| (Ok(_), Error(_)) => false
8080
| (Error(_), Error(_)) => true
8181
}
8282

83-
let eq = (a, b, f) => eqU(a, b, (. x, y) => f(x, y))
83+
let equal = (a, b, f) => equalU(a, b, (. x, y) => f(x, y))
8484

85-
let cmpU = (a, b, f) =>
85+
let compareU = (a, b, f) =>
8686
switch (a, b) {
8787
| (Ok(a), Ok(b)) => f(. a, b)
8888
| (Error(_), Ok(_)) => -1
8989
| (Ok(_), Error(_)) => 1
9090
| (Error(_), Error(_)) => 0
9191
}
9292

93-
let cmp = (a, b, f) => cmpU(a, b, (. x, y) => f(x, y))
93+
let compare = (a, b, f) => compareU(a, b, (. x, y) => f(x, y))
9494

9595
let forEach = (r, f) =>
9696
switch r {

0 commit comments

Comments
 (0)