Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bring back contains(haystack, needle) #35031

Closed
oxinabox opened this issue Mar 6, 2020 · 2 comments · Fixed by #35132
Closed

Bring back contains(haystack, needle) #35031

oxinabox opened this issue Mar 6, 2020 · 2 comments · Fixed by #35132

Comments

@oxinabox
Copy link
Contributor

oxinabox commented Mar 6, 2020

Right now we have:

  • startswith(haystack, needle)
  • endswith(haystack, needle)
  • and occursin(needle, haystack)

While occursin(needle, haystack) is right from the perspective of reading
f(a, b) as a f b
i.e. needle occursin haystack

It is not consistent with startwith or endswith.

Back in julia 0.6 (IIRC) we had contains(haystack, needle)
which still reads right: haystack contains needle.

I would like to suggest we bring it back so that we can have that consistency.


This is part of a series of issues relating to invenia/Wrangling.jl#3
Will link others below for cross referencing.
#35032
#35033

@StefanKarpinski
Copy link
Member

Yes, I miss this a lot. IIRC, the reason we settled on occursin was that we were worried that contains(haystack, needle) confusing element containment with subsequence containment, but I think we already mix that up a bit so maybe it doesn't matter.

@oxinabox
Copy link
Contributor Author

oxinabox commented Mar 10, 2020

Ok I will make the PR to add contains after #35052 is merged
because I think it should also match startwith and endswith having curried versions.

Since it will follow that pattern

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants