Add [Float.]Array.{equal.compare} - #13836
Conversation
Technically, there is: |
Yes that's what happend, a dependency on |
nojb
left a comment
There was a problem hiding this comment.
LGTM, but I would avoid the exception.
A second approval from a core dev is needed to move forward with the PR.
|
Thanks @nojb for the review. Your comments have been addressed. |
|
Not sure what happend with the CI of MSVC / clang-cl 64 bits: |
gasche
left a comment
There was a problem hiding this comment.
This looks nice to me as well.
Note: adding Array.compare may break code in the ecosystem that uses stdlib compare in an Array.(...) context, but this breakage would result in an type error and can be fixed in a backward-compatible way.
At least on the sherlocode corpus of OCaml code and assuming this happens on a single line, this doesn't seem to happen. |
|
I think this could be merged. |
|
Thanks for the ping! |
As the title says. Two notes for reviewers:
It seems that
test_array.mluses snapshot testing. I don't think it's that great for testing this kind of library code. So you may find the test structure a bit at odds (but if an assert fails the empty expectation fails).There's a bit of tricky stuff around
comparewhose naked incarnation is used byArray.mem(andFloat.Array.memwhich usesFloat.compare) which is bellow thecompareaddition. Since there's currently no dependency onStdlibinarray.mlI prefered not to useStdlib.comparebut rename it locally. If that's a dependency that is fine to introduce I can change that. Looking forward to Add a Repr module to the standard library #13755P.S. Contributing functions to
Arrayis painfull, between the label madness andFloat.Arrayone spends most time bureaucratizing around and c&p code :-(