diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-11-02 07:17:39 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-11-02 07:17:39 -0700 |
commit | e9df3633bfb7f9786fd517cb769be3b620c7ed36 (patch) | |
tree | 69c2e2ae0aa2566571285695ae92349ee05be320 /stdlib/compiler.tl | |
parent | 15e1c259cfe7a961b97cbd4ca3e148f22554e832 (diff) | |
download | txr-e9df3633bfb7f9786fd517cb769be3b620c7ed36.tar.gz txr-e9df3633bfb7f9786fd517cb769be3b620c7ed36.tar.bz2 txr-e9df3633bfb7f9786fd517cb769be3b620c7ed36.zip |
compiler: rephrase length check with tree-case.
* stdlib/compiler.tl (compiler comp-arith-neg-form): Instead
of the length check on the form, we can use a tree case to
require three argument.
Diffstat (limited to 'stdlib/compiler.tl')
-rw-r--r-- | stdlib/compiler.tl | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl index 5330161d..52a0b85a 100644 --- a/stdlib/compiler.tl +++ b/stdlib/compiler.tl @@ -1261,13 +1261,12 @@ me.(comp-fun-form oreg env form))) (defmeth compiler comp-arith-neg-form (me oreg env form) - (if (> (len form) 3) - (tree-bind (nop . args) form - (let ((op (caseq nop (- '+) (/ '*))) - (a1 (car args))) - me.(comp-fun-form oreg env - ^(,nop ,(car args) (,op ,*(cdr args)))))) - me.(comp-fun-form oreg env form))) + (tree-case form + ((nop a1 a2 a3 . args) + (let ((op (caseq nop (- '+) (/ '*)))) + me.(comp-fun-form oreg env + ^(,nop ,a1 (,op ,a2 ,a3 ,*args))))) + (else me.(comp-fun-form oreg env form)))) (defmeth compiler comp-fun-form (me oreg env form) (let* ((olev *opt-level*) |