Since I learned how to transform input using DCGs for parsing and difference list for reconstructing the transformed data, I am running into many predicates that would be nice if they returned difference list instead of closed list. One major example of this is all of the predicates in library DCG/basics that return closed list but would be nice if they also returned difference list.
I know the following simple predicate can easily transform any closed list into an open list, but this is just a band-aid that cost a performance penalty.
% Create open list and hole given closed list open_closed_list(Open_list,Hole,Closed_list) :- is_of_type(proper_list,Closed_list), is_of_type(var,Open_list), is_of_type(var,Hole), open_closed_list_prime(Closed_list,Hole,Open_list), must_be(partial_list,Open_list). open_closed_list_prime(,Hole,Hole). open_closed_list_prime([H0|T0],Hole,[H0|T]) :- open_closed_list_prime(T0,Hole,T).