package kappa-library

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

Source file mods.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
(******************************************************************************)
(*  _  __ * The Kappa Language                                                *)
(* | |/ / * Copyright 2010-2020 CNRS - Harvard Medical School - INRIA - IRIF  *)
(* | ' /  *********************************************************************)
(* | . \  * This file is distributed under the terms of the                   *)
(* |_|\_\ * GNU Lesser General Public License Version 3                       *)
(******************************************************************************)

let int_compare (x : int) y = Stdlib.compare x y

let int_pair_compare (p, q) (p', q') =
  let o = int_compare p p' in
  if o = 0 then
    int_compare q q'
  else
    o

let string_pair_compare (p, q) (p', q') =
  let o = String.compare p p' in
  if o = 0 then
    String.compare q q'
  else
    o

let pair_equal eqa eqb (xa, xb) (ya, yb) = eqa xa ya && eqb xb yb

module StringSetMap = SetMap.Make (struct
  type t = string

  let compare = String.compare
  let print = Format.pp_print_string
end)

module StringSet = StringSetMap.Set
module StringMap = StringSetMap.Map

module String2SetMap = SetMap.Make (struct
  type t = string * string

  let compare = string_pair_compare
  let print f (a, b) = Format.fprintf f "(%s, %s)" a b
end)

module String2Map = String2SetMap.Map

module IntSetMap = SetMap.Make (struct
  type t = int

  let compare = int_compare
  let print = Format.pp_print_int
end)

module IntSet = IntSetMap.Set
module IntMap = IntSetMap.Map

module Int2SetMap = SetMap.Make (struct
  type t = int * int

  let compare = int_pair_compare
  let print f (a, b) = Format.fprintf f "(%i, %i)" a b
end)

module Int2Set = Int2SetMap.Set
module Int2Map = Int2SetMap.Map

module CharSetMap = SetMap.Make (struct
  type t = char

  let compare = compare
  let print = Format.pp_print_char
end)

module CharSet = CharSetMap.Set
module CharMap = CharSetMap.Map
module DynArray = DynamicArray.DynArray (LargeArray)
OCaml

Innovation. Community. Security.