From dmiles@teknowledge.com  Mon Nov 27 23:20:51 2000
Received: from helium.teknowledge.com (promethium.teknowledge.com [128.136.192.50])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id XAA29382
	for <prolog@swi.psy.uva.nl>; Mon, 27 Nov 2000 23:20:49 +0100 (MET)
Received: by helium.teknowledge.com with Internet Mail Service (5.5.2650.21)
	id <WM9NXCN7>; Mon, 27 Nov 2000 14:16:59 -0800
Message-ID: <EE25484266A64A47AE06CFC47C64232B1A17F6@helium.teknowledge.com>
From: "Douglas R. Miles" <dmiles@teknowledge.com>
To: "'prolog@swi.psy.uva.nl'" <prolog@swi.psy.uva.nl>
Subject: Locating Singleton Variables
Date: Mon, 27 Nov 2000 14:16:25 -0800
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)
Content-Type: text/plain

What would be the best way to locate singleton variables? 


So far...


vars_info(Clause,[],[],[]):-ground(Clause).
vars_info(Clause,AllVars,EachVar,Singletons):-copy_term(Clause,ClauseCopy),
 
term_to_atomlist(ClauseCopy,ClauseCopiedList),numbervars(ClauseCopiedList),
   findall('$VAR'(N),member('$VAR'(N),ClauseCopiedList),AllVars),
   sort(AllVars,EachVar),
    ....
	What should I do to find Singletons?
	Most likely I am going about this all wrong.


term_to_atomlist([Var],[Var]):-(var(Var);atomic(Atom)),!.
term_to_atomlist([TERM],[H|T]):-!,TERM=..[H|Args],term_to_atomlist(Args,T),!
.
term_to_atomlist([H|T],List):-!,term_to_atomlist([H],HList),term_to_atomlist
(T,TList),append(HList,TList,List).
term_to_atomlist(Term,AtomList):-!,conv(TermList,Term),term_to_atomlist(Term
List,AtomList). 

conv([X|T],(X,R)) :- T \== [],!,conv(T,R).
conv([X],(X))


Thank you in advance,

Douglas Miles

