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

Duck type the function in map, reduce, etc. #10314

Merged
merged 2 commits into from
Mar 1, 2015
Merged

Conversation

timholy
Copy link
Sponsor Member

@timholy timholy commented Feb 24, 2015

Replacement of #10312 without all the cs. Seems that if you force-push before reopening the issue, GitHub gets unhappy.

filter!(r::Regex, v) = filter!(x->ismatch(r,x), v)
filter(r::Regex, v) = filter(x->ismatch(r,x), v)

filter!(r::Regex, d::Dict) = filter!((k,v)->ismatch(r,k),d)
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this would need a deprecation, since filter on Dicts expects a 2-argument function. Or I guess we could add a call overload for Regex with 2 extra arguments, but that seems too magical since it really only makes sense for this use case.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@timholy
Copy link
Sponsor Member Author

timholy commented Feb 25, 2015

We're green. OK to merge?

timholy added a commit that referenced this pull request Mar 1, 2015
Duck type the function in map, reduce, etc.
@timholy timholy merged commit 3782d2f into master Mar 1, 2015
@timholy timholy deleted the teh/ducktype_functions2 branch March 1, 2015 13:46
@hayd
Copy link
Member

hayd commented Mar 1, 2015

@timholy I think there was a rebase issue here over #10334 (hence the surprisingly large diff).

@timholy
Copy link
Sponsor Member Author

timholy commented Mar 1, 2015

Oh crap. I'll try to straighten this out. Thanks for catching it.

@timholy
Copy link
Sponsor Member Author

timholy commented Mar 1, 2015

OK, it looks like it was simply that one file (git managed the conflict by keeping the file). Fixed in 74c71fb.

@ivarne
Copy link
Sponsor Member

ivarne commented Mar 1, 2015

@timholy Did you have any changes to DArray that might be relevant in https://github.com/JuliaParallel/DistributedArrays.jl?

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.

4 participants