Skip to content

Commit 8a8a382

Browse files
committed
make vcats explicit
1 parent 63938e6 commit 8a8a382

33 files changed

+78
-78
lines changed

base/abstractarray.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ function circshift(a, shiftamts)
612612
for i=1:n
613613
s = size(a,i)
614614
d = i<=length(shiftamts) ? shiftamts[i] : 0
615-
I[i] = d==0 ? (1:s) : mod([-d:s-1-d], s)+1
615+
I[i] = d==0 ? (1:s) : mod([-d:s-1-d;], s)+1
616616
end
617617
a[I...]::typeof(a)
618618
end
@@ -1493,7 +1493,7 @@ function mapslices(f::Function, A::AbstractArray, dims::AbstractVector)
14931493

14941494
dimsA = [size(A)...]
14951495
ndimsA = ndims(A)
1496-
alldims = [1:ndimsA]
1496+
alldims = [1:ndimsA;]
14971497

14981498
if dims == alldims
14991499
return f(A)

base/array.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function reinterpret{T,S,N}(::Type{T}, a::Array{S}, dims::NTuple{N,Int})
125125
end
126126
ccall(:jl_reshape_array, Array{T,N}, (Any, Any, Any), Array{T,N}, a, dims)
127127
end
128-
reinterpret(t::Type,x) = reinterpret(t,[x])[1]
128+
reinterpret(t::Type,x) = reinterpret(t,[x;])[1]
129129

130130
function reshape{T,N}(a::Array{T}, dims::NTuple{N,Int})
131131
if prod(dims) != length(a)

base/base64.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ end
3030

3131
# Based on code by Stefan Karpinski from https://github.com/hackerschool/WebSockets.jl (distributed under the same MIT license as Julia)
3232

33-
const b64chars = ['A':'Z','a':'z','0':'9','+','/']
33+
const b64chars = ['A':'Z';'a':'z';'0':'9';'+';'/']
3434

3535
function b64(x::Uint8, y::Uint8, z::Uint8)
3636
n = int(x)<<16 | int(y)<<8 | int(z)

base/combinatorics.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function combinations(a, t::Integer)
190190
Combinations(a, t)
191191
end
192192

193-
start(c::Combinations) = [1:c.t]
193+
start(c::Combinations) = [1:c.t;]
194194
function next(c::Combinations, s)
195195
comb = c.a[s]
196196
if c.t == 0
@@ -224,7 +224,7 @@ length(c::Permutations) = factorial(length(c.a))
224224

225225
permutations(a) = Permutations(a)
226226

227-
start(p::Permutations) = [1:length(p.a)]
227+
start(p::Permutations) = [1:length(p.a);]
228228
function next(p::Permutations, s)
229229
if length(p.a) == 0
230230
# special case to generate 1 result for len==0
@@ -329,7 +329,7 @@ function nextfixedpartition(n, m, bs)
329329
as = copy(bs)
330330
if isempty(as)
331331
# First iteration
332-
as = [n-m+1, ones(Int, m-1)]
332+
as = [n-m+1; ones(Int, m-1)]
333333
elseif as[2] < as[1]-1
334334
# Most common iteration
335335
as[1] -= 1

base/dsp.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ function conv{T<:Base.LinAlg.BlasFloat}(u::StridedVector{T}, v::StridedVector{T}
8787
nv = length(v)
8888
n = nu + nv - 1
8989
np2 = n > 1024 ? nextprod([2,3,5], n) : nextpow2(n)
90-
upad = [u, zeros(T, np2 - nu)]
91-
vpad = [v, zeros(T, np2 - nv)]
90+
upad = [u; zeros(T, np2 - nu)]
91+
vpad = [v; zeros(T, np2 - nv)]
9292
if T <: Real
9393
p = plan_rfft(upad)
9494
y = irfft(p(upad).*p(vpad), np2)

base/fftw.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ function dims_howmany(X::StridedArray, Y::StridedArray,
261261
ist = [strides(X)...]
262262
ost = [strides(Y)...]
263263
dims = [sz[reg] ist[reg] ost[reg]]'
264-
oreg = [1:ndims(X)]
264+
oreg = [1:ndims(X);]
265265
oreg[reg] = 0
266266
oreg = filter(d -> d > 0, oreg)
267267
howmany = [sz[oreg] ist[oreg] ost[oreg]]'

base/inference.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ function typeinf(linfo::LambdaStaticData,atypes::Tuple,sparams::Tuple, def, cop)
11791179
la = length(args)
11801180
assert(is(ast.head,:lambda))
11811181
locals = (ast.args[2][1])::Array{Any,1}
1182-
vars = [args, locals]
1182+
vars = [args; locals]
11831183
body = (ast.args[3].args)::Array{Any,1}
11841184
n = length(body)
11851185

@@ -2054,7 +2054,7 @@ function inlining_pass(e::Expr, sv, ast)
20542054
return (e,stmts)
20552055
end
20562056
end
2057-
e.args = [{e.args[2]}, newargs...]
2057+
e.args = [{e.args[2]}; newargs...]
20582058

20592059
# now try to inline the simplified call
20602060

base/intfuncs.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ end
263263

264264
num2hex(n::Integer) = hex(n, sizeof(n)*2)
265265

266-
const base36digits = ['0':'9','a':'z']
267-
const base62digits = ['0':'9','A':'Z','a':'z']
266+
const base36digits = ['0':'9';'a':'z']
267+
const base62digits = ['0':'9';'A':'Z';'a':'z']
268268

269269
function base(b::Int, x::Unsigned, pad::Int, neg::Bool)
270270
if !(2 <= b <= 62) error("invalid base: $b") end

base/io.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## byte-order mark, ntoh & hton ##
88

9-
const ENDIAN_BOM = reinterpret(Uint32,uint8([1:4]))[1]
9+
const ENDIAN_BOM = reinterpret(Uint32, 0x1:0x4)
1010

1111
if ENDIAN_BOM == 0x01020304
1212
ntoh(x) = identity(x)

base/linalg/factorization.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function getindex{T}(A::LU{T}, d::Symbol)
161161
d == :L && return tril(A.factors[1:m, 1:min(m,n)], -1) + eye(T, m, min(m,n))
162162
d == :U && return triu(A.factors[1:min(m,n),1:n])
163163
if d == :p
164-
p = [1:m]
164+
p = [1:m;]
165165
for i in 1:length(A.ipiv)
166166
p[i], p[A.ipiv[i]] = p[A.ipiv[i]], p[i]
167167
end
@@ -323,8 +323,8 @@ function \{T<:BlasFloat}(A::QRPivoted{T}, B::StridedMatrix{T}, rcond::Real)
323323
tmin, smin, cmin = LAPACK.laic1!(2, sub(xmin, 1:rnk), tmin, sub(A.hh, 1:rnk, rnk + 1), A.hh[rnk + 1, rnk + 1])
324324
tmax, smax, cmax = LAPACK.laic1!(1, sub(xmax, 1:rnk), tmax, sub(A.hh, 1:rnk, rnk + 1), A.hh[rnk + 1, rnk + 1])
325325
tmax*rcond > tmin && break
326-
xmin[1:rnk + 1] = [smin*sub(xmin, 1:rnk), cmin]
327-
xmax[1:rnk + 1] = [smax*sub(xmin, 1:rnk), cmax]
326+
xmin[1:rnk + 1] = [smin*sub(xmin, 1:rnk); cmin]
327+
xmax[1:rnk + 1] = [smax*sub(xmin, 1:rnk); cmax]
328328
rnk += 1
329329
# if cond(r[1:rnk, 1:rnk])*rcond < 1 break end
330330
end

base/linalg/generic.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ function diff(A::AbstractMatrix, dim::Integer)
3434
end
3535

3636

37-
gradient(F::AbstractVector) = gradient(F, [1:length(F)])
38-
gradient(F::AbstractVector, h::Real) = gradient(F, [h*(1:length(F))])
37+
gradient(F::AbstractVector) = gradient(F, [1:length(F);])
38+
gradient(F::AbstractVector, h::Real) = gradient(F, [h*(1:length(F));])
3939
#gradient(F::AbstractVector, h::AbstractVector)
4040

4141
diag(A::AbstractVector) = error("use diagm instead of diag to construct a diagonal matrix")

base/linalg/lapack.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2113,7 +2113,7 @@ for (stev, stebz, stegr, stein, elty) in
21132113
function stegr!(jobz::BlasChar, range::BlasChar, dv::Vector{$elty}, ev::Vector{$elty}, vl::Real, vu::Real, il::Integer, iu::Integer)
21142114
n = length(dv)
21152115
if length(ev) != (n-1) throw(DimensionMismatch("stebz!")) end
2116-
eev = [ev, zero($elty)]
2116+
eev = [ev; zero($elty)]
21172117
abstol = Array($elty, 1)
21182118
m = Array(BlasInt, 1)
21192119
w = Array($elty, n)

base/multi.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function rmprocs(args...; waitfor = 0.0)
251251
global rmprocset
252252
empty!(rmprocset)
253253

254-
for i in [args...]
254+
for i in vcat(args...)
255255
if i == 1
256256
warn("rmprocs: process 1 not removed")
257257
else

base/pkg/resolve/maxsum.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ type Graph
148148
end
149149
end
150150

151-
perm = [1:np]
151+
perm = [1:np;]
152152

153153
return new(gadj, gmsk, gdir, adjdict, spp, perm, np)
154154
end

base/sort.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ sort(v::AbstractVector; kws...) = sort!(copy(v); kws...)
324324

325325
sortperm(v::AbstractVector; alg::Algorithm=DEFAULT_STABLE,
326326
lt::Function=isless, by::Function=identity, rev::Bool=false, order::Ordering=Forward) =
327-
sort!([1:length(v)], alg, Perm(ord(lt,by,rev,order),v))
327+
sort!([1:length(v);], alg, Perm(ord(lt,by,rev,order),v))
328328

329329
## sorting multi-dimensional arrays ##
330330

base/sparse/sparsematrix.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ eye(S::SparseMatrixCSC) = speye(S)
406406

407407
function speye(T::Type, m::Integer, n::Integer)
408408
x = min(m,n)
409-
rowval = [1:x]
410-
colptr = [rowval, fill(int(x+1), n+1-x)]
409+
rowval = [1:x;]
410+
colptr = [rowval; fill(int(x+1), n+1-x)]
411411
nzval = ones(T, x)
412412
return SparseMatrixCSC(m, n, colptr, rowval, nzval)
413413
end
@@ -934,7 +934,7 @@ end
934934
function getindex{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, I::AbstractVector, J::AbstractVector)
935935
m = size(A, 1)
936936

937-
if isa(I, Range) || isa(I, Range1); I = [I]; end
937+
if isa(I, Range) || isa(I, Range1); I = [I;]; end
938938

939939
if I == 1:m
940940
return getindex_cols(A, J)

base/string.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ rsearch(a::ByteArray, b::Union(Int8,Uint8,Char)) = rsearch(a,b,length(a))
16181618
# return a random string (often useful for temporary filenames/dirnames)
16191619
let
16201620
global randstring
1621-
const b = uint8(['0':'9','A':'Z','a':'z'])
1621+
const b = uint8(['0':'9';'A':'Z';'a':'z'])
16221622
randstring(n::Int) = ASCIIString(b[rand(1:length(b),n)])
16231623
randstring() = randstring(8)
16241624
end

src/uv_constants.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const uv_handle_types = [UV_HANDLE_TYPE_MAP(XX) :UV_FILE]
55
const uv_req_types = [UV_REQ_TYPE_MAP(XX)]
66
const uv_err_vals = [UV_ERRNO_MAP(YY)]
77
let
8-
handles = [:UV_UNKNOWN_HANDLE, uv_handle_types, :UV_HANDLE_TYPE_MAX, :UV_RAW_FD, :UV_RAW_HANDLE]
9-
reqs = [:UV_UNKNOWN_REQ, uv_req_types, :UV_REQ_TYPE_PRIVATE,:UV_REQ_TYPE_MAX]
8+
handles = [:UV_UNKNOWN_HANDLE; uv_handle_types; :UV_HANDLE_TYPE_MAX; :UV_RAW_FD; :UV_RAW_HANDLE]
9+
reqs = [:UV_UNKNOWN_REQ; uv_req_types; :UV_REQ_TYPE_PRIVATE; :UV_REQ_TYPE_MAX]
1010
for i=0:(length(handles)-1)
1111
@eval const $(handles[i+1]) = $i
1212
end

test/arrayops.jl

+16-16
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ a = reshape(b, (2, 2, 2, 2, 2))
5151
sz = (5,8,7)
5252
A = reshape(1:prod(sz),sz...)
5353
tmp = A[2:6]
54-
@test tmp == [2:6]
54+
@test tmp == [2:6;]
5555
tmp = A[1:3,2,2:4]
5656
@test tmp == cat(3,46:48,86:88,126:128)
5757
tmp = A[:,7:-3:1,5]
@@ -123,7 +123,7 @@ sA = sub(A, 1:2:3, 1:3:5, 1:2:8)
123123
@test sA[:] == A[1:2:3, 1:3:5, 1:2:8][:]
124124

125125
# sub logical indexing #4763
126-
A = sub([1:10], 5:8)
126+
A = sub(1:10, 5:8)
127127
@test A[A.<7] == [5, 6]
128128
B = reshape(1:16, 4, 4)
129129
sB = sub(B, 2:3, 2:3)
@@ -153,7 +153,7 @@ sA = slice(A, 1:2:3, 3, 1:2:8)
153153
@test strides(sA) == (2,30)
154154
@test sA[:] == A[sA.indexes...][:]
155155

156-
a = [5:8]
156+
a = 5:8
157157
@test parent(a) == a
158158
@test parentindexes(a) == (1:4,)
159159

@@ -193,13 +193,13 @@ let
193193
@test x == -12
194194
X = get(A, -5:5, nan(Float32))
195195
@test eltype(X) == Float32
196-
@test isnan(X) == [trues(6),falses(5)]
196+
@test isnan(X) == [trues(6);falses(5)]
197197
@test X[7:11] == 1:5
198198
X = get(A, (2:4, 9:-2:-13), 0)
199199
Xv = zeros(Int, 3, 12)
200200
Xv[1:2, 2:5] = A[2:3, 7:-2:1]
201201
@test X == Xv
202-
X2 = get(A, Vector{Int}[[2:4], [9:-2:-13]], 0)
202+
X2 = get(A, Vector{Int}[[2:4;], [9:-2:-13;]], 0)
203203
@test X == X2
204204
end
205205

@@ -220,7 +220,7 @@ v = shift!(l)
220220

221221
# concatenation
222222
@test isequal([ones(2,2) 2*ones(2,1)], [1. 1 2; 1 1 2])
223-
@test isequal([ones(2,2), 2*ones(1,2)], [1. 1; 1 1; 2 2])
223+
@test isequal([ones(2,2); 2*ones(1,2)], [1. 1; 1 1; 2 2])
224224

225225
# typed array literals
226226
X = Float64[1 2 3]
@@ -526,9 +526,9 @@ begin
526526
3 3 4 4 3 3 4 4;
527527
3 3 4 4 3 3 4 4]
528528

529-
A = reshape([1:8], 2, 2, 2)
529+
A = reshape(1:8, 2, 2, 2)
530530
R = repeat(A, inner = [1, 1, 2], outer = [1, 1, 1])
531-
T = reshape([1:4, 1:4, 5:8, 5:8], 2, 2, 4)
531+
T = reshape([1:4; 1:4; 5:8; 5:8], 2, 2, 4)
532532
@test R == T
533533
A = Array(Int, 2, 2, 2)
534534
A[:, :, 1] = [1 2;
@@ -719,9 +719,9 @@ end
719719
for idx in {1, 2, 5, 9, 10, 1:0, 2:1, 1:1, 2:2, 1:2, 2:4, 9:8, 10:9, 9:9, 10:10,
720720
8:9, 9:10, 6:9, 7:10}
721721
for repl in {[], [11], [11,22], [11,22,33,44,55]}
722-
a = [1:10]; acopy = copy(a)
722+
a = [1:10;]; acopy = copy(a)
723723
@test splice!(a, idx, repl) == acopy[idx]
724-
@test a == [acopy[1:(first(idx)-1)], repl, acopy[(last(idx)+1):end]]
724+
@test a == [acopy[1:(first(idx)-1)]; repl; acopy[(last(idx)+1):end]]
725725
end
726726
end
727727

@@ -745,15 +745,15 @@ end
745745

746746
# reverse
747747
@test reverse([2,3,1]) == [1,3,2]
748-
@test reverse([1:10],1,4) == [4,3,2,1,5,6,7,8,9,10]
749-
@test reverse([1:10],3,6) == [1,2,6,5,4,3,7,8,9,10]
750-
@test reverse([1:10],6,10) == [1,2,3,4,5,10,9,8,7,6]
748+
@test reverse([1:10;],1,4) == [4,3,2,1,5,6,7,8,9,10]
749+
@test reverse([1:10;],3,6) == [1,2,6,5,4,3,7,8,9,10]
750+
@test reverse([1:10;],6,10) == [1,2,3,4,5,10,9,8,7,6]
751751
@test reverse(1:10,1,4) == [4,3,2,1,5,6,7,8,9,10]
752752
@test reverse(1:10,3,6) == [1,2,6,5,4,3,7,8,9,10]
753753
@test reverse(1:10,6,10) == [1,2,3,4,5,10,9,8,7,6]
754-
@test reverse!([1:10],1,4) == [4,3,2,1,5,6,7,8,9,10]
755-
@test reverse!([1:10],3,6) == [1,2,6,5,4,3,7,8,9,10]
756-
@test reverse!([1:10],6,10) == [1,2,3,4,5,10,9,8,7,6]
754+
@test reverse!([1:10;],1,4) == [4,3,2,1,5,6,7,8,9,10]
755+
@test reverse!([1:10;],3,6) == [1,2,6,5,4,3,7,8,9,10]
756+
@test reverse!([1:10;],6,10) == [1,2,3,4,5,10,9,8,7,6]
757757

758758
# flipdim
759759
@test isequal(flipdim([2,3,1], 1), [1,3,2])

test/bigint.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ee = typemax(Int64)
3333
@test string(d) == "-246913578024691357802469135780"
3434
@test string(a) == "123456789012345678901234567890"
3535

36-
for i = -10:10, j = [-10:-1,1:10]
36+
for i = -10:10, j = [-10:-1;1:10]
3737
@test div(BigInt(i), BigInt(j)) == div(i,j)
3838
@test fld(BigInt(i), BigInt(j)) == fld(i,j)
3939
@test mod(BigInt(i), BigInt(j)) == mod(i,j)

test/blas.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ for elty in (Float32, Float64, Complex64, Complex128)
1212

1313
elm1 = convert(elty, -1)
1414
el2 = convert(elty, 2)
15-
v14 = convert(Vector{elty}, [1:4])
16-
v41 = convert(Vector{elty}, [4:-1:1])
15+
v14 = convert(Vector{elty}, [1:4;])
16+
v41 = convert(Vector{elty}, [4:-1:1;])
1717

1818
# dot
1919
if elty <: Real

test/combinatorics.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
@test factorial(7) == 5040
22
@test factorial(7,3) == 7*6*5*4
33
@test binomial(5,3) == 10
4-
p = shuffle([1:1000])
4+
p = shuffle([1:1000;])
55
@test isperm(p)
66
@test all(invperm(invperm(p)) .== p)
77
push!(p, 1)
88
@test !isperm(p)
99
a = randcycle(10)
10-
@test ipermute!(permute!([1:10], a),a) == [1:10]
10+
@test ipermute!(permute!([1:10;], a),a) == [1:10;]
1111
@test collect(combinations("abc",2)) == ["ab","ac","bc"]
1212
@test collect(permutations("abc")) == ["abc","acb","bac","bca","cab","cba"]
1313
@test collect(filter(x->(iseven(x[1])),permutations([1,2,3]))) == {[2,1,3],[2,3,1]}

test/core.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -679,15 +679,15 @@ end
679679
let
680680
tst = 1
681681
m1(i) = (tst+=1;i-1)
682-
x = [1:4]
682+
x = [1:4;]
683683
x[1:end] *= 2
684-
@test x == [2:2:8]
684+
@test x == [2:2:8;]
685685
x[m1(end)] += 3
686686
@test x == [2,4,9,8]
687687
@test tst == 2
688688

689689
# issue #1886
690-
X = [1:4]
690+
X = [1:4;]
691691
r = Array(Range1{Int},1)
692692
r[1] = 2:3
693693
X[r...] *= 2
@@ -735,7 +735,7 @@ end
735735

736736
# issue #2098
737737
let
738-
i2098() = (c={2.0};[1:1:c[1]])
738+
i2098() = (c={2.0};[1:1:c[1];])
739739
@test isequal(i2098(), [1.0,2.0])
740740
end
741741

test/euler.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ end
252252
#23: 4179871
253253

254254
#24: 2783915460
255-
@test nthperm!([0:9],1000000) == [2,7,8,3,9,1,5,4,6,0]
255+
@test nthperm!([0:9;],1000000) == [2,7,8,3,9,1,5,4,6,0]
256256

257257
#25: 4782
258258
#26: 983

0 commit comments

Comments
 (0)