let rec value_of_key key = function [] -> raise InternalError | (k, v) :: l -> if compare k key = 0 then v else value_of_key key l