package genspio

  1. Overview
  2. Docs

Source file common.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
include Base

module Unique_name = struct
  let x = ref 0

  let create prefix =
    Caml.incr x ;
    Fmt.str "%s_%d_%d" prefix !x (Random.int 100_000)

  let variable = create
end

let with_buffer ?(size = 42) f =
  let b = Buffer.create size in
  let str = Buffer.add_string b in
  let res = f str in
  (Buffer.contents b, res)
OCaml

Innovation. Community. Security.