From 6bd89e9123a78f60fa88f7683f24e2853510b8b8 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 18 Feb 2021 07:46:11 -0800 Subject: compiler: reduce (not (eq ...)) and related exprs. * share/txr/stdlib/compiler.tl (compiler comp-fun-form): Reduce negated eq, eql, equal to neq, neql, nequal. --- share/txr/stdlib/compiler.tl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 4b3ee0df..ebc2bda3 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -1161,6 +1161,9 @@ ((or (eql-comparable a) (eql-comparable b)) (set form ^(eql ,a ,b))))) + ((not (@(and @(or eq eql equal) @op) @a @b)) + (let ((nop (caseq op (eq 'neq) (eql 'neql) (equal 'nequal)))) + (return-from comp-fun-form me.(compile oreg env ^(,nop ,a ,b))))) ((@(or append cons list list*) . @args) (set form (reduce-lisp form))) ((@(@bin [%bin-op% @sym]) @a @b) -- cgit v1.2.3