3

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.

Fred Foo
  • 355,277
  • 75
  • 744
  • 836
MartyIX
  • 27,828
  • 29
  • 136
  • 207

1 Answers1

8
?- use_module(library(clpfd)). 
?- StartingTimes in {1,5,10}.
Mats Carlsson
  • 1,426
  • 7
  • 3