Open
Conversation
c85dd06 to
f90a657
Compare
janmasrovira
reviewed
Nov 7, 2024
Stdlib/Data/List/Base.juvix
Outdated
Comment on lines
+21
to
+22
| find {A} (predicate : A -> Bool) : (list : List A) -> Maybe A := | ||
| filter predicate >> headMaybe; |
Collaborator
There was a problem hiding this comment.
in a strict language such as juvix this is less efficient than before, because we always traverse the whole list, even if the first element satisfies the predicate
Member
Author
There was a problem hiding this comment.
Ahh true, I forgot about that here, good catch
Member
Author
There was a problem hiding this comment.
I think this comment alone is enough to just remove the last commit and merge in the headMaybe function alone.
Member
Author
There was a problem hiding this comment.
I've force pushed an update to remove the find commit
f90a657 to
a567cf1
Compare
The naming on this is probably bad, I'd assume `head` would return Maybe, and you'd have a headDefault or something for a default head
a567cf1 to
e124c13
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
findis justfilterwhere we call a maybe head. This topic simply does that.