removeAll(X, [ X | T], [ H1 | T1 ] ):-
( member ( X , T )
-> removeAll ( X , T , [ H1 | T1 ] )
;[ H1 | T1 ] is T
).
removeAll ( X , [ H | T ] , L ):-
removeAll ( X , T , L2 ), append ( [ H ] , L2 , L ).
If i pass "removeAll(2,[1,1,2],L)
.",
it gives the error "ERROR: is/2: Type error: 'evaluable' expected, found '[]' (an empty_list)
".
If i pass "removeAll(1,[1,1,2],L).
" , it returns false.
Really confused. Where am i going wrong ?