|Did you know ...||Search Documentation:|
|Pack maybe -- prolog/maybe.pl|
just(_). Useful for include/3.
nothing. Useful for exclude/3.
just(Value); fails for
Maybe=nothing. Goal typically binds Value. If Goal produces multiple solutions on backtracking, so will call_maybe/3. In that case, Maybe will never be
?- L = [a,b,c], call_maybe(L=[H|_], H, MaybeHead). H = a, MaybeHead = just(a). ?- L = , call_maybe(L=[H|_], H, MaybeHead). MaybeHead = nothing.
Of course, that particular example could have been implemented with maybe_list/2 instead.
nothing. A non-empty list is equivalent to
maplist(default_maybe_value(7), Maybes, DefaultedValues).
call(Goal, Value0, Value)succeeds for
justvalues. Goal is not called for
nothingvalues, which remain unchanged. "Use the source" for a clearer explanation.
justrelates them via Goal. "Use the source" for a clearer explanation.