All outcomes for subtraction on each value in list individually

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).
• Can you change your question title to reflect what your code does – Siobhan Nov 23 '16 at 22:31
• yeah sorry I'm new here @TolaniJaiye-Tikolo – Small Legend Nov 23 '16 at 22:33
• It is still extremely unclear to me what this predicate is supposed to do. – Fatalize Nov 25 '16 at 14:28
• If ~ is X - 3 and Z is 0, then the condition can be written simply as X = 3. Thus the whole branch can be written as iterate([X|T], T) :- (X = 3 ; X = 2)., or perhaps even simpler: iterate([3|T], T). iterate([2|T], T). which you seem to be already doing in iterate([1|T], T).. But it's really difficult to understand the desired result. – wvxvw Oct 24 '17 at 9:30