Lindsay Cowell wrote:
i am brand new to prolog (less than 24hours) so i appologize if this is a competely stupid question. i am trying to work through so tutorials/examples i found online. several times i have come accross the predicate listing. when i try to use this in ciao prolog, i get the error message undefined predicate. in one of the references that i found this in (prolog now), it is referred to as a built-in prolog predicate. i think i need to load some library or module or something but i can't tell from reading the ciao prolog manual what the library is.
i am grateful for any comments.
Here's an old response from Francisco Bueno Carrillo, available in the archives http://clip.dia.fi.upm.es/Mail/ciao-users/:
Yes, listing/0 has a strange behaviour, but I should say that it is almost deprecated now in Ciao (note that it does not even appear in the manual!). It is provided for historical reasons, though, but probably what you want to do can be done better by other means. Can I ask you what are you using it for?
The development methodology in most modern Prolog systems (including Ciao) is to write the program in one or more files and then either compile the program or load it into the top level. Thus, it is not necessary to list the 'loaded program': it suffices with looking at the original file(s).
In some ways listing/0 is a residue of the older style in which users often developed applications by typing in clauses at the top level and saving the state every now and then. In such an environment listing/0 was used to check what had been typed so far. It should not be necessary anymore...
Anyway, to use it the way you want, you can do, in the interpreter:
?- use_module(library(dynamic)).
?- current_predicate(X), listing(X), fail.
Note that this lists only the dynamic (and data) predicates.
============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------