@@ -241,7 +241,7 @@ function iterate(itr::SkipMissing, state...)
241
241
y = iterate (itr. x, state... )
242
242
y === nothing && return nothing
243
243
item, state = y
244
- while item === missing
244
+ while ismissing ( item)
245
245
y = iterate (itr. x, state)
246
246
y === nothing && return nothing
247
247
item, state = y
@@ -251,12 +251,12 @@ end
251
251
252
252
IndexStyle (:: Type{<:SkipMissing{T}} ) where {T} = IndexStyle (T)
253
253
eachindex (itr:: SkipMissing ) =
254
- Iterators. filter (i -> @inbounds (itr. x[i]) != = missing , eachindex (itr. x))
254
+ Iterators. filter (i -> ! ismissing ( @inbounds (itr. x[i])) , eachindex (itr. x))
255
255
keys (itr:: SkipMissing ) =
256
- Iterators. filter (i -> @inbounds (itr. x[i]) != = missing , keys (itr. x))
256
+ Iterators. filter (i -> ! ismissing ( @inbounds (itr. x[i])) , keys (itr. x))
257
257
@propagate_inbounds function getindex (itr:: SkipMissing , I... )
258
258
v = itr. x[I... ]
259
- v === missing && throw (MissingException (LazyString (" the value at index " , I, " is missing" )))
259
+ ismissing (v) && throw (MissingException (LazyString (" the value at index " , I, " is missing" )))
260
260
v
261
261
end
262
262
@@ -280,18 +280,18 @@ function _mapreduce(f, op, ::IndexLinear, itr::SkipMissing{<:AbstractArray})
280
280
ilast = last (inds)
281
281
for outer i in i: ilast
282
282
@inbounds ai = A[i]
283
- ai != = missing && break
283
+ ! ismissing (ai) && break
284
284
end
285
- ai === missing && return mapreduce_empty (f, op, eltype (itr))
285
+ ismissing (ai) && return mapreduce_empty (f, op, eltype (itr))
286
286
a1:: eltype (itr) = ai
287
287
i == typemax (typeof (i)) && return mapreduce_first (f, op, a1)
288
288
i += 1
289
289
ai = missing
290
290
for outer i in i: ilast
291
291
@inbounds ai = A[i]
292
- ai != = missing && break
292
+ ! ismissing (ai) && break
293
293
end
294
- ai === missing && return mapreduce_first (f, op, a1)
294
+ ismissing (ai) && return mapreduce_first (f, op, a1)
295
295
# We know A contains at least two non-missing entries: the result cannot be nothing
296
296
something (mapreduce_impl (f, op, itr, first (inds), last (inds)))
297
297
end
@@ -309,7 +309,7 @@ mapreduce_impl(f, op, A::SkipMissing, ifirst::Integer, ilast::Integer) =
309
309
return nothing
310
310
elseif ifirst == ilast
311
311
@inbounds a1 = A[ifirst]
312
- if a1 === missing
312
+ if ismissing (a1)
313
313
return nothing
314
314
else
315
315
return Some (mapreduce_first (f, op, a1))
@@ -320,25 +320,25 @@ mapreduce_impl(f, op, A::SkipMissing, ifirst::Integer, ilast::Integer) =
320
320
i = ifirst
321
321
for outer i in i: ilast
322
322
@inbounds ai = A[i]
323
- ai != = missing && break
323
+ ! ismissing (ai) && break
324
324
end
325
- ai === missing && return nothing
325
+ ismissing (ai) && return nothing
326
326
a1 = ai:: eltype (itr)
327
327
i == typemax (typeof (i)) && return Some (mapreduce_first (f, op, a1))
328
328
i += 1
329
329
ai = missing
330
330
for outer i in i: ilast
331
331
@inbounds ai = A[i]
332
- ai != = missing && break
332
+ ! ismissing (ai) && break
333
333
end
334
- ai === missing && return Some (mapreduce_first (f, op, a1))
334
+ ismissing (ai) && return Some (mapreduce_first (f, op, a1))
335
335
a2 = ai:: eltype (itr)
336
336
i == typemax (typeof (i)) && return Some (op (f (a1), f (a2)))
337
337
i += 1
338
338
v = op (f (a1), f (a2))
339
339
@simd for i = i: ilast
340
340
@inbounds ai = A[i]
341
- if ai != = missing
341
+ if ! ismissing (ai)
342
342
v = op (v, f (ai))
343
343
end
344
344
end
@@ -384,7 +384,7 @@ julia> filter(isodd, skipmissing(x))
384
384
function filter (f, itr:: SkipMissing{<:AbstractArray} )
385
385
y = similar (itr. x, eltype (itr), 0 )
386
386
for xi in itr. x
387
- if xi != = missing && f (xi)
387
+ if ! ismissing (xi) && f (xi)
388
388
push! (y, xi)
389
389
end
390
390
end
@@ -450,7 +450,7 @@ ERROR: `b` is still missing
450
450
macro coalesce (args... )
451
451
expr = :(missing )
452
452
for arg in reverse (args)
453
- expr = :(( val = $ arg) != = missing ? val : $ expr)
453
+ expr = :(! ismissing (( val = $ ( esc ( arg));)) ? val : $ expr)
454
454
end
455
- return esc ( :(let val; $ expr; end ) )
455
+ return :(let val; $ expr; end )
456
456
end
0 commit comments