Thanks Simon and Tim.
julia> type MyType
a_1::Float64
a_2::Float64
end
julia> using Base.Cartesian
julia> function plus(m1::MyType, m2::MyType)
@nexprs 2 d->(s_d = m1.a_d + m2.a_d)
MyType(s_1, s_2)
end
plus (generic function with 1 method)
julia> m1 = MyType(1
This is not a very good use case for meta programming.
Here are two version using dicts and arrays:
https://gist.github.com/SimonDanisch/c01235254451f8234e29
Am Sonntag, 16. November 2014 22:09:57 UTC+1 schrieb Greg Plowman:
>
> Hi
>
> I'm trying to automate some code and thought Julia's metapro