Skip to content

Commit 0202de6

Browse files
barucdenKristofferC
authored andcommitted
Docs: circshift!(::AbstractVector, ::Integer) (#57539)
Closes #46016 (cherry picked from commit b0323ab)
1 parent 64952e8 commit 0202de6

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

base/abstractarray.jl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3536,7 +3536,31 @@ function _keepat!(a::AbstractVector, m::AbstractVector{Bool})
35363536
deleteat!(a, j:lastindex(a))
35373537
end
35383538

3539-
## 1-d circshift ##
3539+
"""
3540+
circshift!(a::AbstractVector, shift::Integer)
3541+
3542+
Circularly shift, or rotate, the data in vector `a` by `shift` positions.
3543+
3544+
# Examples
3545+
3546+
```jldoctest
3547+
julia> circshift!([1, 2, 3, 4, 5], 2)
3548+
5-element Vector{Int64}:
3549+
4
3550+
5
3551+
1
3552+
2
3553+
3
3554+
3555+
julia> circshift!([1, 2, 3, 4, 5], -2)
3556+
5-element Vector{Int64}:
3557+
3
3558+
4
3559+
5
3560+
1
3561+
2
3562+
```
3563+
"""
35403564
function circshift!(a::AbstractVector, shift::Integer)
35413565
n = length(a)
35423566
n == 0 && return

0 commit comments

Comments
 (0)