For the sake of example, suppose that the function has no vectorizing
version. But I found that

([x^2 for x in [1,2,9]]...)

is probably the most compact for my purposes --- thanks!

Cf https://github.com/JuliaLang/julia/pull/15516 , which would be
really, really neat.

Best,

Tamas

On Thu, Mar 31 2016, Gunnar Farnebäck wrote:

> This is at least shorter.
>
> julia> (v.^2...)
> (1,4,81)
>
> Den torsdag 31 mars 2016 kl. 10:28:09 UTC+2 skrev Tamas Papp:
>>
>> Hi, 
>>
>> Is there a preferred syntax for mapping a vector to a tuple? Eg an 
>> alternative for (contrived example) 
>>
>> v = [1,2,9] 
>> ntuple(i -> v[i]^2, length(v)) 
>> tuple([e^2 for e in v]...) 
>>
>> Best, 
>>
>> Tamas 
>>

Reply via email to