Is there some syntax for passing a generator to a function taking variadic args? e

Is there some syntax for passing a generator to a function taking variadic args? e.g.

hcat([i, i, i] for i in 1:10)

I know I can splat an array, but the intermediate array seems unnecessary

hcat([[i, i, i[ for i in 1:10]...)

Thanks!

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

1 Like

You do not need an intermediary array, you can have an intermediary iterator:

hcat(([i, i, i] for i in 1:10)...)

Note the parentheses in place of the brackets.

1 Like