# How to write xs\[i\]..xs\[i+1\] in Julia 1.5 , two dots

**URL:** <https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684>\
**Category:** General Usage\
**Tags:** intervals\
**Created:** [January 1, 2021, 8:11am UTC](https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684 "2021-01-01T08:11:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)\
**Post date:** [January 1, 2021, 8:11am UTC](https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684/1 "2021-01-01T08:11:31Z")

</div>

how to write in Julai 1.5

```julia
xs[i]..xs[i+1] in Julai 1.5

function make_intervals(N=10)
    xs = linspace(0, 2, N+1)
    return [xs[i]..xs[i+1] for i in 1:length(xs)-1]
end

```

Paul

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [January 1, 2021, 8:13am UTC](https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684/2 "2021-01-01T08:13:02Z")

</div>

what does this suppose to do?

---

<div class="post-metadata">

**Author:** ![Dictino](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dictino/32/217281_2.png) [@Dictino](https://discourse.julialang.org/u/Dictino)\
**Post date:** [January 1, 2021, 9:14am UTC](https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684/3 "2021-01-01T09:14:56Z")

</div>

Not sure but I guess that you are trying to construct an array of intervals, in this case you need `using IntervalArithmetic` and then inside the function use the constructor `interval(xs[i],xs[i+1])` or the macro `@interval(xs[i],xs[i+1])`

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 1, 2021, 9:19am UTC](https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684/4 "2021-01-01T09:19:54Z")

</div>

Sorry for the format, used Julia on cell phone:

```julia
function make_intervals(a,b,N)
    x = range(a,b,length=N+1)
    return [[x[i], x[i+1]] for i in 1:N]
end

```

Result:

```julia
julia> make_intervals(0,2,10)    
10-element Array{Array{Float64,1},1}:                              
 [0.0, 0.2]
 [0.2, 0.4]                       
 [0.4, 0.6]                      
 [0.6, 0.8]
 [0.8, 1.0]
 [1.0, 1.2]
 [1.2, 1.4]                       
 [1.4, 1.6]
 [1.6, 1.8]
 [1.8, 2.0]

```

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 1, 2021, 11:14am UTC](https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684/5 "2021-01-01T11:14:55Z")

</div>

PS: _could you please spell Julia correctly, three times “Julai” is a bit too much._

---

<div class="post-metadata">

**Author:** ![mforets](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mforets/32/298_2.png) [@mforets](https://discourse.julialang.org/u/mforets)\
**Post date:** [January 1, 2021, 1:02pm UTC](https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684/6 "2021-01-01T13:02:45Z")

</div>

> [@programista](#):
>
> how to write in Julai 1.5

If you change `linspace(0, 2, N+1)` to `range(a, b, length=N+1)` as suggested by @rafael.guerra, the function works.

Note that you can also use the `mince` function:

```julia
make_interval(N=10) = mince(0 .. 2, N)

make_interval()
10-element Array{Interval{Float64},1}:
 [0, 0.200001]
    [0.2, 0.400001]
    [0.4, 0.6]
    [0.599999, 0.800001]
    [0.8, 1]
 [1, 1.2]
    [1.19999, 1.4]
    [1.39999, 1.60001]
    [1.6, 1.80001]
    [1.8, 2]

```

---

<div class="post-metadata">

**Author:** ![HenriDeh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrideh/32/8316_2.png) [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Post date:** [January 1, 2021, 6:35pm UTC](https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684/7 "2021-01-01T18:35:54Z")

</div>

Sorry to take over your post but, what it is this … notation that you use ? My Julia says it’s undefined.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 1, 2021, 7:17pm UTC](https://discourse.julialang.org/t/how-to-write-xs-i-xs-i-1-in-julia-1-5-two-dots/52684/9 "2021-01-01T19:17:25Z")

</div>

@HenriDeh, this thread concerns the package [IntervalArithmetic.jl](https://github.com/JuliaIntervals/IntervalArithmetic.jl).
