Re: [eclipse-clp-users] Getting legaly named variables / Unifiying Term Lists

From: Kish Shen <kisshen_at_...5...>
Date: Thu, 11 Feb 2010 16:04:42 +0000
Christian Wirth wrote:

> I have term's in CNF that i split up according to some predicates. The 
> splitted clauses are added to lists, but this must happen without prolog 
> trying to bind the variables.
> So i decided to convert the terms into strings bevor adding, to prevent 
> the binding. As several times mentioned, i need to preserve variable 
> names/numbers exactly.
> term_to_bytes preserves variable names but not numbers. term_string does 
> preserve the numbers but not the names.
> In theory term_to_bytes should also perserve the numbers, but it doesn't 
> work for me ...
> I so i used set_var_name to name all variables and use term_to_bytes.

You should not be trying to do any reasoning/programming that uses 
variable names. Variable names, as printed by various output predicates, 
are purely for presentation to the users. I assume what is important is 
that you need to be certain that specific variables in your terms are 
the same, and looking at the variable names is *not* the way to do it, 
and you certainly should not write program code that look at the 
variable names to determine if the variables are the same.

If you are doing some sort of meta-programming, in which you need to 
treat variables as one of your programming objects, then as I suggested 
previously, you are probably better off using a ground representation, 
where the variables you are reasoning about are represented as ground 
terms, e.g some sort of index. In this case, you don't need to worry 
about accidentally unifying two variables together, nor how various 
built-ins treat variables.


This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Thu Feb 11 2010 - 16:04:48 CET

This archive was generated by hypermail 2.3.0 : Tue Aug 20 2019 - 00:14:49 CEST