A treatment of higher-order features in logic programming