calculon

Library for writing IRC bots in OCaml and a collection of plugins
IN THIS PACKAGE

Transition Table

type token = private string
val print_token : token CCFormat.printer
type t

A prefix tree of uniform length

val empty : t
val singleton : token -> t
val add : token list -> token -> t -> t
val merge : t -> t -> t
val merge_list : t list -> t
val pick_key : Random.State.t -> t -> token

pick_key rand t picks one of the keys of t

  • raises Not_found

    if t is empty

val pick : Random.State.t -> token list -> t -> token

Pick a token following the given path, randomly

  • raises Not_found

    if there is no token to be found

val print : t CCFormat.printer

Pretty-print the tree on the given formatter

val write_to : out_channel -> t -> unit

Serialize to channel

val read_from : in_channel -> t

Deserialize from channel