Wednesday, 15 May 2013

find even positions in prolog -



find even positions in prolog -

evenpositions([],[]). evenpositions([x], []). evenpositions([x, y|r], [x|tail1]) :- evenpositions(r,tail1).

i missing lastly single element left in list while finding positions .

when run evenpositions([a,b,c,d,e,f,g],z). not including g in list.

prolog

No comments:

Post a Comment