Suggestions on how to infer types for prolog/clp variables?
fybertas <[email protected]> Fri, 5 Sep 2014 14:16:31 -0700 (PDT)
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Hello, friends: Currently I am doing a transformation from prolog into constraint logic programming(clpfd). One problem I am facing now is how to differentiate between variables: for instance, some variables will bound to a integer while others might bound to characters; If I insert domain definition (e.g. "Var in inf..sup "), there will be an type error if the variable Var is not meant to bound to a variable. One idea I came up with is to infer the types of such variable through the context: after I read in a line, if the variable detected is involved in arithmatic operation(e.g. "Var1 is Var2 - 1" or "Var1 > Var2"), we can make the assumption that both Var1 and Var2 are bound to integers(we ignore the complications of float numbers at this moment) and safely insert the domain definition. I am still not sure about how to implement this (libraries?) and whether this is a legit approach. Any ideas or concerns will be highly appreciated. Thanks, Yu Fu School of Information Sciences and Technology Pennsylvania State University, USA -- View this message in context: http://swi-prolog.996271.n3.nabble.com/Suggestions-on-how-to-infer-types-for-prolog-clp-variables-tp14995.html Sent from the SWI Prolog mailing list archive at Nabble.com.