As you can see from my predicate iterate, I am repeating
Z is X-3 and
Z is X-2, the scenarios are different if the value is 0 or greater than 0. thus why the duplicates,
Was wondering if there was a way round this
iterate(, ). %Nothing to change iterate([1|T], T). iterate([X|T], [Z|T]) :- % Change only the headT ( Z is X - 3 ; Z is X - 2 ), Z>0 . iterate([X|T], T) :- % Change only the head ( Z is X - 3 ; Z is X - 2 ), Z is 0 . iterate([X|Xs], [X|Ys]) :- %Keep the head and change something later iterate(Xs, Ys).