Skip to content

x/exp/slices: add ContainsFunc #53983

Closed
Closed
@GRbit

Description

@GRbit

During the design of the slices package ContainsFunc function was dropped at the time of discussion (#47203 (comment)). Briefly, the discussion was about the signature of the function and how often it is used.

I suggest finally making ContainsFunc, since we have Contains, so it will be consistent to have ContainsFunc as well. Also, it's just convenient to have such a function. Talking about the signature, for me, it's reasonable to make it the same as for IndexFunc: ContainsFunc[E comparable](s []E, f func(E) bool) bool

Note:
I've created a PR for this change because I'm new here and didn't know that such change needs a proposal. In case you are curious – here it is: golang/exp#39

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions