Hi!
It seems that the ECLiPSe "do" operator is not available when the library(iso) is used. This library is loaded by the ECLiPSe config file, "eclipseiso.config", which is the default config file when using the provided Logtalk integration scripts. Thus, one solution is to not use operator notation. With the following definition:
Code: Select all
:- object(test).
:- public(predicate/0).
predicate :-
do((count(I, 1, 10), foreach(I, Is)), true),
writeln(Is).
:- end_object.
there are no longer compilation or execution errors:
Code: Select all
[eclipse 1]: {ecl}.
<<< loading source file ecl...
>>> compiling source file ecl...
compiling object test... compiled
>>> ecl source file compiled
ecl.pl compiled optimized 1952 bytes in 0.00 seconds
<<< ecl source file loaded
(0 warnings)
Yes (0.01s cpu)
[eclipse 2]: test::predicate.
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Yes (0.00s cpu)
Another possible solution is to add an op/3 directive to your source file for the "do" operator:
Note, however, that the Logtalk "loop" library object results in a portable solution (across all Logtalk compatible Prolog back-end compilers). The ECLiPSe loop control constructs, even if handy, are proprietary and, as such, not easily portable.
Happy logtalking!
Paulo