local "_" declared twice

109 views
Skip to first unread message

Christoph Ortner

unread,
Aug 25, 2016, 6:07:24 PM8/25/16
to julia-users
Is this intended behaviour or a bug? 

julia> maximum( t for (t,_,_) in zip(x,y,z) )
ERROR
: syntax: local "_" declared twice


julia
> x = rand(3); y = rand(3); z = rand(3);


julia
> for (t, _, _) in zip(x, y, z)
                  println
(t)
             
end
0.5059694701992228
0.6291609082858327
0.298657434448903


julia
> maximum( t for (t,_,_) in zip(x,y,z) )
ERROR
: syntax: local "_" declared twice




Stefan Karpinski

unread,
Aug 26, 2016, 1:58:19 PM8/26/16
to Julia Users
It's intentional, but maybe using `_` twice should be allowed?

Christoph Ortner

unread,
Aug 26, 2016, 4:35:16 PM8/26/16
to julia-users
I am only confused because

for (t, _, _) in zip(x, y, z)

is fine while

maximum( t for (t,_,_) in zip(x,y,z) )

is not.

Stefan Karpinski

unread,
Aug 26, 2016, 4:38:45 PM8/26/16
to Julia Users
If you could post clarification here: https://github.com/JuliaLang/julia/issues/18251.
Reply all
Reply to author
Forward
0 new messages