home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!icd.ab.com!iccgcc.decnet.ab.com!baechtel
- From: baechtel@iccgcc.decnet.ab.com
- Newsgroups: comp.lang.prolog
- Subject: Help with C-Prolog, Please.
- Message-ID: <1992Sep3.164303.8798@iccgcc.decnet.ab.com>
- Date: 3 Sep 92 16:43:03 EST
- Lines: 32
-
-
-
- In C-Prolog 1.5, is there anyway to get the name of a variable
- in a term?
-
- Specifically, If I write:
-
- read(Term, Vars) :-
- read(Term),
- functor(Term,F,A),
- getvars(Term,A,Vars,[]).
-
- getvars(Term,0,Varlist,Varlist).
-
- getvars(Term,A,Vars,Varlist) :-
- arg(A,Term,Arg),
- ( var(Arg), Vars1 = [Arg | Varlist]; Vars1 = Varlist),
- A1 is A-1,
- getvars(Term,A1,Vars,Vars1).
-
- If I execute read(Term,Vars) and my input is: "X is Y.",
- Term = "X is Y" and Vars = [_15,_16].
-
- Is there anyway to get Vars=[X,Y]?
- I don't understand how to get the name of the Variable instead of its
- reference.
-
- Can anyone suggest code that will work in C-Prolog?
-
- Thanks in advance.
- .
-
-