vniquify(expressionlist) → expressionlist
The subroutine zniquify takes an array of expressions as argument and returns a copy in which all duplicates have been removed. The items not removed occur in the same order as in the original array.
Call: uniquify(['c','b','c','b','a'])
Exit: [c,b,a]
Call: grindem(uniquify([read('p(b,c)'),read('p(a,b)'),read('p(a,b)')]))
Exit: p(b,c)
p(a,b)
zniquify runs in quadratic time for lists up to length 10 and n*log n time for larger lists. Keeping the entries in the original order requires a little extra time that makes the quadratic faster on small lists. However, the quadratic dominates on larger lists. Hence the conditional. Compare to uniquify and vniquify.
|