I’m working on a Julia project and I’ve defined a custom function with operator overloading. My function, which I’ve defined using the |
operator, initializes a matrix of Box
objects with properties derived from a parent Box
. Here is my function definition:
function |(ChildBox::Matrix{Box}, ParentBox::Box; Ratio::Matrix{T} where {T<:Real}=ones(size(ChildBox)))
println(Ratio)
.
#function definition
.
end
I want to call this function using the operator style. The call B2 | B1[1,1]
works fine. However, I also want to pass the optional Ratio
argument in the operator style, something like B2 | B1[1,1]; Ratio=[1 2 1; 2 4 2]
.
How can I achieve this in Julia? Is there a way to properly call the overloaded operator with an optional argument in this manner?