Skip to content

Commit 3736b5e

Browse files
committed
Update syntax highlight tags for REPL code examples
1 parent 0781d6d commit 3736b5e

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

docs/src/advanced.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ StructArrays provides a function `StructArrays.append!!(dest, src)` (unexported)
6666

6767
`StructArrays.append!!` works like `append!(dest, src)` if `dest` can contain all element types in `src` iterator; i.e., it _mutates_ `dest` in-place:
6868

69-
```julia
69+
```julia-repl
7070
julia> dest = StructVector((a=[1], b=[2]))
7171
1-element StructArray(::Array{Int64,1}, ::Array{Int64,1}) with eltype NamedTuple{(:a, :b),Tuple{Int64,Int64}}:
7272
(a = 1, b = 2)
@@ -82,7 +82,7 @@ true
8282

8383
Unlike `append!`, `append!!` can also _widen_ element type of `dest` array:
8484

85-
```julia
85+
```julia-repl
8686
julia> StructArrays.append!!(dest, [(a = missing, b = 6)])
8787
3-element StructArray(::Array{Union{Missing, Int64},1}, ::Array{Int64,1}) with eltype NamedTuple{(:a, :b),Tuple{Union{Missing, Int64},Int64}}:
8888
NamedTuple{(:a, :b),Tuple{Union{Missing, Int64},Int64}}((1, 2))

docs/src/examples.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Example usage to store complex numbers
22

3-
```julia
3+
```julia-repl
44
julia> using StructArrays, Random
55
66
julia> Random.seed!(4);
@@ -24,7 +24,7 @@ julia> StructArrays.components(s) # obtain all field arrays as a named tuple
2424

2525
Note that the same approach can be used directly from an `Array` of complex numbers:
2626

27-
```julia
27+
```julia-repl
2828
julia> StructArray([1+im, 3-2im])
2929
2-element StructArray(::Array{Int64,1}, ::Array{Int64,1}) with eltype Complex{Int64}:
3030
1 + 1im
@@ -33,7 +33,7 @@ julia> StructArray([1+im, 3-2im])
3333

3434
## Example usage to store a data table
3535

36-
```julia
36+
```julia-repl
3737
julia> t = StructArray((a = [1, 2], b = ["x", "y"]))
3838
2-element StructArray(::Array{Int64,1}, ::Array{String,1}) with eltype NamedTuple{(:a, :b),Tuple{Int64,String}}:
3939
(a = 1, b = "x")
@@ -56,7 +56,7 @@ julia> push!(t, (a = 3, b = "z"))
5656

5757
## Example usage with StaticArray elements
5858

59-
```julia
59+
```julia-repl
6060
julia> using StructArrays, StaticArrays
6161
6262
julia> x = StructArray([SVector{2}(1,2) for i = 1:5])
@@ -84,4 +84,4 @@ julia> B = StructArray([SArray{Tuple{2,2,2}}(reshape(1:8,2,2,2)) for i = 1:5]);
8484
[:, :, 2] =
8585
5 7
8686
6 8
87-
```
87+
```

docs/src/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ StructArray(log(j+2.0*im) for j in 1:10)
4646

4747
Another option is to create an uninitialized `StructArray` and then fill it with data. Just like in normal arrays, this is done with the `undef` syntax:
4848

49-
```julia
49+
```julia-repl
5050
julia> s = StructArray{ComplexF64}(undef, 2, 2)
5151
2×2 StructArray(::Array{Float64,2}, ::Array{Float64,2}) with eltype Complex{Float64}:
5252
6.91646e-310+6.91646e-310im 6.91646e-310+6.91646e-310im
@@ -88,7 +88,7 @@ julia> soa.re
8888

8989
`StructArray`s supports using custom array types. It is always possible to pass field arrays of a custom type. The "custom array of `struct`s to `struct` of custom arrays" transformation will use the `similar` method of the custom array type. This can be useful when working on the GPU for example:
9090

91-
```julia
91+
```julia-repl
9292
julia> using StructArrays, CuArrays
9393
9494
julia> a = CuArray(rand(Float32, 10));
@@ -126,7 +126,7 @@ julia> StructArray(c)
126126

127127
If you already have your data in a `StructArray` with field arrays of a given format (say plain `Array`) you can change them with `replace_storage`:
128128

129-
```julia
129+
```julia-repl
130130
julia> s = StructArray([1.0+im, 2.0-im])
131131
2-element StructArray(::Array{Float64,1}, ::Array{Float64,1}) with eltype Complex{Float64}:
132132
1.0 + 1.0im
@@ -142,7 +142,7 @@ julia> replace_storage(CuArray, s)
142142

143143
`StructArray`s also provides a `LazyRow` wrapper for lazy row iteration. `LazyRow(t, i)` does not materialize the i-th row but returns a lazy wrapper around it on which `getproperty` does the correct thing. This is useful when the row has many fields only some of which are necessary. It also allows changing columns in place.
144144

145-
```julia
145+
```julia-repl
146146
julia> t = StructArray((a = [1, 2], b = ["x", "y"]));
147147
148148
julia> LazyRow(t, 2).a
@@ -159,7 +159,7 @@ julia> t
159159

160160
To iterate in a lazy way one can simply iterate `LazyRows`:
161161

162-
```julia
162+
```julia-repl
163163
julia> map(t -> t.b ^ t.a, LazyRows(t))
164164
2-element Array{String,1}:
165165
"x"
@@ -168,10 +168,10 @@ julia> map(t -> t.b ^ t.a, LazyRows(t))
168168

169169
## Applying a function on each field array
170170

171-
```julia
171+
```julia-repl
172172
julia> struct Foo
173-
a::Int
174-
b::String
173+
a::Int
174+
b::String
175175
end
176176
177177
julia> s = StructArray([Foo(11, "a"), Foo(22, "b"), Foo(33, "c"), Foo(44, "d"), Foo(55, "e")]);

src/interface.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ this will have fields with the same names and types as `T`.
1919
This can be overloaded for custom types if required, in which case
2020
[`StructArrays.component`](@ref) and [`StructArrays.createinstance`](@ref)
2121
should also be defined.
22-
22+
2323
```julia-repl
2424
julia> StructArrays.staticschema(Complex{Float64})
2525
NamedTuple{(:re, :im),Tuple{Float64,Float64}}

0 commit comments

Comments
 (0)