These two provide the same "functionality"
fna(x) = true
struct fnb end
fnb(x) = true
Is it possible to dispatch in a way that catches both?
You can define
struct fnb <: Function
end
and dispatch on ::Function
.
great and good to know
Sometimes Base.Callable == Union{Function,Type}
is also used for this purpose.
Last updated: Nov 06 2024 at 04:40 UTC