Skip to content

aivi.core.range ​

aivi.core.range provides closed numeric intervals. Bounds are inclusive. An integer or floating-point range is empty when start > end; constructors preserve the supplied bounds rather than reordering them.

Integer ranges ​

ExportTypeBehavior
RangeInt{ start: Int, end: Int }Inclusive integer range
makeInt -> Int -> RangeIntConstruct a range
isEmptyRangeInt -> BoolTest whether start > end
containsRangeInt -> Int -> BoolTest inclusive membership
lengthRangeInt -> IntCount integers; return zero for an empty range
overlapsRangeInt -> RangeInt -> BoolTest whether two nonempty ranges share a value
clampToRangeInt -> Int -> IntRestrict a value to the two bounds
startOfRangeInt -> IntRead the start bound
endOfRangeInt -> IntRead the end bound
shiftInt -> RangeInt -> RangeIntAdd a delta to both bounds
intersectRangeInt -> RangeInt -> RangeIntReturn the shared interval, possibly empty

Floating-point ranges ​

ExportTypeBehavior
RangeFloat{ start: Float, end: Float }Inclusive floating-point range
makeFloatFloat -> Float -> RangeFloatConstruct a range
isEmptyFloatRangeFloat -> BoolTest whether start > end
containsFloatRangeFloat -> Float -> BoolTest inclusive membership
clampToFloatRangeFloat -> Float -> FloatRestrict a value to the two bounds
shiftFloatFloat -> RangeFloat -> RangeFloatAdd a delta to both bounds
lerpFloatRangeFloat -> Float -> FloatInterpolate by t; values outside zero through one extrapolate
aivi
use aivi.core.range (
    RangeInt
    contains
    length
    make
)

value pageWindow : RangeInt = make 10 19
value includesLast : Bool = contains pageWindow 19
value pageSize : Int = length pageWindow

(c) 2026 by Andreas Herd