We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
only
1 parent f1ab042 commit 0eeac7aCopy full SHA for 0eeac7a
src/util.jl
@@ -455,4 +455,18 @@ Loess.loess(x::AbstractVector, y::AbstractVector; kwargs...) =
455
loess(collect.(zip(promote.(x,y)...))...; kwargs...)
456
457
458
-expnorm(x) = exp.(x .- maximum(x))
+expnorm(x) = exp.(x .- maximum(x))
459
+
460
+if VERSION<v"1.4"
461
+ Base.@propagate_inbounds function only(x)
462
+ i = iterate(x)
463
+ @boundscheck if i === nothing
464
+ throw(ArgumentError("Collection is empty, must contain exactly 1 element"))
465
+ end
466
+ (ret, state) = i
467
+ @boundscheck if iterate(x, state) !== nothing
468
+ throw(ArgumentError("Collection has multiple elements, must contain exactly 1 element"))
469
470
+ return ret
471
472
+end
0 commit comments