3

Is there a means to list all the predicates that are defined in a given library module for SICStus Prolog?

e.g. if I load the lists module:

| ?- use_module(library(lists)).

is there another predicate I can run from the prompt to tell me what predicates have just been imported?

false
  • 10,264
  • 13
  • 101
  • 209
bph
  • 10,728
  • 15
  • 60
  • 135

1 Answers1

4

This works with SWI-Prolog, but the predicate current_predicate/1 is marked as "ISO" so at least give it a try in SICSTUS. Here is what I get:

?- use_module(library(lists)).
true.

?- current_predicate(lists:P).
P = max_list/3 ;
P = flatten/2 ;
% and so on

Or maybe:

?- findall(P, current_predicate(lists:P), Ps).
Ps = [max_list/3, flatten/2, nth1/4, reverse/4, must_be/2, min_member_/3, reverse/2, transpose_pairs/2, ... / ...|...].

You should be able to do this in any Prolog that implements current_predicate/1.

  • @bph If it does you can consider removing the sicstus flag from your question, and replacing it with "iso-prolog"? –  Jul 16 '15 at 16:25