let rec ifpair_to_list = function
    If_pair(a,b) -> a::(ifpair_to_list b)
  | c -> [c]