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

add contains (argument flipped occursin) #35132

Merged
merged 4 commits into from Apr 16, 2020

Conversation

oxinabox
Copy link
Contributor

closes #35031
See issue for discussion.

Includes curried form per convention in #35052

in 2.0 we may want to remove occursin

@JeffBezanson JeffBezanson added the triage This should be discussed on a triage call label Mar 16, 2020
@JeffBezanson
Copy link
Sponsor Member

Triage is ok with this.

@JeffBezanson JeffBezanson removed the triage This should be discussed on a triage call label Mar 19, 2020
@oxinabox
Copy link
Contributor Author

Is this ready for merge?

@oxinabox
Copy link
Contributor Author

oxinabox commented Apr 6, 2020

bump

1 similar comment
@oxinabox
Copy link
Contributor Author

bump

@StefanKarpinski StefanKarpinski merged commit cc6e121 into JuliaLang:master Apr 16, 2020
@oxinabox oxinabox deleted the ox/contains branch April 16, 2020 22:27
@musm
Copy link
Contributor

musm commented Apr 17, 2020

Thanks for this!

@o314
Copy link
Contributor

o314 commented Jun 26, 2022

Does this really a different function than in ?
Now, we have

using Test
@test 6 |> in(1:10)
@test "JuliaLang" |> startswith(r"Julia|Romeo")
@test_broken "aba" |> in(r"a.a") # will throw
@test "aba" |> contains(r"a.a")

Why do we not allow ?

using Test
using Test
@test 6 |> in(1:10)
@test "JuliaLang" |> startswith(r"Julia|Romeo")
@test"aba" |> in(r"a.a")

@oxinabox
Copy link
Contributor Author

oxinabox commented Aug 2, 2022

In is for elements, contains is for substrings.

@o314
Copy link
Contributor

o314 commented Aug 2, 2022

It is not in the essence of multidispatch to specialize function name according to type. Then we can talk for hours of what is a type.
If it is about subsetting there is issubset.
There is already in, but also issubset, occursin the badly named ismatch.
Adding one at time more and more naming - close, but not exactly the same, but how much, not sure - kill slowly the power of multidispatch .

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.

Bring back contains(haystack, needle)
5 participants