このディレクトリの索引
#  Hi, I use swi prolog and my code like this. I read data predicate
#  from file and its arity count can change. How can I generalize it.
#  For example, If data(a1,b1,c1) writes in the file, how can I find solution?
#  Do you have any idea?
# 
# >    basla:-consult('test.pl'),
# >          answer(L1,L2,L3,L4,L5),
# >          list_to_set(L1, X),
# >        
# >          write(X).
# >     answer(L1,L2,L3,L4,L5):-
# >       findall(First, data(First,_,_,_,_),L1),
# >       findall(Second, data(_,Second,_,_,_),L2),
# >       findall(Third, data(_,_,Third,_,_),L3).

basla(Predicate/Arity) :-
        consult('test.pl'),
        length(L,Arity),
        for(1,Nth,Arity),
        findall(A,(
                    nth1(Nth,L,A),
                    P =.. [Predicate|L],
                    call(P)),
                LX),
        list_to_set(LX,U),
        writef('%t\n',[LX]),
        Nth = Arity.