Ranges
Lazy, typed, iterable intervals with exclusive boundaries and custom stepping
π The Basics
Range as a First-Class Object
myRange = 1..5
// Range object β NOT immediately an arrayresult = arrayToList( 1..5, "," ) // "1,2,3,4,5"
result = arrayLen( 1..10 ) // 10π’ Supported Types
Integers and Decimals
1..5 // 1, 2, 3, 4, 5
3.5..1.5 // 3.5, 2.5, 1.5 (descending auto-detected)
(0..1).step(0.25) // 0, 0.25, 0.50, 0.75, 1.00Characters
DateTime
Any Comparable Type (Contains-Only)
Custom Types via IRangeable
IRangeableπ Unbounded and Half-Bounded Ranges
Typed Unbounded Ranges
π Exclusive Boundaries
πͺ Custom Stepping
π Lazy Iteration and Streaming
π Contains Semantics
Simple ranges (step = 1, no unit): Bounds Check
Stepped ranges (step > 1 or unit): Step-Reachability Check
Non-iterable ranges: Always Bounds Check
Range-in-Range Contains
ποΈ Clamping Values
π Position Checks
π Member Methods
Query Methods
Method
Description
Accessors
Method
Description
Transformation Methods
Method
Description
Conversion Methods
Method
Description
β
Empty Ranges and Truthiness
π’ Operator Precedence
π Copy-on-Write Semantics
β οΈ Error Cases
π§© Custom Rangeable Types: IRangeable
IRangeableExample 1: Fibonacci β Infinite Non-Linear Sequences
Example 2: Roman Numerals
Example 3: Musical Notes with Unit Stepping
Implementation Checklist
π Additional Resources
Last updated
Was this helpful?
