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

Deprecate findin(a, b) in favor or find(occursin(b), a) #24967

Closed
nalimilan opened this issue Dec 7, 2017 · 8 comments
Closed

Deprecate findin(a, b) in favor or find(occursin(b), a) #24967

nalimilan opened this issue Dec 7, 2017 · 8 comments
Labels
deprecation This change introduces or involves a deprecation search & find The find* family of functions

Comments

@nalimilan
Copy link
Member

nalimilan commented Dec 7, 2017

As part of the unification of search and find functions (#10593), we should deprecate findin(a, b) in favor of the more explicit find(occursin(b), a), which is equivalent to find(x -> x in b, a). occursin is already implemented in #24673.

@nalimilan nalimilan added the search & find The find* family of functions label Dec 7, 2017
@ararslan ararslan added the deprecation This change introduces or involves a deprecation label Dec 7, 2017
@gabrielgellner
Copy link
Contributor

oh man occursin is hard to parse for me, I just naturally break occur_sin visually. Bases hatred of underscores can be rough. The logic of this on the other hand is super sweet.

@StefanKarpinski
Copy link
Sponsor Member

StefanKarpinski commented Dec 8, 2017

We could have a single-argument in(v) that does what occursin(v) does – it reads naturally, and I'm not sure what else it could possibly mean. It's slightly strange to do reverse currying, but 🤷‍♂️

@rfourquet
Copy link
Member

We could have a single-argument in(v)

💯 It seems very natural to me, and FWIW, I introduced _in to do just that in a PR

@nalimilan
Copy link
Member Author

That's tempting, but I'd rather have a general plan regarding currying functions, as it could be really confusing to have that (reverse) currying function if we don't do that more systematically. For example, we now have equalto(x), which could be replaced with ==(x) in the same vein.

@stevengj also proposed find(_ in c, x), pointing at #5571.

@stevengj
Copy link
Member

stevengj commented Dec 8, 2017

See #24990 for an implementation of find(_ in c, x) etcetera.

@nalimilan
Copy link
Member Author

Actually, something like occursin is needed so that we can dispatch to more efficient methods than the default linear search. We can't do that with custom anonymous functions.

I've added a commit replacing findin(a, b) with find(occursin(b), a) to #24673.

@musm
Copy link
Contributor

musm commented Dec 16, 2017

oh man occursin is hard to parse for me, I just naturally break occur_sin visually. Bases hatred of underscores can be rough. The logic of this on the other hand is super sweet.

Same here, every time I see this I too parse this as occur_sin . Is there perhaps a nicer synonym for such a function: occurs_in, occurin appearin locatedin inside (throwing some names out there)?

@JeffBezanson
Copy link
Sponsor Member

Fixed by #24673.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation search & find The find* family of functions
Projects
None yet
Development

No branches or pull requests

8 participants