Skip to content

JonathanStarup/Range

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Range

A simple range library.

Basic use

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

About

a simple library for ranges - primarily to be used in foreach

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published