package grenier

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

Install

Dune Dependency

Authors

Maintainers

Sources

grenier-0.13.tbz
sha256=04831d5c2ea783d4e32b356a8495e5481ce8919aa70f5eecee29baebbf6fa483
sha512=1199122ab70701ecd33bf9c6339a743d163a1ba3ef5d0db189cab6c6712386739031b66002bf48d4740112430a93780f82dc37f56688ee33f99da928186b8205

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
OCaml

Innovation. Community. Security.