...
Y=1,MyWhileLoop(Y,Omega),% Omega is the upper limit)
....
MyWhileLoop(Y,Omega):-%This is your 'while' loopY<Omega,!,<do steps>MyWhileLoop1(Y,Omega,NewOmega),
...
MyWhileLoop(Y,Omega).
MyWhileLoop1(Y,Omega,NewOmega):-% this is the looping 'control' (value of Y)<do condition check for terminating>!,NewOmega=Y,MyWhileLoop(Y,NewOmega).
MyWhileLoop1(Y,Omega,NewOmega):-NewY=Y+1,NewOmege=Omega,MyWhileLoop(NewY,NewOmega).
I know how to do recursion, thank you.
The problem with recursion is that it eats up the whole of my stack.
The problem is not with tail-recursive predicates, but with others
that call each other thousands of times...
b.r. Michael
Are you trying to restart the same foreach() loop from within the foreach() loop but with new start and stop numbers based on a action/decision within that loop?
<clause>:-
... steps ...
foreach(), %change the iterations of this loop and restart just the loop from within
end foreach.
... more steps ...
<end clause>.
OR,
are you just trying to stop the loop 'early' once a condition is met?
I get both possibilities when reading your initial post.