Wiki Discussion: Meta interpreter

callable/1 exist but don’t know how it relates to the criteria as noted by Jan W. in this post.

callable/1 is often seen as a guard, e.g.

predicate_xyz(_:Head) :-
   callable(Head), 
   !
   ...

example in syspred.pl

and with a conditional ->/2 e.g.

( callable(Head)
->  ...
;   ...
).

example in autoload.pl


callable/1 is also used as part of the type checking from library(error), e.g. has_type(callable,X)

NB Do not call has_type/2 but use the other wrapper predicates as demonstrated in the following.


must_be(callable,Predicate)

must_be/2 throws instantiation_error if Term is insufficiently instantiated and type_error(Type, Term) if Term is not of Type.

example in sandbox.pl

must_be(list(callable), List)

example in thread.pl


has_type/2

has_type(callable,Predicate)

fails silently