
% move2front(L, K, NewL)
% ----------------------
% given a list of key-value pairs and a key,
%    move the pair with the specified key to the front of the list
move2front(L, K, [[K,V]|T]) :-
   member([K,V], L), remove([K,V], L, T).
remove(E, [E|R], R).
remove(E, [H|T], [H|R]) :- remove(E, T, R).

