An open API service indexing awesome lists of open source software.

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

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")
```