ranger
create ranges over any type
Quick start
gleam test # Run the tests
gleam shell # Run an Erlang shell
Installation
This package can be added to your Gleam project:
gleam add ranger
and its documentation can be found at https://hexdocs.pm/ranger.
Usage
import gleam/int
import gleam/yielder
import ranger
pub fn main() {
let range =
ranger.create(
validate: fn(_) { True },
negate_step: fn(s) { -1 * s },
add: fn(a, b) { a + b },
compare: int.compare,
)
let assert Ok(ten_to_five) = range(10, 5, 1)
ten_to_five
|> yielder.to_list
}