You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's common to see people do e.g. filter(i -> isodd(i), arr). This is unidiomatic and should be filter(isodd, arr). It seems like it should be easy to add to the linter.
The text was updated successfully, but these errors were encountered:
I think this problem may not be as easy as it seems at first hand, because any type may be callable in Julia and the proposed suggestion only makes sense in general for Function subtypes.
For example:
julia> struct S end
julia> (::S)() = 3
julia> s = S()
S()
julia> f = (() -> s())
#1 (generic function with 1 method)
julia> s() == f()
true
julia> s isa Function
false
julia> f isa Function
true
This is only relevant when the higher order function the functor is passed to has a strict type constraints on Function (instead of e.g. Base.Callable).
This is only relevant when the higher order function the functor is passed to has a strict type constraints on Function
Yes, but this isn't "only" as far as I see. Furthermore, the constraint doesn't need to be on the direct callee - you'd have to check all potential indirect callees for such constraints.
It's common to see people do e.g.
filter(i -> isodd(i), arr)
. This is unidiomatic and should befilter(isodd, arr)
. It seems like it should be easy to add to the linter.The text was updated successfully, but these errors were encountered: