Skip to content

Commit

Permalink
avoid Any32 type in filter for tuples. fixes #42236
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored and KristofferC committed Sep 28, 2021
1 parent 11ed8e1 commit 36d090c
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

0 comments on commit 36d090c

Please sign in to comment.