let rec end_cons_list = function
  x, lx -> if is_empty_list (lx)
             then cons_list (x, empty_list ()) 
             else cons_list (head (lx), end_cons_list (x, tail (lx)))