Perhaps comparing ASTs isn't a very common operation, but I came across the following which I found surprising. I think it is even arguable that ==
should ignore the facts that NaNs are not numerically equal to themselves since it's not really numerical comparison.
julia> :(f($NaN)) == :(f($NaN))
false
julia> isequal(:(f($NaN)), :(f($NaN)))
false
It looks like we need an isequal
method for Expr that calls isequal
recursively.
it is even arguable that == should ignore the facts that NaNs are not numerically equal to themselves since it's not really numerical comparison.
NaN literal is not NaN value, yep
Very good point. The real solution is probably for ==
on Exprs to use isequal
to compare elements.
Most helpful comment
NaN literal is not NaN value, yep