I have immediate use for this. Thanks. Please follow Tony's advice, so I can keep up to date with any modifications.
On Saturday, August 15, 2015 at 8:13:57 PM UTC-4, [email protected] wrote: > > I wrote a short macro for Julia 0.4 to generate fixed-length tuples using > comprehension-like syntax. This is useful in code where tuples are used to > represent fixed-length arrays. Here is an example: > > v = @tuplegen [(i==2)? i * 6 : i for i = 1 : 3] > > macro-expands to > > v = (1, 2*6, 3) > > which would yield (1,12,3). You could get the same result via the > standard code: > v = tuple( [ <comprehension goes here> ] ...) > but this latter code would create a heap-allocated array as a temporary > variable and hence would presumably be less efficient. > > The metaprogramming to make this work is similar to the metaprogramming > for my unroll macro, so I put them in the same package. You can get > @tuplegen (and @unroll) via: > > Pkg.clone("https://github.com/StephenVavasis/Unroll.jl") > >
