Dear Jeff,
it is not broken! :-)
In order to be truly modular, operators in Ciao are local to the modules in which they are defined (note that this is also what the ISO standard says!!). This applies also to the top level, which behaves just as if it were another module (that is why you load files into it using use_module).
The bottom line is that you have to 'activate' the operators in the top level. You can do this in the following ways:
- You can do it by hand, entering them into the top level:
Ciao-Prolog 1.9 #59: Mon Feb 17 03:09:53 CET 2003 ?- op(200, fy, the).
yes ?-
- Even better, put all the operators definitions in a file, called for example 'dianaops.pl' and *include* it both in the top level and in the program module (e.g., diana). I.e., dianaops.pl is :
%% file: dianaops.pl :- op(200, fy, the). :- op(250, xfy, of). :- op(300, yfx, was).
%% end dianaops.pl
and the program would be:
%% file: diana.pl :- include(dianaops).
diana was the secretary of the department. %% end diana.pl
and then in the top level, do:
?- ensure_loaded(diana).
yes ?- include(dianaops). {Including /tmp/dianaops.pl }
yes ?- diana was the secretary of the department.
yes
These decisions in Ciao are part of what allows having all those nice packages (function syntax, constraints, named arguments, assertions, etc., etc.) and being able to use one package (say, functional syntax) in one module and a different package (say, constraints) in another module without interaction or seeing any effect in the top level. Note that you really do not want the operators defined in some module or user file deep within an application to show up in the top level. Among other things if you used the same operator for two purposes in different modules of the program (which is very useful sometimes) they would clash in the top level.
MH