I have the following code:
pick_even([], []).
pick_even([_, H | T], [H | R]) :-
pick_even(T, R).
pick_even([_, H , _ | T], [H | R]) :-
pick_even(T, R).
When running the query, ?- pick_even(L,[4,7])., I want to receive the output:
L = [_7650, 4, _7662, 7] ;
L = [_7650, 4, _7662, 7, _7674] ;
Instead I am receiving some extra outputs that I do not want:
L = [_7650, 4, _7662, 7] ;
L = [_7650, 4, _7662, 7, _7674] ;
L = [_7650, 4, _7662, _7668, 7] ;
L = [_7650, 4, _7662, _7668, 7, _7680].
How can I eliminate these extra outputs without modifying the query?
I'm brand new to prolog, so I expect this to be a very easy syntax fix.