Ah, what a relief, thanks.


On Tuesday, May 13, 2014 4:49:31 PM UTC-4, Stefan Karpinski wrote:
>
> It's the same thing. Matlab uses the = version but only allows ranges on 
> the right hand side, so it looks like `for k = 1:n` which reads pretty 
> well. We used to only allow the = form, which is why older code like this 
> uses = but decided that writing `for x = xs` was really confusing, so we 
> added `for x in xs` as an alternate syntax. These days I only use the = 
> form when the right hand side is a range.
>
>
> On Tue, May 13, 2014 at 4:35 PM, Andrew Dabrowski 
> <[email protected]<javascript:>
> > wrote:
>
>> So I'm looking at base/set.jl, and I'm almost immediately puzzled by some 
>> syntax.
>>
>> union!(s::Set, xs) = (for x=xs; push!(s,x); end; s)
>>
>> What is xs?  I might have expected
>>
>> union!(s::Set, xs...) = (for x in xs; push!(s,x); end; s)
>>
>> but "for x=xs" I don't get.  Can someone explain how this syntax works?
>>
>
>

Reply via email to