From ea6f2e340b67b5993790dda4eb870cd09f4144b2 Mon Sep 17 00:00:00 2001 From: matthias314 Date: Mon, 2 Sep 2024 09:10:34 -0400 Subject: [PATCH] defined generic `in` in terms of `any` --- base/operators.jl | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/base/operators.jl b/base/operators.jl index d01902e302359..98066d2367aad 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -1356,18 +1356,7 @@ used to implement specialized methods. """ in(x) = Fix2(in, x) -function in(x, itr::Any) - anymissing = false - for y in itr - v = (y == x) - if ismissing(v) - anymissing = true - elseif v - return true - end - end - return anymissing ? missing : false -end +in(x, itr::Any) = any(==(x), itr) # Specialized variant of in for Tuple, which can generate typed comparisons for each element # of the tuple, skipping values that are statically known to be != at compile time.