Below is the file 'q.ml' from this revision. You can also download the file.

type 'a t = 'a list

let empty = []

let push q x =
  x :: q

let push_list q l =
  List.rev_append l q

let concat q1 q2 =
  List.append q2 q1

let to_list q =
  List.rev q

let list_fold f l =
  to_list (List.fold_left f empty l)