Permalink
Browse files

don't kill double negation

  • Loading branch information...
1 parent c404d88 commit 1d8ed19a816d5c86984c5bb949b6625592a429be @mishoo committed Dec 19, 2010
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/squeeze.lisp
View
@@ -309,7 +309,15 @@
(:unary-prefix (op ex)
(when (eq op :!)
- (best-of expr (negate ex))))
+ (let ((ex (walk ex)))
+ (when (and (eq (car ex) :unary-prefix)
+ (eq (cadr ex) :!))
+ (let ((p (cadr stack)))
+ (when (and (eq (car p) :unary-prefix)
+ (eq (cadr p) :!))
+ (return (caddr ex)))
+ (return `(:unary-prefix :! ,ex))))
+ (best-of expr (negate ex)))))
(:atom (val)
(case val

0 comments on commit 1d8ed19

Please sign in to comment.