Logtalk reference manual
Built-in method: bagof/3
Contents > Reference Manual > Built-in Methods > bagof/3

## bagof/3

#### Description

    bagof(Term, Goal, List)

See the Prolog ISO standard definition. This built-in meta-predicate is declared as a private method and thus cannot be used as a message to an object.

#### Template and modes

    bagof(@term, +callable, -list)

#### Errors

> (see the Prolog ISO standard)

#### Examples

To find all solutions in the context of the object or category containing the call:
  `bagof(Term, Goal, List)`
To find all solutions by sending the goal as a message to self:
  `bagof(Term, ::Goal, List)`
To find all solutions by sending the goal as a message to an explicit object:
  `bagof(Term, Object::Goal, List)`