Re: [julia-users] Minor troubles with quasiquoting syntax

2016-09-25 Thread Yichao Yu
On Sun, Sep 25, 2016 at 1:09 PM, Jamie Brandon wrote: > Here is some code I just wrote this evening: > > n = length(T.parameters) > index_types = typeof_index(T.parameters) > pushes = map(1:n) do i > :(push!(columns[$i], $(Symbol("key_$i" > end >

Re: [julia-users] Minor troubles with quasiquoting syntax

2016-09-25 Thread Jamie Brandon
Here is some code I just wrote this evening: n = length(T.parameters) index_types = typeof_index(T.parameters) pushes = map(1:n) do i :(push!(columns[$i], $(Symbol("key_$i" end body = quote $(pushes...) end for i in n:-1:1 body = quote $(Symbol("keys_$i")) =

Re: [julia-users] Minor troubles with quasiquoting syntax

2016-09-25 Thread Yichao Yu
On Sun, Sep 25, 2016 at 12:39 PM, Jamie Brandon wrote: > I'm doing a lot of code-generation. There are two patterns that come up all > over the place - adding a suffix to a symbol and interpolating from an array > comprehension. This is pretty verbose even in the

[julia-users] Minor troubles with quasiquoting syntax

2016-09-25 Thread Jamie Brandon
I'm doing a lot of code-generation. There are two patterns that come up all over the place - adding a suffix to a symbol and interpolating from an array comprehension. This is pretty verbose even in the simplest case: quote ... row = tuple($([:($(Symbol("val_$ix))) for ix in order]...)) ...