Skip to content

Commit 0a9ccd9

Browse files
authored
Update displays of intervals in readme (#158)
1 parent 92c033a commit 0a9ccd9

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@ You can construct `ClosedInterval`s in a variety of ways:
2828
julia> using IntervalSets
2929

3030
julia> ClosedInterval{Float64}(1,3)
31-
1.0..3.0
31+
1.0 .. 3.0
3232

3333
julia> 0.5..2.5
34-
0.5..2.5
34+
0.5 .. 2.5
3535

3636
julia> 1.5±1
37-
0.5..2.5
37+
0.5 .. 2.5
3838
```
3939

4040
Similarly, you can construct `OpenInterval`s and `Interval{:open,:closed}`s, and `Interval{:closed,:open}`:
4141
```julia
4242
julia> OpenInterval{Float64}(1,3)
43-
1.0..3.0 (open)
43+
1.0 .. 3.0 (open)
4444

4545
julia> OpenInterval(0.5..2.5)
46-
0.5..2.5 (open)
46+
0.5 .. 2.5 (open)
4747

4848
julia> Interval{:open,:closed}(1,3)
49-
1..3 (openclosed)
49+
1 .. 3 (open-closed)
5050
```
5151

5252
The `±` operator may be typed as `\pm<TAB>` (using Julia's LaTeX
@@ -65,13 +65,13 @@ julia> 1 ∈ OpenInterval(0..1)
6565
false
6666

6767
julia> intersect(1..5, 3..7) # can also use `a ∩ b`, where the symbol is \cap<TAB>
68-
3..5
68+
3 .. 5
6969

7070
julia> isempty(intersect(1..5, 10..11))
7171
true
7272

7373
julia> (0.25..5) (3..7.4) # \cup<TAB>; can also use union()
74-
0.25..7.4
74+
0.25 .. 7.4
7575

7676
julia> isclosedset(0.5..2.0)
7777
true
@@ -92,3 +92,7 @@ julia> (0.25..5) ∪ (6..7.4)
9292

9393
ArgumentError: Cannot construct union of disjoint sets.
9494
```
95+
96+
### Importing the .. operator
97+
98+
To import the `..` operator, use `import IntervalSets: (..)`. The parantheses are necessary to avoid parsing issues.

0 commit comments

Comments
 (0)