Skip to content

Commit 0c9ac24

Browse files
barucdenKristofferC
authored andcommitted
Docs: circshift!(::AbstractVector, ::Integer) (#57539)
Closes #46016 (cherry picked from commit b0323ab)
1 parent c793367 commit 0c9ac24

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
@@ -3654,7 +3654,31 @@ function _keepat!(a::AbstractVector, m::AbstractVector{Bool})
36543654
deleteat!(a, j:lastindex(a))
36553655
end
36563656

3657-
## 1-d circshift ##
3657+
"""
3658+
circshift!(a::AbstractVector, shift::Integer)
3659+
3660+
Circularly shift, or rotate, the data in vector `a` by `shift` positions.
3661+
3662+
# Examples
3663+
3664+
```jldoctest
3665+
julia> circshift!([1, 2, 3, 4, 5], 2)
3666+
5-element Vector{Int64}:
3667+
4
3668+
5
3669+
1
3670+
2
3671+
3
3672+
3673+
julia> circshift!([1, 2, 3, 4, 5], -2)
3674+
5-element Vector{Int64}:
3675+
3
3676+
4
3677+
5
3678+
1
3679+
2
3680+
```
3681+
"""
36583682
function circshift!(a::AbstractVector, shift::Integer)
36593683
n = length(a)
36603684
n == 0 && return a

0 commit comments

Comments
 (0)