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