-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Map filter #11239
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
Map filter #11239
Conversation
This implementation directly uses `:lists`-functionality, which will be fine since its functions are inlined into the module anyway.
About your questions, yes, we don’t need to support iterators and function clause errors are good enough! |
which does not build intermediate closures.
and add compiler annotations.
I believe the implementation is finished. Are there still places where e.g. the formatting of the documentation needs improvement? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just a few documentation formatting thoughts if interested, this looks great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes could improve the documentation a bit.
While the moduledoc for Keyword
specifies that functions don't guarantee ordering, I think maybe it could be good to point that in the new functions as it may be counter intuitive based on the name.
Superfluous newline Co-authored-by: felipe stival <14948182+v0idpwn@users.noreply.github.com>
Co-authored-by: felipe stival <14948182+v0idpwn@users.noreply.github.com>
Co-authored-by: felipe stival <14948182+v0idpwn@users.noreply.github.com>
Co-authored-by: felipe stival <14948182+v0idpwn@users.noreply.github.com>
Co-authored-by: felipe stival <14948182+v0idpwn@users.noreply.github.com>
As per @v0idpwn's suggestion :-)
💚 💙 💜 💛 ❤️ |
Should we document what happens when
(I suppose we might conceivably not want to make any guarantees in this area and just note that collisions in keys will cause all but one instance of the key to be dropped, hinting that maybe one shouldn’t don’t do that.) |
@s3cur3 yes, a PR is welcome! |
PR is based on this proposal.
Map.filter/2
andMap.reject/2
.Keyword.filter/2
andKeyword.reject/2
Map.map/2
Keyword.map/2
Questions:
:maps.filter/2
supports a map iterator as first parameter. As we're not currently exposing map iterators through theMap
module at all, my assumption is that this support is not required forMap.filter/2
etc., simplifying the code a little. Is this correct?:maps.filter/2
's source code has some error handling/decorating. I'm not 100% sure how to convert this to Elixir code. Is this already handled by Elixir's ownFunctionClause
-handling where "function clauses that were tried" are printed? We might be able to remove this line from the implementation, maybe?