#1180 simple_equal

Lisp Core (471)

simple_equal has a line of bogus and unreachable code (defined in mload of all places)

(defun $simple_equal (f g)
"checks if equal up to simp flags"
(cond ((quote-simple-equal f g))
((quote-simple-equal g f))
((and (numberp f) (numberp g)
(or (eql f g))
(< (- f g) 1.0e-4))) <-- never happens

Also, simple_equal isn't documented. It's likely that
simple_equal isn't needed, but it's nice that it
(apparently) tests for equality without converting
CRE expressions to general form.


  • Stavros Macrakis

    Logged In: YES
    Originator: NO

    The whole piece of code is weird.

    The (or...) clause was presumably intended to be (or (eql f g) (< (- f g) 1.0e-4)), but that would be pretty ridiculous code, since it would make 0.0 == 1.0 but 1.0 /== 0.0. Fixing that with (abs (- f g)) would make 1.0e-5 == 1.0e-100.

    The rat case relies on the varlists being the same; is that desired?

    simple_equal(rat(x,x,y),rat(x,y,x)) => false.

    The quote case is completely weird; not clear what it is trying to do:

    simple_equal( '('(y+1)), '('(x+2)) ) => true (!!!!)

    simple_equal( '('(y+1)), '('(2)) ) => Lisp error

    Simple_equal seems to be used by run_testsuite to see if actuals match expected. It makes me a bit nervous in that role, but it makes me even more nervous to see it exposed to users as a $-function. Let's rename it to simple-equal....

  • Barton Willis

    Barton Willis - 2007-05-31
    • status: open --> closed
  • Barton Willis

    Barton Willis - 2007-05-31

    Logged In: YES
    Originator: YES

    Fixed in mload CVS revision 1.43. The simple_equal function has been deleted.


Log in to post a comment.