(* This code extends 'mini_prelude'. *) type ('a) queue = Queue of ('a) list * ('a) list ;; let empty = (Queue (Nil, Nil)) ;; let is_empty = (fun v5 -> (match v5 with (Queue (v4, v3)) -> (match v4 with Nil -> true | (Cons (v2, v1)) -> false))) ;; let checkf = (fun v5 -> (match v5 with (Queue (v4, v3)) -> (match v4 with Nil -> (Queue ((REVERSE v3), Nil)) | (Cons (v2, v1)) -> (Queue ((Cons (v2, v1)), v3))))) ;; let snoc = (fun v3 -> (fun v4 -> (match v3 with (Queue (v2, v1)) -> (checkf (Queue (v2, (Cons (v4, v1)))))))) ;; let head = (fun x -> (match x with (Queue (v4, v3)) -> (match v4 with Nil -> (raise (Match_failure (string_of_bool true, 0, 0))) | (Cons (v2, v1)) -> v2))) ;; let tail = (fun x -> (match x with (Queue (v4, v3)) -> (match v4 with Nil -> (raise (Match_failure (string_of_bool true, 0, 0))) | (Cons (v2, v1)) -> (checkf (Queue (v1, v3)))))) ;;