package containers

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module CCIntSource

Basic Int functions

Sourcetype t = int
Sourceval compare : t -> t -> int

The comparison function for integers with the same specification as Pervasives.compare.

Sourceval equal : t -> t -> bool

Equality function for integers.

Sourceval hash : t -> int
Sourceval sign : t -> int

sign i is one of -1, 0, 1.

Sourceval neg : t -> t

Unary negation. neg i = - i.

  • since 0.5
Sourceval pow : t -> t -> t

pow base exponent returns base raised to the power of exponent. pow a b = a^b for positive integers a and b. Raises Invalid_argument if a = b = 0 or b < 0.

  • since 0.11
Sourceval 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.

  • since 1.2
Sourceval rem : t -> t -> t

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

  • since 1.2
Sourcetype 'a printer = Format.formatter -> 'a -> unit
Sourcetype 'a random_gen = Random.State.t -> 'a
Sourcetype 'a sequence = ('a -> unit) -> unit
Sourceval random : int -> t random_gen
Sourceval random_small : t random_gen
Sourceval random_range : int -> int -> t random_gen
Sourceval pp : t printer
Sourceval to_string : t -> string

Return the string representation of its argument, in signed decimal.

  • since 0.13
Sourceval of_string : string -> t option
  • since 0.13
Sourceval pp_binary : t printer

Print as "0b00101010".

  • since 0.20
Sourceval to_string_binary : t -> string
  • since 0.20
Sourceval min : t -> t -> t

The minimum of two integers.

  • since 0.17
Sourceval max : t -> t -> t

The maximum of two integers.

  • since 0.17
Sourceval 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.

  • since 1.2
Sourceval range : t -> t -> t sequence

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

  • since 1.2
Sourceval range' : t -> t -> t sequence

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

  • since 1.2

Infix Operators

  • since 0.17
Sourcemodule Infix : sig ... end
include module type of Infix
Sourceval (=) : t -> t -> bool
  • since 0.17
Sourceval (<>) : t -> t -> bool
  • since 0.17
Sourceval (<) : t -> t -> bool
  • since 0.17
Sourceval (>) : t -> t -> bool
  • since 0.17
Sourceval (<=) : t -> t -> bool
  • since 0.17
Sourceval (>=) : t -> t -> bool
  • since 0.17
Sourceval (--) : t -> t -> t sequence

Alias to range.

  • since 1.2
Sourceval (--^) : t -> t -> t sequence

Alias to range'.

  • since 1.2
Sourceval (+) : t -> t -> t
  • since 2.1
Sourceval (-) : t -> t -> t
  • since 2.1
Sourceval (~-) : t -> t
  • since 2.1
Sourceval (*) : t -> t -> t
  • since 2.1
Sourceval (/) : t -> t -> t
  • since 2.1
Sourceval (**) : t -> t -> t
  • since 2.4
Sourceval (mod) : t -> t -> t
  • since 2.1
Sourceval (land) : t -> t -> t
  • since 2.1
Sourceval (lor) : t -> t -> t
  • since 2.1
Sourceval (lxor) : t -> t -> t
  • since 2.1
Sourceval lnot : t -> t
  • since 2.1
Sourceval (lsl) : t -> int -> t
  • since 2.1
Sourceval (lsr) : t -> int -> t
  • since 2.1
Sourceval (asr) : t -> int -> t
  • since 2.1