RosettaCodeData/Task/Loops-For-with-a-specified-step/Prolog/loops-for-with-a-specified-step-2.pro
2019-09-12 10:33:56 -07:00

2 lines
117 B
Prolog

for(Hi,Lo,Step,Hi) :- Step<0, Lo=<Hi.
for(Hi,Lo,Step,Val) :- Step<0, plus(Hi,Step,V), Lo=<V, !, for(V,Lo,Step,Val).