From 59d676c95714b1991f6099e4d6633e69c454e28e Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Tue, 1 Dec 2020 01:00:36 -0500 Subject: [PATCH] streamline a[begin] lowering via firstindex(a, n) (#35779) --- NEWS.md | 1 + src/julia-syntax.scm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index edb1cbc7b1663..d74a3aa304cc0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -44,6 +44,7 @@ Language changes a function like other operators. The dotted version `.-->` is now parsed as well. For backwards compatibility, `-->` still parses using its own expression head instead of `:call`. +* The `a[begin]` syntax now calls `firstindex(a,1)` rather than `first(axes(a,1))` ([#35779]). * `⌿` (U+233F) and `¦` (U+00A6) are now infix operators with times-like and plus-like precedence, respectively. Previously they were parsed as identifier characters ([#37973]). diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 1f8d367586f73..f22fe57dcaa15 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -105,7 +105,7 @@ (if (null? tuples) (if (and last (= n 1)) `(call (top firstindex) ,a) - `(call (top first) (call (top axes) ,a ,n))) + `(call (top firstindex) ,a ,n)) (let ((dimno `(call (top +) ,(- n (length tuples)) ,.(map (lambda (t) `(call (top length) ,t)) tuples))))