- Added termlistAddNew function to mimic set behaviour.
This commit is contained in:
parent
f8aacee6ad
commit
9723fff382
@ -215,6 +215,19 @@ termlistAppend (const Termlist tl, const Term term)
|
||||
return tl;
|
||||
}
|
||||
|
||||
//! Add a term only to a list if it wasn't in it before.
|
||||
/**
|
||||
* Mimics a basic set type behaviour.
|
||||
*/
|
||||
Termlist
|
||||
termlistAddNew (const Termlist tl, const term t)
|
||||
{
|
||||
if (inTermlist (tl, t))
|
||||
return tl;
|
||||
else
|
||||
return termlistAdd (tl, t);
|
||||
}
|
||||
|
||||
//! Concatenates two termlists.
|
||||
/**
|
||||
* The last pointer of the first list is made to point to the second list.
|
||||
@ -762,3 +775,5 @@ int termlistOrder (Termlist tl1, Termlist tl2)
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,6 +32,7 @@ __inline__ int inTermlist (Termlist tl, const Term term);
|
||||
int isTermlistEqual (Termlist tl1, Termlist tl2);
|
||||
Termlist termlistAdd (Termlist tl, Term term);
|
||||
Termlist termlistAppend (const Termlist tl, const Term term);
|
||||
Termlist termlistAddNew (const Termlist tl, const term t);
|
||||
Termlist termlistConcat (Termlist tl1, Termlist tl2);
|
||||
Termlist termlistDelTerm (Termlist tl);
|
||||
Termlist termlistConjunct (Termlist tl1, Termlist tl2);
|
||||
|
Loading…
Reference in New Issue
Block a user