Extending function from Base

Presumably this is in reference to SpecialFunctions.jl#293. If you want to extend a Base method (defined only for integers) with a more general method for other number types, you can simply define:

Base.binomial(x::Number, y::Number) = inv((x+1) * beta(x-y+1, y+1))

(I feel like this is explained in the Julia manual, but I can’t find the section?)

(This is type piracy, but might be acceptable here?)

3 Likes