let to_list s =
  fold (fun x (b,_) acc -> (x, b) :: acc) s []