1:- module(foreseen,
    2          [ foreseen/1
    3          ]).    4
    5:- meta_predicate foreseen(0 ).
 foreseen(:Goal)
like call/1, but precalculates the next match to prevent green points
   11foreseen(Goal) :-
   12    copy_term(Goal, Term),
   13    PrevSol = s([]),
   14    ( call(Term),
   15      ( PrevSol = s(Goal)
   16      ->nb_setarg(1, PrevSol, Term)
   17      ; nb_setarg(1, PrevSol, Term),
   18        fail
   19      )
   20    ; PrevSol = s(Goal)
   21    )