PLOGHELP ONCE                                Robert Duncan, January 1988


    :- library(useful).

    ?- once(Goal).


This goal invokes the term Goal (like call/1 - see PLOGHELP * CALL) but
allows it to succeed at most once. It cannot be resatisfied.

Example:

    ?- member(X, [1, 2, 3]).
    X = 1 ? ;
    X = 2 ? ;
    X = 3 ? ;
    no

    ?- once(member(X, [1, 2, 3])).
    X = 1 ? ;
    no

As with call/1, it is an error for Goal not to be instantiated.


once/1 is a library predicate defined in LIBRARY USEFUL. Its definition
is:

    once(Goal) :-
        call(Goal), !.


-- RELATED DOCUMENTATION ----------------------------------------------

PLOGHELP * LIBRARY
    How to use the library mechanism.

PLOGHELP * USEFUL
    A library of useful predicates.

--- C.all/plog/help/once -----------------------------------------------
--- Copyright University of Sussex 1988. All rights reserved. ----------
