[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Order of arguments to :test functions



p.209: I assume it is intended that remove-duplicates and delete-duplicates
will not change the order of elements in the sequence, unlike intersection
(for example).  This is implied but not stated explicitly.  It's particularly
important when the :test function is something that is not commutative,
subtypep to take a real example.

Of course the ability to use subtypep as a :test function also relies on
a reading of pp.202-203 that may perhaps be stricter than what you intended.
In our implementation the order of arguments to the test function is
always strictly guaranteed; informally the rule is "the order of arguments
to the test function is the same as the order of arguments to the original
function."  For things that take one sequence argument and compare
two elements of that sequence, e.g. remove-duplicates, the order of arguments
to the test function is the same as the order of elements in the sequence.

The manual might want to take a stronger stand on this, or else state clearly
that it does not take a stand on this.  Users will rely on anything they discover
about an implementation that they aren't explicitly told not to rely on.
Actually I think guaranteeing the order of arguments to the :test function
is quite worthwhile.