object
expected(Reference)¶
Expected term reference predicates. Requires passing a reference (constructed using the expected object) as a parameter.
static, context_switching_callsPublic predicates¶
is_unexpected/0¶
True if the reference holds an unexpected term. Avoid whenever possible by using instead the if_unexpected/1 predicate.
staticis_unexpected - zero_or_oneis_expected/0¶
True if the reference holds an expected term. Avoid whenever possible by using instead the if_expected/1 predicate.
staticis_expected - zero_or_oneif_unexpected/1¶
Applies a closure when the reference holds an unexpected term using the term as argument. Succeeds otherwise. Can be used to throw the exception hold by the reference by calling it the atom throw.
staticif_unexpected(Closure)if_unexpected(1)if_unexpected(+callable) - zero_or_moreif_expected/1¶
Applies a closure when the reference holds an expected term using the term as argument. Succeeds otherwise.
staticif_expected(Closure)if_expected(1)if_expected(+callable) - zero_or_moreunexpected/1¶
Returns the unexpected term hold by the reference. Throws an error otherwise.
staticunexpected(Unexpected)unexpected(--term) - one_or_errorexistence_error(unexpected_term,Reference)expected/1¶
Returns the expected term hold by the reference. Throws an error otherwise.
staticexpected(Expected)expected(--term) - one_or_errorexistence_error(expected_term,Reference)map/2¶
When the reference does not hold an unexpected term and mapping a closure with the expected term and the new expected term as additional arguments is successful, returns a reference with the new expected term. Otherwise returns the same reference.
staticmap(Closure,NewReference)map(2,*)map(+callable,--nonvar) - oneflat_map/2¶
When the reference does not hold an unexpected term and mapping a closure with the expected term and the new reference as additional arguments is successful, returns the new reference. Otherwise returns the same reference.
staticflat_map(Closure,NewReference)flat_map(2,*)flat_map(+callable,--nonvar) - oneor_else/2¶
Returns the expected term hold by the reference if it does not hold an unexpected term or the given default term if the reference holds an unexpected term.
staticor_else(Expected,Default)or_else(--term,@term) - oneor_else_get/2¶
Returns the expected term hold by the reference if it does not hold an unexpected term. Otherwise applies a closure to compute the expected term. Throws an error when the reference holds an unexpected term and an expected term cannot be computed.
staticor_else_get(Expected,Closure)or_else_get(*,1)or_else_get(--term,+callable) - one_or_errorexistence_error(expected_term,Reference)or_else_call/2¶
Returns the expected term if the reference does not hold an unexpected term. Calls a goal deterministically otherwise.
staticor_else_call(Expected,Goal)or_else_call(*,0)or_else_call(--term,+callable) - zero_or_oneor_else_throw/1¶
Returns the expected term hold by the reference if present. Throws the unexpected term as an error otherwise.
staticor_else_throw(Expected)or_else_throw(--term) - one_or_erroror_else_fail/1¶
Returns the expected term hold by the reference if it does not hold an unexpected term. Fails otherwise. Usually called to skip over references holding unexpected terms.
staticor_else_fail(Expected)or_else_fail(--term) - zero_or_oneProtected predicates¶
(none)
Private predicates¶
(none)