Noeud: Enumeration variables, Noeud « Next »: Hilog terms, Noeud « Previous »: Feature Terms, Noeud « Up »: Terms
DyALog provides Enumeration Variables, i.e. variables that may take
their values from some defined enumeration. For instance, the term
X::tense[present,past]
denotes a variable X
with value in
the sub-enumeration [present,past]
of some user-defined
enumeration tense
. Note the use of enclosing [] instead
of enclosing ().
To associate an enumeration to a symbole, use the directive
finite_set/2
.
:-finite_set(tense,[present,past,futur]).
It is also possible to define sub-enumeration using the directive
subset/2
:-finite_set(letter,[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p, q,r,s,t,u,v,w,x,y,z ]). :-subset(voyel,letter[a,e,i,o,u,y])
Enumeration are restricted to at most 30 elements. These elements should be ground objects. Enumeration variable may be unified with variables, enumeration variables based on the same enumeration and with elements of their enumeration.