Skip to content
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

Following up on PR 1296, implement both APIs for search_sorted. #1315

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

axch
Copy link
Collaborator

@axch axch commented Jun 23, 2023

Context: #1296 (comment)

The more basic API, still named search_sorted, returns a Post n. The idea is that the elements of xs are fence sections, and we find the position between them (inclusive on either end) where x falls in the ordering.

In terms of this, we now define search_sorted_exact (better name?), which returns a Maybe n, which is the index of an element of xs that equals x exactly, or Nothing if such does not exist.

Also reorder the prelude slightly to try to both maintain semantic groupings and respect name resolution dependencies.

Context: google-research#1296 (comment)

The more basic API, still named `search_sorted`, returns a `Post n`.
The idea is that the elements of `xs` are fence sections, and we find
the position between them (inclusive on either end) where `x` falls in
the ordering.

In terms of this, we now define `search_sorted_exact` (better name?),
which returns a `Maybe n`, which is the index of an element of `xs`
that equals `x` exactly, or `Nothing` if such does not exist.

Also reorder the prelude slightly to try to both maintain semantic
groupings and respect name resolution dependencies.
@axch axch requested a review from dougalm June 23, 2023 16:44
@axch axch merged commit 6d23e46 into google-research:main Jun 23, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant