Skip to content

Commit 72eb681

Browse files
committed
simplify
1 parent 570db21 commit 72eb681

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/array.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ for (mapfunc,∇mapfunc) in [(:map,:∇map),(:pmap,:∇pmap)]
223223
ys = map(first, ys_and_backs)
224224
ys, function (Δ)
225225
isnothing(Δ) && return nothing
226-
if _purefun(F) && length(args) == 1
226+
if Base.issingletontype(F) && length(args) == 1
227227
Δarg = $mapfunc(((_,pb), δ) -> last(pb(δ)), ys_and_backs, Δ) # No unzip needed
228228
(nothing, Δarg)
229-
elseif _purefun(F)
229+
elseif Base.issingletontype(F) # Ensures `f` is pure: nothing captured & no state
230230
Δargs = unzip($mapfunc(((_,pb), δ) -> Base.tail(pb(δ)), ys_and_backs, Δ))
231231
(nothing, Δargs...)
232232
else

0 commit comments

Comments
 (0)