Skip to content

Commit

Permalink
Merge pull request #42263 from JuliaLang/jb/filter32tuple
Browse files Browse the repository at this point in the history
avoid `Any32` type in `filter` for tuples
  • Loading branch information
JeffBezanson authored Sep 16, 2021
2 parents 1c3c4d8 + 71349b7 commit 5a1b8be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/tuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ end

## filter ##

filter(f, xs::Tuple) = afoldl((ys, x) -> f(x) ? (ys..., x) : ys, (), xs...)
filter_rec(f, xs::Tuple) = afoldl((ys, x) -> f(x) ? (ys..., x) : ys, (), xs...)

# use Array for long tuples
filter(f, t::Any32) = Tuple(filter(f, collect(t)))
filter(f, t::Tuple) = length(t) < 32 ? filter_rec(f, t) : Tuple(filter(f, collect(t)))

## comparison ##

Expand Down

1 comment on commit 5a1b8be

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

Please sign in to comment.