Hi,in visual prolog there is "domains" section in a prolog program in which you can define types. Is there any similar thing in swi-prolog?
In visual prolog a type is defined like:
domains
NewType = thing1; thing2
Hi,in visual prolog there is "domains" section in a prolog program in which you can define types. Is there any similar thing in swi-prolog?
In visual prolog a type is defined like:
domains
NewType = thing1; thing2
No. But there is mode declaration in Mercury. Mercury is more than Prolog; it is a functional-logic language. Mercury still has a lot of Prolog syntax.
SWI-Prolog is a standard Prolog. It only uses mode declarations in documentation1 as information for the users. Such declarations can be placed in comments of modules for documentation-parsing programs to compile.
In standard Prologs, outside of comments, such declarations are only allowed (and reqired) in very special situations. The block/1 predicate of Sicstus Prolog for instance requires them.
Block/1 is used for co-routing(lazy evaluation, delay etc.). I've only seen block
used in one program in my life, PAKCS2, an interpreter for another functional-logic language. When the interpreter was ported to SWI, block/1
was not used.
1 Type and mode declarations in SWI Source Documentation
2 PAKCS, a program using the block/1
predicate (PAKCS is an implementation of the curry language.)