At Fri, 2 Mar 2018 12:34:00 +0100, "'Paulo Matos' via Racket Developers" wrote: > (define (f x y) > (if (and (zero? x) > (= (+ x y) y)) > 1 > 0)) > > In reality this is the same as: > (define (f x y) > (if (zero? x) > 1 > 0))
Those turn out to be different. Try `(f 0 +nan.0)` or `(f 0 'symbol)`. > Except racket does not perform the optimization. What's the reason for > this? Even if you throw in enough constraints on the program to make a similar transformation valid, the optimizer would have to include specific mechanisms for tracking zero values and number types (more than it does) and rules on how arithmetic operations interact with those abstract values. We haven't so far had a reason to create all of those rules. And as your example illustrates, they'd help less often than you might expect. -- You received this message because you are subscribed to the Google Groups "Racket Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/5a9ea2cc.1ae0620a.a66d5.9dbdSMTPIN_ADDED_MISSING%40gmr-mx.google.com. For more options, visit https://groups.google.com/d/optout.
