What the title says. I can’t figure it out, and the docs just provide the not at all useful description:
x := y is a synonym for x = x : y
Which apparently means something different from what I expected to, given the following returns an error rather than a range:
julia> x = 2
2
julia> y = 4
4
julia> x:=y
2 Likes
Mason
2
That’s actually an error in the docs that I believe was recently fixed. :=
doesn’t do anything. It’s basically just reserved syntax for macros.
E.g. some people want domain specific languages embedded in julia might have a syntax like
@model begin
x := 1
y := x + 1
...
end
6 Likes
Can you link to the docs? That is not valid syntax in 1.*
.
Interesting – what are some examples of macros that use this?
Mason
5
Here’s what I get in the help>
mode in 1.6:
help?> :=
search:
x := y is a synonym for x = x : y
This note gets automatically generated for a bunch of infix operators but was done erroneously for :
.
2 Likes
Mason
6
2 Likes