package grenier

  1. Overview
  2. Docs
A collection of various algorithms in OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

grenier-0.14.tbz
sha256=e5362e6ad0e888526517415e78b9e8243bb0cc1b0c952201884148832ac4442f
sha512=4e2f16b52b3c2786a1b8e93156184fd69d448cea571ca839b6cb88ab73f380994d1561fe24c1523c43ed8fc42d2ac01b673a13b6151fff4af4f009923d3aaf37

doc/src/grenier.physh/physh.ml.html

Source file physh.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
let null = ref ()

module Set = struct
  type 'a t

  external phys_set_alloc : 'a array -> unit ref -> 'a t = "ml_phys_set_alloc"
  external phys_set_add : 'a t -> 'a -> unit ref-> unit = "ml_phys_set_add"
  external phys_set_mem : 'a t -> 'a -> unit ref-> bool = "ml_phys_set_mem"
  external phys_set_length : 'a t -> int = "ml_phys_set_length"

  let create () = phys_set_alloc [||] null
  let length = phys_set_length
  let add t x = phys_set_add t x null
  let mem t x = phys_set_mem t x null
end

module Map = struct
  type ('a,'b) t

  external phys_map_alloc : 'a array -> unit ref -> ('a, 'b) t = "ml_phys_map_alloc"
  external phys_map_add  : ('a, 'b) t -> 'a -> 'b -> unit ref -> unit = "ml_phys_map_add"
  external phys_map_find : ('a, 'b) t -> 'a -> unit ref -> 'b = "ml_phys_map_find"
  external phys_map_length : ('a, 'b) t -> int = "ml_phys_map_length"

  let create () = phys_map_alloc [||] null
  let length = phys_map_length
  let add t k v = phys_map_add t k v null
  let find t k = phys_map_find t k null
end