# if dune is not installed
$ opam install dune
# clone the github repo
$ git clone https://github.com/jamsidedown/ocaml-cll.git
$ cd ocaml-cll
# build with dune
$ dune build
# install to the current opam switch
$ opam install .
Usage
To be run in the ocaml toplevel
let cll = Cll.init [ 1; 2; 3; 4; 5; 6 ];;
Cll.head cll;;
(* int option = Some 1 *)
Cll.length cll;;
(* int = 6 *)
Cll.next cll;;
Cll.head cll;;
(* int option = Some 2 *)
Cll.prev cll;;
Cll.prev cll;;
Cll.head cll;;
(* int option = Some 6 *)
Cll.add cll 7;;
Cll.head cll;;
(* int option = Some 7 *)
Cll.pop cll;;
(* int option = Some 7 *)
Cll.head cll;;
(* int option = Some 1 *)
Cll.find cll 4;;
(* bool = true *)
Cll.head cll;;
(* int option = Some 4 *)
Cll.iter cll (fun x -> Printf.printf "%i\n")
(*
4
5
6
1
2
3
*)
Cll.to_list cll;;
(* int list = [4; 5; 6; 1; 2; 3] *)