elm-package.json
file at this tag.Tag | 3.1.0 |
Committed At | 2020-12-16 18:41:39 UTC |
This package implements a simple Interval
type for Elm. Both Int
and Float
intervals are supported, for example:
rgbRange : Interval Int
rgbRange =
Interval.from 0 255
angleRange : Interval Float
angleRange =
Interval.from 0 (2 * pi)
Various functionality is included for constructing intervals (including as the hull or intersection of other intervals), checking for overlap/intersection/containment, and performing limited arithmetic on intervals:
unitInterval =
Interval.from 0 1
Interval.endpoints unitInterval
--> ( 0, 1 )
Interval.hull 5 [ 3, 2, 4 ]
--> Interval.from 2 5
Interval.union
(Interval.from 1 2)
(Interval.from 3 5)
--> Interval.from 1 5
Interval.intersection
(Interval.from 1 3)
(Interval.from 2 5)
--> Just (Interval.from 2 3)
Interval.intersection
(Interval.from 1 2)
(Interval.from 3 5)
--> Nothing
Interval.contains 0 (Interval.from -1 3)
--> True
Interval.contains 5 (Interval.from -1 3)
--> False
Interval.sin (Interval.from 0 pi)
--> Interval.from 0 1