Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does double dot (..) in Julia Programming Language mean?

Tags:

julia

For example in the code below, x is defining the domain, but why is there the double dot between 0 and 4pi?

using ApproxFun
x=Fun(identity,0..4π)
like image 867
Soumya Avatar asked Dec 13 '22 08:12

Soumya


1 Answers

.. is an operator (like e.g. +) but it does not have a default definition. You can define it to to whatever you want:

julia> ..(a, b) = println(a, ", ", b)
.. (generic function with 1 method)

julia> "hello" .. "world"
hello, world

The Julia package IntervalArithmetic uses it to construct an interval, e.g.

julia> using IntervalArithmetic

julia> 4..5
[4, 5]

julia> typeof(4..5)
Interval{Float64}

and I suspect this is what it is used for in your code example.

like image 111
fredrikekre Avatar answered Jan 01 '23 03:01

fredrikekre