このディレクトリの索引

#  
#  % ?- variablize([a,b,c], X, L).
#  ?- % L = [[X, b, c], [a, X, c], [a, b, X]]
#  I have a predicate variablize/3 that takes a list and replaces each item, in turn, with a variable, example:
#  
#  % ?- variablize([a,b,c], X, L).
#  % L = [[X, b, c], [a, X, c], [a, b, X]]
#  Now I am trying to extend this predicate to accept a list of variables, example:
#  
#  % ?- variablize([a,b,c], [X,Y], L).
#  % L = [[X, Y, c], [X, b, Y], [a, X, Y]]
#  My code so far is:
#  
#  replace_at([_|Tail], X, 1, [X|Tail]).
#  replace_at([Head|Tail], X, N, [Head|R]) :- M is N - 1, replace_at(Tail, X, M, R).
#  
#  replace_each([], _, _, [], _).
#  replace_each([_|Next], Orig, X, [Res|L], N) :-
#      replace_at(Orig, X, N, Res),
#      M is N + 1,
#      replace_each(Next, Orig, X, L, M).
#  
#  variablize(I, X, L) :- replace_each(I, I, X, L, 1).
#  Any pointers? Do I extend replace_at/4 to have a list of indexes that should be skipped?
#  

variablize(L1,X,L) :-
        findall(L2,(
                    append(L0,[K|R],L1),
                    append(L0,[X|R],L2)),
                L).