Code Comments
Programming Forum and web based access to our favorite programming groups.Any ideas why? (Running Sicstus Prolog) | ?- X in -1..1, Y in -1..1, X#= -Y. ! Domain error in user: #= /2 ! expected constraint, found _1126#= -(_1124) ! goal: _1126#= -(_1124) ! goal: user:(_451#= -(_506)) ! Domain error in user: #= /2 ! expected constraint, found _140#= -(_105) ! goal: _140#= -(_105) Bes regards, Andrey
Post Follow-up to this messageafter a quick look at the manual: unary negation symbol is missing in clp(FD) language. a workaround is to multiply by -1: | ?- X in -1..1, Y in -1..1, X#= -1*(Y). X in-1..1, Y in-1..1 ? yes > Any ideas why? (Running Sicstus Prolog) > > | ?- X in -1..1, Y in -1..1, X#= -Y. > ! Domain error in user: #= /2 > ! expected constraint, found _1126#= -(_1124) > ! goal: _1126#= -(_1124) > ! goal: user:(_451#= -(_506)) > ! Domain error in user: #= /2 > ! expected constraint, found _140#= -(_105) > ! goal: _140#= -(_105) > > > Bes regards, > > Andrey
Post Follow-up to this messageI think this is something that should be standardized for CLP(FD). In B-Prolog, I got what are expected. | ?- X in -1..1, Y in -1..1, X#= -Y,labeling([X,Y]) X = -1 Y = 1 ?; X = 0 Y = 0 ?; X = 1 Y = -1 ?; no | ?- X in -1..1, T = (X#=0), #\ T, labeling([], [X]). X = -1 T = -1#=0 ?; X = 1 T = 1#=0 ?; no Cheers, Neng-Fa "Andrey Rybalchenko" <first_dot_last_at_epfl_dot_ch> wrote in message news:1187210291_654@sicinfo3.epfl.ch... > after a quick look at the manual: > > unary negation symbol is missing in clp(FD) language. > a workaround is to multiply by -1: > > | ?- X in -1..1, Y in -1..1, X#= -1*(Y). > X in-1..1, > Y in-1..1 ? > yes >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.