Skip to content

Commit ccfeb93

Browse files
abhroinkydragonLilithHafner
authored
Minor documentation updates (#56883)
- Array/Vector/Matrix output showing - Syntax highlighting for fenced code block examples --------- Co-authored-by: Chengyu Han <cyhan.dev@outlook.com> Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>
1 parent 34c30dc commit ccfeb93

20 files changed

+97
-97
lines changed

base/asyncmap.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ The following examples highlight execution in different tasks by returning
2828
the `objectid` of the tasks in which the mapping function is executed.
2929
3030
First, with `ntasks` undefined, each element is processed in a different task.
31-
```
31+
```julia-repl
3232
julia> tskoid() = objectid(current_task());
3333
3434
julia> asyncmap(x->tskoid(), 1:5)
35-
5-element Array{UInt64,1}:
35+
5-element Vector{UInt64}:
3636
0x6e15e66c75c75853
3737
0x440f8819a1baa682
3838
0x9fb3eeadd0c83985
@@ -44,9 +44,9 @@ julia> length(unique(asyncmap(x->tskoid(), 1:5)))
4444
```
4545
4646
With `ntasks=2` all elements are processed in 2 tasks.
47-
```
47+
```julia-repl
4848
julia> asyncmap(x->tskoid(), 1:5; ntasks=2)
49-
5-element Array{UInt64,1}:
49+
5-element Vector{UInt64}:
5050
0x027ab1680df7ae94
5151
0xa23d2f80cd7cf157
5252
0x027ab1680df7ae94
@@ -60,12 +60,12 @@ julia> length(unique(asyncmap(x->tskoid(), 1:5; ntasks=2)))
6060
With `batch_size` defined, the mapping function needs to be changed to accept an array
6161
of argument tuples and return an array of results. `map` is used in the modified mapping
6262
function to achieve this.
63-
```
63+
```julia-repl
6464
julia> batch_func(input) = map(x->string("args_tuple: ", x, ", element_val: ", x[1], ", task: ", tskoid()), input)
6565
batch_func (generic function with 1 method)
6666
6767
julia> asyncmap(batch_func, 1:5; ntasks=2, batch_size=2)
68-
5-element Array{String,1}:
68+
5-element Vector{String}:
6969
"args_tuple: (1,), element_val: 1, task: 9118321258196414413"
7070
"args_tuple: (2,), element_val: 2, task: 4904288162898683522"
7171
"args_tuple: (3,), element_val: 3, task: 9118321258196414413"

base/docs/basedocs.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,11 @@ Assigning `a` to `b` does not create a copy of `b`; instead use [`copy`](@ref) o
406406
407407
```jldoctest
408408
julia> b = [1]; a = b; b[1] = 2; a
409-
1-element Array{Int64, 1}:
409+
1-element Vector{Int64}:
410410
2
411411
412412
julia> b = [1]; a = copy(b); b[1] = 2; a
413-
1-element Array{Int64, 1}:
413+
1-element Vector{Int64}:
414414
1
415415
416416
```
@@ -420,7 +420,7 @@ julia> function f!(x); x[:] .+= 1; end
420420
f! (generic function with 1 method)
421421
422422
julia> a = [1]; f!(a); a
423-
1-element Array{Int64, 1}:
423+
1-element Vector{Int64}:
424424
2
425425
426426
```
@@ -439,7 +439,7 @@ julia> a, b
439439
Assignment can operate on multiple variables in series, and will return the value of the right-hand-most expression:
440440
```jldoctest
441441
julia> a = [1]; b = [2]; c = [3]; a = b = c
442-
1-element Array{Int64, 1}:
442+
1-element Vector{Int64}:
443443
3
444444
445445
julia> b[1] = 2; a, b, c
@@ -449,11 +449,11 @@ julia> b[1] = 2; a, b, c
449449
Assignment at out-of-bounds indices does not grow a collection. If the collection is a [`Vector`](@ref) it can instead be grown with [`push!`](@ref) or [`append!`](@ref).
450450
```jldoctest
451451
julia> a = [1, 1]; a[3] = 2
452-
ERROR: BoundsError: attempt to access 2-element Array{Int64, 1} at index [3]
452+
ERROR: BoundsError: attempt to access 2-element Vector{Int64} at index [3]
453453
[...]
454454
455455
julia> push!(a, 2, 3)
456-
4-element Array{Int64, 1}:
456+
4-element Vector{Int64}:
457457
1
458458
1
459459
2
@@ -467,7 +467,7 @@ ERROR: DimensionMismatch: tried to assign 0 elements to 1 destinations
467467
[...]
468468
469469
julia> filter!(x -> x > 1, a) # in-place & thus more efficient than a = a[a .> 1]
470-
2-element Array{Int64, 1}:
470+
2-element Vector{Int64}:
471471
2
472472
3
473473
@@ -490,14 +490,14 @@ assignment expression is converted into a single loop.
490490
julia> A = zeros(4, 4); B = [1, 2, 3, 4];
491491
492492
julia> A .= B
493-
4×4 Array{Float64, 2}:
493+
4×4 Matrix{Float64}:
494494
1.0 1.0 1.0 1.0
495495
2.0 2.0 2.0 2.0
496496
3.0 3.0 3.0 3.0
497497
4.0 4.0 4.0 4.0
498498
499499
julia> A
500-
4×4 Array{Float64, 2}:
500+
4×4 Matrix{Float64}:
501501
1.0 1.0 1.0 1.0
502502
2.0 2.0 2.0 2.0
503503
3.0 3.0 3.0 3.0
@@ -1018,12 +1018,12 @@ collection or the last index of a dimension of an array.
10181018
# Examples
10191019
```jldoctest
10201020
julia> A = [1 2; 3 4]
1021-
2×2 Array{Int64, 2}:
1021+
2×2 Matrix{Int64}:
10221022
1 2
10231023
3 4
10241024
10251025
julia> A[end, :]
1026-
2-element Array{Int64, 1}:
1026+
2-element Vector{Int64}:
10271027
3
10281028
4
10291029
```
@@ -1429,12 +1429,12 @@ collection or the first index of a dimension of an array. For example,
14291429
# Examples
14301430
```jldoctest
14311431
julia> A = [1 2; 3 4]
1432-
2×2 Array{Int64,2}:
1432+
2×2 Matrix{Int64}:
14331433
1 2
14341434
3 4
14351435
14361436
julia> A[begin, :]
1437-
2-element Array{Int64,1}:
1437+
2-element Matrix{Int64}:
14381438
1
14391439
2
14401440
```
@@ -2826,7 +2826,7 @@ Construct an uninitialized [`Vector{T}`](@ref) of length `n`.
28262826
# Examples
28272827
```julia-repl
28282828
julia> Vector{Float64}(undef, 3)
2829-
3-element Array{Float64, 1}:
2829+
3-element Vector{Float64}:
28302830
6.90966e-310
28312831
6.90966e-310
28322832
6.90966e-310
@@ -2876,7 +2876,7 @@ Construct an uninitialized [`Matrix{T}`](@ref) of size `m`×`n`.
28762876
# Examples
28772877
```julia-repl
28782878
julia> Matrix{Float64}(undef, 2, 3)
2879-
2×3 Array{Float64, 2}:
2879+
2×3 Matrix{Float64}:
28802880
2.36365e-314 2.28473e-314 5.0e-324
28812881
2.26704e-314 2.26711e-314 NaN
28822882
@@ -3014,7 +3014,7 @@ an alias for `UndefInitializer()`.
30143014
# Examples
30153015
```julia-repl
30163016
julia> Array{Float64, 1}(UndefInitializer(), 3)
3017-
3-element Array{Float64, 1}:
3017+
3-element Vector{Float64}:
30183018
2.2752528595e-314
30193019
2.202942107e-314
30203020
2.275252907e-314

base/essentials.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ f(y) = [x for x in y]
9393
9494
# Examples
9595
96-
```julia
96+
```julia-repl
9797
julia> f(A::AbstractArray) = g(A)
9898
f (generic function with 1 method)
9999
@@ -1270,7 +1270,7 @@ The `@world` macro is primarily used in the printing of bindings that are no lon
12701270
available in the current world.
12711271
12721272
## Example
1273-
```
1273+
```julia-repl
12741274
julia> struct Foo; a::Int; end
12751275
Foo
12761276

base/file.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ julia> pwd()
128128
"/home/JuliaUser"
129129
130130
julia> cd(readdir, "/home/JuliaUser/Projects/julia")
131-
34-element Array{String,1}:
131+
34-element Vector{String}:
132132
".circleci"
133133
".freebsdci.sh"
134134
".git"
@@ -211,17 +211,17 @@ julia> mkpath("my/test/dir") # creates three directories
211211
"my/test/dir"
212212
213213
julia> readdir()
214-
1-element Array{String,1}:
214+
1-element Vector{String}:
215215
"my"
216216
217217
julia> cd("my")
218218
219219
julia> readdir()
220-
1-element Array{String,1}:
220+
1-element Vector{String}:
221221
"test"
222222
223223
julia> readdir("test")
224-
1-element Array{String,1}:
224+
1-element Vector{String}:
225225
"dir"
226226
227227
julia> mkpath("intermediate_dir/actually_a_directory.txt") # creates two directories
@@ -943,7 +943,7 @@ See also: [`walkdir`](@ref).
943943
julia> cd("/home/JuliaUser/dev/julia")
944944
945945
julia> readdir()
946-
30-element Array{String,1}:
946+
30-element Vector{String}:
947947
".appveyor.yml"
948948
".git"
949949
".gitattributes"
@@ -953,7 +953,7 @@ julia> readdir()
953953
"usr-staging"
954954
955955
julia> readdir(join=true)
956-
30-element Array{String,1}:
956+
30-element Vector{String}:
957957
"/home/JuliaUser/dev/julia/.appveyor.yml"
958958
"/home/JuliaUser/dev/julia/.git"
959959
"/home/JuliaUser/dev/julia/.gitattributes"
@@ -963,7 +963,7 @@ julia> readdir(join=true)
963963
"/home/JuliaUser/dev/julia/usr-staging"
964964
965965
julia> readdir("base")
966-
145-element Array{String,1}:
966+
145-element Vector{String}:
967967
".gitignore"
968968
"Base.jl"
969969
"Enums.jl"
@@ -973,7 +973,7 @@ julia> readdir("base")
973973
"weakkeydict.jl"
974974
975975
julia> readdir("base", join=true)
976-
145-element Array{String,1}:
976+
145-element Vector{String}:
977977
"base/.gitignore"
978978
"base/Base.jl"
979979
"base/Enums.jl"
@@ -983,7 +983,7 @@ julia> readdir("base", join=true)
983983
"base/weakkeydict.jl"
984984
985985
julia> readdir(abspath("base"), join=true)
986-
145-element Array{String,1}:
986+
145-element Vector{String}:
987987
"/home/JuliaUser/dev/julia/base/.gitignore"
988988
"/home/JuliaUser/dev/julia/base/Base.jl"
989989
"/home/JuliaUser/dev/julia/base/Enums.jl"

base/genericmemory.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Fixed-size [`DenseVector{T}`](@ref DenseVector).
1010
`kind` can currently be either `:not_atomic` or `:atomic`. For details on what `:atomic` implies, see [`AtomicMemory`](@ref)
1111
1212
`addrspace` can currently only be set to `Core.CPU`. It is designed to permit extension by other systems such as GPUs, which might define values such as:
13-
```
13+
```julia
1414
module CUDA
1515
const Generic = bitcast(Core.AddrSpace{CUDA}, 0)
1616
const Global = bitcast(Core.AddrSpace{CUDA}, 1)

base/multidimensional.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,16 +1313,16 @@ See also: [`circshift`](@ref).
13131313
# Examples
13141314
```julia-repl
13151315
julia> src = reshape(Vector(1:16), (4,4))
1316-
4×4 Array{Int64,2}:
1316+
4×4 Matrix{Int64}:
13171317
1 5 9 13
13181318
2 6 10 14
13191319
3 7 11 15
13201320
4 8 12 16
13211321
1322-
julia> dest = OffsetArray{Int}(undef, (0:3,2:5))
1322+
julia> dest = OffsetArray{Int}(undef, (0:3,2:5));
13231323
13241324
julia> circcopy!(dest, src)
1325-
OffsetArrays.OffsetArray{Int64,2,Array{Int64,2}} with indices 0:3×2:5:
1325+
4×4 OffsetArray(::Matrix{Int64}, 0:3, 2:5) with eltype Int64 with indices 0:3×2:5:
13261326
8 12 16 4
13271327
5 9 13 1
13281328
6 10 14 2

base/show.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3150,7 +3150,7 @@ Print to a stream `io`, or return a string `str`, giving a brief description of
31503150
a value. By default returns `string(typeof(x))`, e.g. [`Int64`](@ref).
31513151
31523152
For arrays, returns a string of size and type info,
3153-
e.g. `10-element Array{Int64,1}`.
3153+
e.g. `10-element Vector{Int64}` or `9×4×5 Array{Float64, 3}`.
31543154
31553155
# Examples
31563156
```jldoctest

base/stream.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function getproperty(stream::LibuvStream, name::Symbol)
7676
end
7777

7878
# IO
79-
# +- GenericIOBuffer{T<:AbstractArray{UInt8,1}} (not exported)
79+
# +- GenericIOBuffer{T<:AbstractVector{UInt8}} (not exported)
8080
# +- AbstractPipe (not exported)
8181
# . +- Pipe
8282
# . +- Process (not exported)
@@ -89,7 +89,7 @@ end
8989
# . +- TTY (not exported)
9090
# . +- UDPSocket
9191
# . +- BufferStream (FIXME: 2.0)
92-
# +- IOBuffer = Base.GenericIOBuffer{Array{UInt8,1}}
92+
# +- IOBuffer = Base.GenericIOBuffer{Vector{UInt8}}
9393
# +- IOStream
9494

9595
# IOServer

doc/src/base/sort.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ indices that puts the array into sorted order:
4141

4242
```julia-repl
4343
julia> v = randn(5)
44-
5-element Array{Float64,1}:
44+
5-element Vector{Float64}:
4545
0.297288
4646
0.382396
4747
-0.597634
4848
-0.0104452
4949
-0.839027
5050
5151
julia> p = sortperm(v)
52-
5-element Array{Int64,1}:
52+
5-element Vector{Int64}:
5353
5
5454
3
5555
4
5656
1
5757
2
5858
5959
julia> v[p]
60-
5-element Array{Float64,1}:
60+
5-element Vector{Float64}:
6161
-0.839027
6262
-0.597634
6363
-0.0104452
@@ -69,7 +69,7 @@ Arrays can be sorted according to an arbitrary transformation of their values:
6969

7070
```julia-repl
7171
julia> sort(v, by=abs)
72-
5-element Array{Float64,1}:
72+
5-element Vector{Float64}:
7373
-0.0104452
7474
0.297288
7575
0.382396
@@ -81,7 +81,7 @@ Or in reverse order by a transformation:
8181

8282
```julia-repl
8383
julia> sort(v, by=abs, rev=true)
84-
5-element Array{Float64,1}:
84+
5-element Vector{Float64}:
8585
-0.839027
8686
-0.597634
8787
0.382396
@@ -93,7 +93,7 @@ If needed, the sorting algorithm can be chosen:
9393

9494
```julia-repl
9595
julia> sort(v, alg=InsertionSort)
96-
5-element Array{Float64,1}:
96+
5-element Vector{Float64}:
9797
-0.839027
9898
-0.597634
9999
-0.0104452

0 commit comments

Comments
 (0)