Meer, A.P. van der wrote: > Hello, > > I’m trying to implement a (prototype of a) type system in Eclipse using > constraint handling rules. The problem is that the domain of types is > partially ordered. For example, if we take integers, reals and strings, > I would like integer < real but not string < integer or string > > integer. I’m currently using the FD solver for this, representing each > type with an integer, but that is not really convenient, since I have to > keep checking that the comparisons are actually valid. > > Is there an “official” way of using partial orders in eclipse? I didn’t > see anything in the manual. I suppose I could try the FD_Sets solver, > because the subset relation is a partial order, or I could try the SD > solver and somehow define my own < relation, but either sounds > straightforward. Yes, you define your own relation. Here is one way: :- lib(fd). :- lib(propia). lt(X,Y) :- lt_table(X,Y) infers ac. lt_table(integer, real). lt_table(real, simple). lt_table(string, simple). ... Cheers, JoachimReceived on Sat Jan 31 2009 - 14:23:54 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST