[julia-users] Re: adding new method for $ is not allowed, while adding for + is fine

2015-10-07 Thread Matt Bauman
$ is also used for interpolation, so it must be disambiguated between the 
two cases.  & is similar, if I remember correctly.

On Wednesday, October 7, 2015 at 3:09:08 PM UTC-4, cheng wang wrote:
>
> Thanks. Still, why + and $ are different in this case ?
>
> On Wednesday, October 7, 2015 at 9:05:10 PM UTC+2, Seth wrote:
>>
>> Surround it by parens:
>>
>> julia> ($)(x::Int, y::Int) = x+y+5
>> ...
>> julia> ($)(5,7)
>> 17
>>
>> On Wednesday, October 7, 2015 at 11:39:03 AM UTC-7, cheng wang wrote:
>>>
>>> Hello everyone,
>>>
>>> I try to do $(x,y)=something, it says: syntax: invalid assignment 
>>> location
>>> while +(x,y)=something is ok.
>>>
>>> Is there any speciality of $ operator?
>>>
>>> Best,
>>> Cheng
>>>
>>

[julia-users] Re: adding new method for $ is not allowed, while adding for + is fine

2015-10-07 Thread cheng wang
Thanks. Still, why + and $ are different in this case ?

On Wednesday, October 7, 2015 at 9:05:10 PM UTC+2, Seth wrote:
>
> Surround it by parens:
>
> julia> ($)(x::Int, y::Int) = x+y+5
> ...
> julia> ($)(5,7)
> 17
>
> On Wednesday, October 7, 2015 at 11:39:03 AM UTC-7, cheng wang wrote:
>>
>> Hello everyone,
>>
>> I try to do $(x,y)=something, it says: syntax: invalid assignment 
>> location
>> while +(x,y)=something is ok.
>>
>> Is there any speciality of $ operator?
>>
>> Best,
>> Cheng
>>
>

[julia-users] Re: adding new method for $ is not allowed, while adding for + is fine

2015-10-07 Thread Seth
Oops, hit post too quickly. Can also be called infix:

julia> 5 $ 7
17


On Wednesday, October 7, 2015 at 12:05:10 PM UTC-7, Seth wrote:
>
> Surround it by parens:
>
> julia> ($)(x::Int, y::Int) = x+y+5
> ...
> julia> ($)(5,7)
> 17
>
> On Wednesday, October 7, 2015 at 11:39:03 AM UTC-7, cheng wang wrote:
>>
>> Hello everyone,
>>
>> I try to do $(x,y)=something, it says: syntax: invalid assignment 
>> location
>> while +(x,y)=something is ok.
>>
>> Is there any speciality of $ operator?
>>
>> Best,
>> Cheng
>>
>

[julia-users] Re: adding new method for $ is not allowed, while adding for + is fine

2015-10-07 Thread Seth
Surround it by parens:

julia> ($)(x::Int, y::Int) = x+y+5
...
julia> ($)(5,7)
17

On Wednesday, October 7, 2015 at 11:39:03 AM UTC-7, cheng wang wrote:
>
> Hello everyone,
>
> I try to do $(x,y)=something, it says: syntax: invalid assignment location
> while +(x,y)=something is ok.
>
> Is there any speciality of $ operator?
>
> Best,
> Cheng
>