Extend Base.&

question

#1

Is it possible to extend Base.&.

i.e.

function &(my_stuct_a, my_struct_b)
    # Some Code
end

It throws error

ERROR: syntax: expected "(" in function definition

And then, attempting

function Base.&(my_stuct_a, my_struct_b)
    # Some Code
end

Error: syntax: expected "end" in definition of function  "Base"

#2

Yes, but you need to have Base.:& for it to work.


#3

yes,
but you should import it first

julia> import Base: (&)

julia> function (&)(my_stuct_a, my_struct_b)
# some code
end
& (generic function with 17 methods)


#4

You can also do:

function Base.:&(a::String, b::String)
...
end