struct Relation
n::Int64
R::Set
end
Base.union(r1::Relation,r2::Relation) = if (some condition of r1 and r2) then …
I think when (some condition of r1 and r2) is rather complicated, then I have to explicitly do like the above. However, if I just want to check that r1.n==r2.n, can I do it somewhere on the left hand side?
Also which part of the documentation should I read to get more tips and tricks when working with defining/extending functions like above?
struct Relation{n}
R :: Set
end
Base.union(r1 :: Relation{n}, r2 :: Relation{n}) where n = [...]
Base.union(r1 :: Relation{n1}, r2 :: Relation{n2}) where {n1, n2} = [...]