object
Optional reference predicates. Require passing an optional reference constructed using the "optional" object as a parameter.
Paulo Moura
1.0
2017/5/30
static, context_switching_calls
(no dependencies on other entities)
True if the optional reference is empty.
static
is_empty – zero_or_one
True if the optional reference holds a term.
static
is_present – zero_or_one
Calls a goal if the optional reference is empty. Succeeds otherwise.
static
if_empty(Goal)
if_empty(0)
if_empty(+callable) – zero_or_more
Applies a closure with the optional reference value as additional argument if not empty. Succeeds otherwise.
static
if_present(Closure)
if_present(1)
if_present(+callable) – zero_or_more
Returns the optional reference when it is non-empty and its value satisfies a closure. Otherwise returns an empty optional.
static
filter(Closure,Reference)
filter(1,*)
filter(+callable,--nonvar) – one
When the the optional reference is non-empty and mapping a closure with the optional reference value and the new value as additional arguments is successful, returns an optional reference with the new value. Otherwise returns an empty optional.
static
map(Closure,NewReference)
map(2,*)
map(+callable,--nonvar) – one
When the the optional reference is non-empty and mapping a closure with the optional reference value and the new optional reference as additional arguments is successful, returns the new optional reference. Otherwise returns an empty optional.
static
flat_map(Closure,NewReference)
flat_map(2,*)
flat_map(+callable,--nonvar) – one
Returns the optional reference term if not empty. Throws a resource error otherwise.
static
get(Term)
get(--term) – one
Returns the optional reference term if not empty or the given default term if the optional is empty.
static
or_else(Term,Default)
or_else(--term,@term) – one
Returns the optional reference term if not empty or applies a closure to compute the term if the optional is empty.
static
or_else_get(Term,Closure)
or_else_get(1,*)
or_else_get(--term,+callable) – one
(none)
(none)