From 3057ebc1870b80a270521ead514f13b64786e311 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 6 Sep 2018 23:37:03 -0400 Subject: [PATCH] slightly more efficient lowering of destructuring assignment There is no need to fetch the next state after the last element. --- src/julia-syntax.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 8d6a08daae273..323c6b472e2e9 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -1916,16 +1916,19 @@ (ssavalue? x)) x (make-ssavalue))) (ini (if (eq? x xx) '() `((= ,xx ,(expand-forms x))))) + (n (length lhss)) (st (gensy))) `(block ,@ini ,.(map (lambda (i lhs) (expand-forms (lower-tuple-assignment - (list lhs st) + (if (= i (- n 1)) + (list lhs) + (list lhs st)) `(call (top indexed_iterate) ,xx ,(+ i 1) ,.(if (eq? i 0) '() `(,st)))))) - (iota (length lhss)) + (iota n) lhss) (unnecessary ,xx)))))) ((typed_hcat)