Skip to content

massivefermion/ranger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ranger

Package Version Hex Docs

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/float
import gleam/yielder
import ranger

pub fn main() {
  let range =
    ranger.create(
      validate: fn(_) { True },
      negate_step: fn(s) { -1.0 *. s },
      add: fn(a, b) { a +. b },
      compare: float.compare,
    )

  let assert Ok(z_to_p) = range("z", "p", 1)
  z_to_p
  |> yielder.to_list
}