Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CLP Nominal Context Operator (#:)/2

8 views
Skip to first unread message

Jan Burse

unread,
May 29, 2012, 4:02:24 AM5/29/12
to
Dear All,

Are there some constraint logic programming
systems that have a nominal context operator?

It doesn't really work when constraint variables
are logical variables, it rather works when they
are atoms. It then reads:

To solve 'xyz' #: C
solve C with prefixing all constraint
variables by 'xyz_'.

As a result one can do:

?- a #>= 31, a #< 40.
a in [31..40] /* endpoint excluded */

?- a #>= 10, a #< 5.
No

?- h #: (a #>= 10), b #: (a #< 5)
h_a in [10...]
b_a in [..5] /* endpoint excluded */

It could be also used as a array index substitute,
so instead of:

?- dim(x,[3,3]), x[1,2] #>= 10.
_B in [10...]

One could do:

?- x #: ( '1' #: '2' #>= 10 ).
x_1_2 in [10...]

Advantage/Disadvantage over arrays:
= Allocation footprint proportional to arrays
- No dim, so if constraint setup has backtracking
redoing of allocation
+ No dim, don't need to think about size and shape
of array, associative

Bye
0 new messages