I'm stuck on this issue with lists in SWI-prolog. In Prolog a variable can be written once, so i can't deal with this problem.
check(Parameter, [H | T], Result) :-
get_res(Parameter, H, Res),
check(Res, T, Result).
So, predicate check/3 takes a parameter, a list and gives me the final result. get_res/3 gives me a middle result i use as an input for the recursive case of check/3. So in Result i must have Res for each recursive call. I tried to use append([Parameter], [], Result) before the recursive call but the first time succeeds, then it fails because Result can't be rewritten. I know i also need a base case, it may could be check(_, [], []). But I'm not even sure on that