3

When I use a previously unused module f, the module is initialized and is known afterwards:

| ?- current_module(f).
no
| ?- assert(f:x).
yes
| ?- current_module(f).
yes

This also happens if I try to use a non-existent procedure:

| ?- current_module(f).
no
| ?- f:x.
! Existence error in f:x/0
! procedure f:x/0 does not exist
! goal:  f:x
| ?- current_module(f).
yes

As far as I can tell, two predicates behave differently: current_predicate and predicate_property.

| ?- current_module(f).
no
| ?- current_predicate(f:X).
no
| ?- findall(X-P, predicate_property(f:X,P), XPs).
XPs = [call(_A)-(meta_predicate call(0)),
       call(_B)-built_in,
       ...|...] ? ;
no
| ?- current_module(f).
no

So here's my actual question:

Do other SICStus Prolog predicates behave like current_predicate and predicate_property? If so, which ones?

repeat
  • 18,496
  • 4
  • 54
  • 166

0 Answers0