Question

I'm starting with SICStus Prolog and I would like to define a variable, say StartingTimes, to have a domain defined by list [1, 5, 10]

How can I do it in SICStus Prolog?

I would do something like:

 domain(StartingTimes, 1, 10)
 StartingTimes #= 1 #\/ StartingTimes #= 5 #\/ StartingTimes #= 10

But that is horrible. There must be a simple way how to do that. Maybe fd_sets?

Note: I tried to find out how it is done in manual but the prolog uses common words and it's really hard to use google for that.

Était-ce utile?

La solution

?- use_module(library(clpfd)). 
?- StartingTimes in {1,5,10}.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top