response to CR
Value: [1e-3 to 4e-3]
This commit is contained in:
parent
5b1ee7f0a6
commit
4ff14db6f3
|
@ -1,3 +1,7 @@
|
||||||
|
/*
|
||||||
|
Some functions from modules `L`, `O`, and `R` below were copied directly from
|
||||||
|
running `rescript convert -all` on Rationale https://github.com/jonlaing/rationale
|
||||||
|
*/
|
||||||
module FloatFloatMap = {
|
module FloatFloatMap = {
|
||||||
module Id = Belt.Id.MakeComparable({
|
module Id = Belt.Id.MakeComparable({
|
||||||
type t = float
|
type t = float
|
||||||
|
@ -335,6 +339,9 @@ module JsDate = {
|
||||||
|
|
||||||
/* List */
|
/* List */
|
||||||
module L = {
|
module L = {
|
||||||
|
module Util = {
|
||||||
|
let eq = (a, b) => a == b
|
||||||
|
}
|
||||||
let fmap = List.map
|
let fmap = List.map
|
||||||
let get = Belt.List.get
|
let get = Belt.List.get
|
||||||
let toArray = Array.of_list
|
let toArray = Array.of_list
|
||||||
|
@ -397,11 +404,9 @@ module L = {
|
||||||
xs,
|
xs,
|
||||||
) |> fst
|
) |> fst
|
||||||
|
|
||||||
module Util = {
|
|
||||||
let eq = (a, b) => a == b
|
|
||||||
}
|
|
||||||
let uniqBy = (f, xs) => uniqWithBy(Util.eq, f, xs)
|
let uniqBy = (f, xs) => uniqWithBy(Util.eq, f, xs)
|
||||||
let join = j => List.fold_left((acc, v) => String.length(acc) == 0 ? v : acc ++ (j ++ v), "")
|
let join = j => List.fold_left((acc, v) => String.length(acc) == 0 ? v : acc ++ (j ++ v), "")
|
||||||
|
|
||||||
let head = xs =>
|
let head = xs =>
|
||||||
switch List.hd(xs) {
|
switch List.hd(xs) {
|
||||||
| exception _ => None
|
| exception _ => None
|
||||||
|
@ -409,17 +414,12 @@ module L = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let uniq = xs => uniqBy(x => x, xs)
|
let uniq = xs => uniqBy(x => x, xs)
|
||||||
|
|
||||||
let flatten = List.flatten
|
let flatten = List.flatten
|
||||||
let last = xs => xs |> List.rev |> head
|
let last = xs => xs |> List.rev |> head
|
||||||
|
|
||||||
let append = List.append
|
let append = List.append
|
||||||
let getBy = Belt.List.getBy
|
let getBy = Belt.List.getBy
|
||||||
|
|
||||||
let dropLast = (i, xs) => take(List.length(xs) - i, xs)
|
let dropLast = (i, xs) => take(List.length(xs) - i, xs)
|
||||||
|
|
||||||
let containsWith = f => List.exists(f)
|
let containsWith = f => List.exists(f)
|
||||||
|
|
||||||
let contains = x => containsWith(Util.eq(x))
|
let contains = x => containsWith(Util.eq(x))
|
||||||
|
|
||||||
let reject = pred => List.filter(x => !pred(x))
|
let reject = pred => List.filter(x => !pred(x))
|
||||||
|
@ -453,10 +453,9 @@ module L = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let without = (exclude, xs) => reject(x => contains(x, exclude), xs)
|
let without = (exclude, xs) => reject(x => contains(x, exclude), xs)
|
||||||
|
|
||||||
let update = (x, i, xs) => adjust(F.always(x), i, xs)
|
let update = (x, i, xs) => adjust(F.always(x), i, xs)
|
||||||
|
|
||||||
let iter = List.iter
|
let iter = List.iter
|
||||||
|
|
||||||
let findIndex = {
|
let findIndex = {
|
||||||
let rec loop = (pred, xs, i) =>
|
let rec loop = (pred, xs, i) =>
|
||||||
switch xs {
|
switch xs {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user