I'm new to prolog .. i tried this code but got error and don't know why ?!
de(F,L,R):-
R=[F|L].
is that because rule must have a recursion ? the error is
ERROR: Syntax error: Operator expected
In your comment, you specify what you did wrong:
i tested it as
de[a,[a,1,2,3],Z].
When you call a predicate, you use parenthesis ((…)), square brackets ([…]) are used to construct lists. You thus should call the predicate with parenthesis:
?- def(a,[a,1,2,3],Z).
Z = [a, a, 1, 2, 3].
de(a, [a,3,4,5,2], Z). - Willem Van Onsem