# `current_predicate/1`

## Description

    current_predicate(Predicate)

Enumerates, by backtracking, visible, user-defined, object predicates. Built-in predicates and predicates not declared using a scope directive are not enumerated.

When `Predicate` is ground at compile time, this predicate also succeeds for any predicates listed in uses/2 and use_module/2 directives.

When `Predicate` is bound at compile time to a `:/2` term, this predicate enumerates module predicates (assuming that the backend Prolog compiler supports modules).

## Modes and number of proofs

    current_predicate(?predicate_indicator) - zero_or_more

## Errors

`Predicate` is neither a variable nor a valid predicate indicator:
`type_error(predicate_indicator, Predicate)`
`Predicate` is a `Name/Arity` term but `Functor` is neither a variable nor an atom:
`type_error(atom, Name)`
`Predicate` is a `Name/Arity` term but `Arity` is neither a variable nor an integer:
`type_error(integer, Arity)`
`Predicate` is a `Name/Arity` term but `Arity` is a negative integer:
`domain_error(not_less_than_zero, Arity)`

## Examples

To enumerate, by backtracking, the locally visible user predicates or the user predicates visible in this:
`current_predicate(Predicate)`
To enumerate, by backtracking, the public and protected user predicates visible in self:
`::current_predicate(Predicate)`
To enumerate, by backtracking, the public user predicates visible for an explicit object:
`Object::current_predicate(Predicate)`

See also

current_op/3, predicate_property/2, uses/2, use_module/2