On 11/12/13 12:45 PM, Vladimir Panteleev wrote:
assert((equiv(a, b) && equiv(b, c)) <= equiv(a, c));

OK, we're on the same page so far (although you've presented the problem
more eloquently).

("<=" on Booleans is actually implication.)

(Cool!)

(... the disadvantage being b is evaluated even if a is false. Shouldn't; false implies everything.)

That test will fail with NaNs and should be part of isSorted, sort etc.

OK, but which a, b and c will be checked? Taking all adjacent triples
will not work with two adjacent NaNs.

We can make that work if we insert the tests at the end of a run of equivalent values. That would still miss other cases though in isSorted (I think sort() can actually be much more thorough there). The point here is that we should work together on an innovative solution. Getting bogged in the "there's a problem with the language here" mindset prevents the forming of good ideas.

We should also check such as:

assert(!less(a, a));
assert(less(a, b) <= !less(b, a));

Again, for which a/b?

In the isSorted case, for all adjacent values inspected. For sort, assertions can be added after each less() that does work.


Andrei

Reply via email to