-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create FS-1135-map-binary-search.md #734
base: main
Are you sure you want to change the base?
Conversation
@KevinRansom @vzarytovskii @abelbraaksma Comments on this please? |
@reinux : I am still thinking of a better self-explainable API, I don't think a tuple of 3 with same types is best. Even though the ordering (previous,match,next) is likely the most natural one here. Just to show another proposal, I have tried to DU-model the outcomes, but I do not think it is any better to your proposal here. The number of possible combinations is an inherent part of binary search if we want this to be a primitive supporting all sorts of scenarios.
|
I like the functionality and the API. |
The more I think about it, the more I'm liking
As for the return type, I think the only option we haven't explored yet is a single-case union with named parameters: type MapSearchResult<'k, 'v> =
MapSearchResult of left: ('k, 'v) option * exact: ('k, 'v) option * right: ('k, 'v) option This would effectively be the same as the tuple version, except that we'd be trading conciseness with some IDE assistance. I'm likewise unsure whether this is the best approach either. |
Rendered RFC