Module CCInt

Basic Int functions

type t = int
val compare : t ‑> t ‑> int
val equal : t ‑> t ‑> bool
val hash : t ‑> int
val sign : t ‑> int

sign i is one of -1, 0, 1

val neg : t ‑> t

neg i = - i

val pow : t ‑> t ‑> t

pow a b = a^b for positive integers a and b. Raises Invalid_argument if a = b = 0 or b < 0.

val floor_div : t ‑> t ‑> t

floor_div a n is integer division rounding towards negative infinity. It satisfies a = m * floor_div a n + rem a n.

val rem : t ‑> t ‑> t

rem a n is the remainder of dividing a by n, with the same sign as n.

type 'a printer = Format.formatter ‑> 'a ‑> unit
type 'a random_gen = Random.State.t ‑> 'a
type 'a sequence = ('a ‑> unit) ‑> unit
val random : int ‑> t random_gen
val random_small : t random_gen
val random_range : int ‑> int ‑> t random_gen
val pp : t printer
val to_string : t ‑> string
val of_string : string ‑> t option
val pp_binary : t printer

prints as "0b00101010".

val to_string_binary : t ‑> string
val min : t ‑> t ‑> t
val max : t ‑> t ‑> t
val range_by : step:t ‑> t ‑> t ‑> t sequence

range_by ~step i j iterates on integers from i to j included, where the difference between successive elements is step. use a negative step for a decreasing list.

val range : t ‑> t ‑> t sequence

range i j iterates on integers from i to j included . It works both for decreasing and increasing ranges

val range' : t ‑> t ‑> t sequence

Same as range but the second bound is excluded. For instance range' 0 5 = Sequence.of_list [0;1;2;3;4]

module Infix : sig ... end

Infix Operators

include module type of Infix

Infix Operators

val (=) : t ‑> t ‑> bool
  • Since: 0.17
val (<>) : t ‑> t ‑> bool
  • Since: 0.17
val (<) : t ‑> t ‑> bool
  • Since: 0.17
val (>) : t ‑> t ‑> bool
  • Since: 0.17
val (<=) : t ‑> t ‑> bool
  • Since: 0.17
val (>=) : t ‑> t ‑> bool
  • Since: 0.17
val (--) : t ‑> t ‑> t sequence

Alias to range

  • Since: 1.2
val (--^) : t ‑> t ‑> t sequence

Alias to range'

  • Since: 1.2