Did you know ... Search Documentation:
Pack logtalk -- logtalk-3.85.0/docs/_sources/expected_0.rst.txt

.. index:: expected .. _expected/0:

.. rst-class:: right

object

expected

Constructors for expected terms. An expected term contains either a value or an error. Expected terms should be regarded as opaque terms and always used with the expected/1 object by passing the expected term as a parameter.

| Availability: | logtalk_load(expecteds(loader))

| Author: Paulo Moura | Version: 2:1:0 | Date: 2021-01-03

| Compilation flags: | static, context_switching_calls

| Provides: | :ref:`type::type/1 <type/0::type/1>` | :ref:`type::check/2 <type/0::check/2>`

| Remarks:

  • Type-checking support: This object also defines a type expected for use with the type library object.

| Inherited public predicates: | (none)

.. contents:: :local: :backlinks: top

Public predicates

.. index:: of_unexpected/2 .. _expected/0::of_unexpected/2:

of_unexpected/2 ^^^^^^^^^^^^^^^^^^^

Constructs an expected term from an error that represent that the expected value is missing.

| Compilation flags: | static

| Template: | of_unexpected(Error,Expected) | Mode and number of proofs: | of_unexpected(@term,--nonvar) - one


.. index:: of_expected/2 .. _expected/0::of_expected/2:

of_expected/2 ^^^^^^^^^^^^^^^^^

Constructs an expected term from an expected value.

| Compilation flags: | static

| Template: | of_expected(Value,Expected) | Mode and number of proofs: | of_expected(@term,--nonvar) - one


.. index:: from_goal/4 .. _expected/0::from_goal/4:

from_goal/4 ^^^^^^^^^^^^^^^

Constructs an expected term holding a value bound by calling the given goal. Otherwise returns an expected term with the unexpected goal error or failure represented by the Error argument.

| Compilation flags: | static

| Template: | from_goal(Goal,Value,Error,Expected) | Meta-predicate template: | from_goal(0,*,*,*) | Mode and number of proofs: | from_goal(+callable,--term,@term,--nonvar) - one


.. index:: from_goal/3 .. _expected/0::from_goal/3:

from_goal/3 ^^^^^^^^^^^^^^^

Constructs an expected term holding a value bound by calling the given goal. Otherwise returns an expected term with the unexpected goal error or the atom fail representing the unexpected failure.

| Compilation flags: | static

| Template: | from_goal(Goal,Value,Expected) | Meta-predicate template: | from_goal(0,*,*) | Mode and number of proofs: | from_goal(+callable,--term,--nonvar) - one


.. index:: from_goal/2 .. _expected/0::from_goal/2:

from_goal/2 ^^^^^^^^^^^^^^^

Constructs an expected term holding a value bound by calling the given closure. Otherwise returns an expected term holding the unexpected closure error or the atom fail representing the unexpected failure.

| Compilation flags: | static

| Template: | from_goal(Closure,Expected) | Meta-predicate template: | from_goal(1,*) | Mode and number of proofs: | from_goal(+callable,--nonvar) - one


.. index:: from_generator/4 .. _expected/0::from_generator/4:

from_generator/4 ^^^^^^^^^^^^^^^^^^^^

Constructs expected terms with the values generated by calling the given goal. On goal error or failure, returns an expected term with the unexpected goal error or failure represented by the Error argument.

| Compilation flags: | static

| Template: | from_generator(Goal,Value,Error,Expected) | Meta-predicate template: | from_generator(0,*,*,*) | Mode and number of proofs: | from_generator(+callable,--term,@term,--nonvar) - one_or_more


.. index:: from_generator/3 .. _expected/0::from_generator/3:

from_generator/3 ^^^^^^^^^^^^^^^^^^^^

Constructs expected terms with the values generated by calling the given goal. On goal error or failure, returns an expected term with, respectively, the unexpected goal error or the atom fail representing the unexpected goal failure.

| Compilation flags: | static

| Template: | from_generator(Goal,Value,Expected) | Meta-predicate template: | from_generator(0,*,*) | Mode and number of proofs: | from_generator(+callable,--term,--nonvar) - one_or_more


.. index:: from_generator/2 .. _expected/0::from_generator/2:

from_generator/2 ^^^^^^^^^^^^^^^^^^^^

Constructs expected terms with the values generated by calling the given closure. On closure error or failure, returns an expected term with, respectively, the unexpected closure error or the atom fail representing the unexpected closure failure.

| Compilation flags: | static

| Template: | from_generator(Closure,Expected) | Meta-predicate template: | from_generator(1,*) | Mode and number of proofs: | from_generator(+callable,--nonvar) - one_or_more


Protected predicates

(no local declarations; see entity ancestors if any)

Private predicates

(no local declarations; see entity ancestors if any)

Operators

(none)

.. seealso::

:ref:`expected(Expected) <expected/1>`, :ref:`type <type/0>`