https://github.com/jonathanstarup/range
a simple library for ranges - primarily to be used in foreach
https://github.com/jonathanstarup/range
Last synced: 5 months ago
JSON representation
a simple library for ranges - primarily to be used in foreach
- Host: GitHub
- URL: https://github.com/jonathanstarup/range
- Owner: JonathanStarup
- License: apache-2.0
- Created: 2025-06-08T11:50:31.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-08T11:52:49.000Z (about 1 year ago)
- Last Synced: 2025-06-08T12:22:22.587Z (about 1 year ago)
- Size: 0 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Range
A simple range library.
## Basic use
```flix
use JonathanStarup.Range;
// print 0, 1, 2, .., 99
foreach (i <- Range.rangeExclusive(0, end = 100)) {
println(i)
}
// print 0, 1, 2, .., 100
foreach (i <- Range.rangeInclusive(0, end = 100)) {
println(i)
}
// print 0, -1, -2, .., -99
foreach (i <- Range.rangeExclusive(0, end = -100)) {
println(i)
}
// print 0, 2, .., 100
foreach (i <- Range.rangeStepInclusive(0, end = 100, step = 2)) {
println(i)
}
// print 0, -3, -6, -9
foreach (i <- Range.rangeStepInclusive(0, end = -9, step = -3)) {
println(i)
}
// `map` converts the range any any collection with `Collectable` defined
let vector: Range.fromEndExclusive(42) |> Range.map(i -> "${i} is cool")
```