What about the following meta-predicate "fixed point"?

fixedpoint(P_2,X0,X) :-
   if_(X0 = X1, X = X0, fixedpoint(P_2,X1,X)).

fixedpointlist(P_2,X0,[X0|Xs]) :-
   if_(X0 = X1, Xs = [], fixedpointlist(P_2,X1,Xs)).

The implementation is based, in part, on if_/3 and reified term equality (=)/3 by @false.

Are above definitions useful idioms?

  • 1
    \$\begingroup\$ Useful no doubt but your post could be improved with some usage examples. \$\endgroup\$ – Paulo Moura Jan 2 '16 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.