package range

  1. Overview
  2. Docs
Fold on integer range

Install

Dune Dependency

Authors

Maintainers

Sources

0.8.1.tar.gz
sha256=f25750eba81b4702794e73baf0dff2c57d5627142342f3ca2981ffb6f0bf7eb3
md5=ecaea87a8f71a51d7c11abc0bc865a5e

Description

Library to work on range of sequential integers with features like : split, map, filter capacities. Designed for making distributed computing easier with libraries like functory.

Published: 22 Nov 2019

README

README

Range Library

This small library has two goals :
   * enable to fold a sequence of integers like a list
   * split a range, making distributed computing easy

Example of usage

    (* print numbers between 100 and 200 *)
     Range.(from 100 200 |> iter (Printf.printf "%d\n"));;

     (* print sum of all values between 1 and 50 *)
     Range.(from 1 50 |> fold (+) 0 |> print_int);;
     
     (* print sum of all values between 1 and 50, adding 4 to all elements and excluding 53 *)
     Range.(from 1 50 |> map ((+) 4) |> filter ((!=) 53) |> fold (+) 0 |> print_int);;
     
     (* implement a factorial function *)
     let factorial n = Range.(n |> abs |> from 1 |> fold ( * ) 1)
     
     API documentation available at : https://aldrikfr.github.io/range/

Dependencies (3)

  1. dune >= "1.8"
  2. base >= "v0.12"
  3. ocaml >= "4.03.0"

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.