@@ -1684,8 +1684,8 @@ typed_hcat(::Type{T}) where {T} = Vector{T}()
16841684# # cat: special cases
16851685vcat (X:: T... ) where {T} = T[ X[i] for i= eachindex (X) ]
16861686vcat (X:: T... ) where {T<: Number } = T[ X[i] for i= eachindex (X) ]
1687- hcat (X:: T... ) where {T} = T[ X[j] for i = 1 : 1 , j= eachindex (X) ]
1688- hcat (X:: T... ) where {T<: Number } = T[ X[j] for i = 1 : 1 , j= eachindex (X) ]
1687+ hcat (X:: T... ) where {T} = T[ X[j] for _ = 1 : 1 , j= eachindex (X) ]
1688+ hcat (X:: T... ) where {T<: Number } = T[ X[j] for _ = 1 : 1 , j= eachindex (X) ]
16891689
16901690vcat (X:: Number... ) = hvcat_fill! (Vector {promote_typeof(X...)} (undef, length (X)), X)
16911691hcat (X:: Number... ) = hvcat_fill! (Matrix {promote_typeof(X...)} (undef, 1 ,length (X)), X)
@@ -1827,7 +1827,7 @@ function cat_shape(dims, shapes::Tuple)
18271827 return out_shape
18281828end
18291829# The new way to compute the shape (more inferable than combining cat_size & cat_shape, due to Varargs + issue#36454)
1830- cat_size_shape (dims) = ntuple (zero , Val (length (dims)))
1830+ cat_size_shape (dims) = ntuple (Returns ( 0 ) , Val (length (dims)))
18311831@inline cat_size_shape (dims, X, tail... ) = _cat_size_shape (dims, _cshp (1 , dims, (), cat_size (X)), tail... )
18321832_cat_size_shape (dims, shape) = shape
18331833@inline _cat_size_shape (dims, shape, X, tail... ) = _cat_size_shape (dims, _cshp (1 , dims, shape, cat_size (X)), tail... )
@@ -1881,7 +1881,7 @@ end
18811881@inline cat_t (:: Type{T} , X... ; dims) where {T} = _cat_t (dims, T, X... )
18821882
18831883# Why isn't this called `__cat!`?
1884- __cat (A, shape, catdims, X... ) = __cat_offset! (A, shape, catdims, ntuple (zero , length (shape)), X... )
1884+ __cat (A, shape, catdims, X... ) = __cat_offset! (A, shape, catdims, ntuple (Returns ( 0 ) , length (shape)), X... )
18851885
18861886function __cat_offset! (A, shape, catdims, offsets, x, X... )
18871887 # splitting the "work" on x from X... may reduce latency (fewer costly specializations)
@@ -2388,13 +2388,13 @@ _typed_hvncat_0d_only_one() =
23882388function _typed_hvncat (:: Type{T} , :: Val{N} ) where {T, N}
23892389 N < 0 &&
23902390 throw (ArgumentError (" concatenation dimension must be non-negative" ))
2391- return Array {T, N} (undef, ntuple (x -> 0 , Val (N)))
2391+ return Array {T, N} (undef, ntuple (Returns ( 0 ) , Val (N)))
23922392end
23932393
23942394function _typed_hvncat (T:: Type , :: Val{N} , xs:: Number... ) where N
23952395 N < 0 &&
23962396 throw (ArgumentError (" concatenation dimension must be non-negative" ))
2397- A = cat_similar (xs[1 ], T, (ntuple (x -> 1 , Val (N - 1 ))... , length (xs)))
2397+ A = cat_similar (xs[1 ], T, (ntuple (Returns ( 1 ) , Val (N - 1 ))... , length (xs)))
23982398 hvncat_fill! (A, false , xs)
23992399 return A
24002400end
@@ -2408,7 +2408,7 @@ function _typed_hvncat(::Type{T}, ::Val{N}, as::AbstractArray...) where {T, N}
24082408 throw (ArgumentError (" concatenation dimension must be non-negative" ))
24092409 for a ∈ as
24102410 ndims (a) <= N || all (x -> size (a, x) == 1 , (N + 1 ): ndims (a)) ||
2411- return _typed_hvncat (T, (ntuple (x -> 1 , Val (N - 1 ))... , length (as), 1 ), false , as... )
2411+ return _typed_hvncat (T, (ntuple (Returns ( 1 ) , Val (N - 1 ))... , length (as), 1 ), false , as... )
24122412 # the extra 1 is to avoid an infinite cycle
24132413 end
24142414
@@ -2423,7 +2423,7 @@ function _typed_hvncat(::Type{T}, ::Val{N}, as::AbstractArray...) where {T, N}
24232423 end
24242424 end
24252425
2426- A = cat_similar (as[1 ], T, (ntuple (d -> size (as[1 ], d), N - 1 )... , Ndim, ntuple (x -> 1 , nd - N)... ))
2426+ A = cat_similar (as[1 ], T, (ntuple (d -> size (as[1 ], d), N - 1 )... , Ndim, ntuple (Returns ( 1 ) , nd - N)... ))
24272427 k = 1
24282428 for a ∈ as
24292429 for i ∈ eachindex (a)
@@ -2450,7 +2450,7 @@ function _typed_hvncat(::Type{T}, ::Val{N}, as...) where {T, N}
24502450 end
24512451 end
24522452
2453- A = Array {T, nd} (undef, ntuple (x -> 1 , Val (N - 1 ))... , Ndim, ntuple (x -> 1 , nd - N)... )
2453+ A = Array {T, nd} (undef, ntuple (Returns ( 1 ) , Val (N - 1 ))... , Ndim, ntuple (Returns ( 1 ) , nd - N)... )
24542454
24552455 k = 1
24562456 for a ∈ as
@@ -2518,7 +2518,7 @@ function hvncat_fill!(A::Array, row_first::Bool, xs::Tuple)
25182518 dd = nrc * (d - 1 )
25192519 for i ∈ 1 : nr
25202520 Ai = dd + i
2521- for j ∈ 1 : nc
2521+ for _ ∈ 1 : nc
25222522 @inbounds A[Ai] = xs[k]
25232523 k += 1
25242524 Ai += nr
@@ -2535,7 +2535,7 @@ end
25352535function _typed_hvncat (T:: Type , dims:: NTuple{N, Int} , row_first:: Bool , as... ) where {N}
25362536 # function barrier after calculating the max is necessary for high performance
25372537 nd = max (maximum (cat_ndims (a) for a ∈ as), N)
2538- return _typed_hvncat_dims (T, (dims... , ntuple (x -> 1 , nd - N)... ), row_first, as)
2538+ return _typed_hvncat_dims (T, (dims... , ntuple (Returns ( 1 ) , nd - N)... ), row_first, as)
25392539end
25402540
25412541function _typed_hvncat_dims (:: Type{T} , dims:: NTuple{N, Int} , row_first:: Bool , as:: Tuple ) where {T, N}
@@ -2644,7 +2644,7 @@ end
26442644function _typed_hvncat (T:: Type , shape:: NTuple{N, Tuple} , row_first:: Bool , as... ) where {N}
26452645 # function barrier after calculating the max is necessary for high performance
26462646 nd = max (maximum (cat_ndims (a) for a ∈ as), N)
2647- return _typed_hvncat_shape (T, (shape... , ntuple (x -> shape[end ], nd - N)... ), row_first, as)
2647+ return _typed_hvncat_shape (T, (shape... , ntuple (Returns ( shape[end ]) , nd - N)... ), row_first, as)
26482648end
26492649
26502650function _typed_hvncat_shape (:: Type{T} , shape:: NTuple{N, Tuple} , row_first, as:: Tuple ) where {T, N}
@@ -2976,8 +2976,8 @@ _vec_axis(A, ax=_iterator_axes(A)) = length(ax) == 1 ? only(ax) : OneTo(prod(len
29762976end
29772977
29782978function _dim_stack! (:: Val{dims} , B:: AbstractArray , x1, xrest) where {dims}
2979- before = ntuple (d -> Colon (), dims - 1 )
2980- after = ntuple (d -> Colon (), ndims (B) - dims)
2979+ before = ntuple (Returns ( Colon () ), dims - 1 )
2980+ after = ntuple (Returns ( Colon () ), ndims (B) - dims)
29812981
29822982 i = firstindex (B, dims)
29832983 copyto! (view (B, before... , i, after... ), x1)
@@ -3165,8 +3165,7 @@ _sub2ind_vec(i, I1, I...) = (@inline; (I1[i], _sub2ind_vec(i, I...)...))
31653165_sub2ind_vec (i) = ()
31663166
31673167function _ind2sub (inds:: Union{DimsInteger{N},Indices{N}} , ind:: AbstractVector{<:Integer} ) where N
3168- M = length (ind)
3169- t = ntuple (n-> similar (ind),Val (N))
3168+ t = ntuple (_-> similar (ind),Val (N))
31703169 for (i,idx) in pairs (IndexLinear (), ind)
31713170 sub = _ind2sub (inds, idx)
31723171 for j = 1 : N
0 commit comments