 <p>Basically you want to implement a set; check the l<a href="http://www.swi-prolog.org/pldoc/doc_for?object=section%282,%27A.12%27,swi%28%27/doc/Manual/lists.html%27%29%29" rel="nofollow">ist manual page</a> for set operations. It appears that there is no add but there is <a href="http://www.swi-prolog.org/pldoc/doc_for?object=union/3" rel="nofollow">union/3</a> so you can add elements by intersecting with a set of the new element (intersection([NewEl], OldSet, NewSet). Note that you dont have to convert a list to a set (a list is a set as long as it doesnt have duplicates; list_to_set/2 just eliminates them).</p> <p>Now if you have a list with duplicates and you want sometimes to add an element the way you stated you will have to implement something yourself. </p>