fork download
  1. skip([],[]).
  2. skip([A|B],[A|C]):-replace(B,C,0).
  3.  
  4. replace([],[],_).
  5. replace([_|B],[X|C],X):-skip(B,C).
  6.  
  7. :-skip([1,2,3,4,5],X),write(X).
Success #stdin #stdout 0.02s 6204KB
stdin
Standard input is empty
stdout
[1, 0, 3, 0, 5]