(*
* Bilist: a list containing two kind of values: A cells and B cells.
*
* (This type is different from the one seen previously in the lecture.)
*)
(* Elements are A or B. *)
type ('a, 'b) elt = A of 'a | B of 'b
(* A list of ('a, 'b) elements *)
type ('a, 'b) bilist = ('a, 'b) elt list
(* An exception, used in some questions. *)
exception Switch
(* This tree type is used only in the last question(s) *)
type ('a, 'b) bitree =
(* Each node has two children *)
| Node of ('a, 'b) bitree * ('a, 'b) bitree
(* An 'A' leaf. *)
| Aleaf of 'a
(* A 'B' leaf. *)
| Bleaf of 'b