Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add circshift! changes to docs? #46016

Open
cormullion opened this issue Jul 13, 2022 · 2 comments · May be fixed by #57539
Open

Add circshift! changes to docs? #46016

cormullion opened this issue Jul 13, 2022 · 2 comments · May be fixed by #57539
Labels
arrays [a, r, r, a, y, s] docs This change adds or pertains to documentation

Comments

@cormullion
Copy link
Contributor

On Julia v1.8rc1

julia> circshift!(collect(1:10), 1)
10-element Vector{Int64}:
  2
  3
  4
  5
  6
  7
  8
  9
 10
  1

On Julia v1.7.0

julia> circshift!(collect(1:10), 1)
ERROR: ^[[AMethodError: no method matching circshift!(::Vector{Int64}, ::Int64)
Closest candidates are:
  circshift!(::AbstractArray, ::Any, ::Tuple{}) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/multidimensional.jl:1104
  circshift!(::AbstractArray{T, N}, ::Any, ::Tuple{Vararg{Integer, N}} where N) where {T, N} at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/multidimensional.jl:1116
  circshift!(::AbstractArray, ::Any, ::Any) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/multidimensional.jl:1124
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1

Perhaps the documentation should note something about the change?

@fredrikekre
Copy link
Member

Added in #42678

@rfourquet rfourquet added the docs This change adds or pertains to documentation label Sep 14, 2022
@ehehela
Copy link

ehehela commented Nov 27, 2024

Sorry to bring this up again, but I just wanted to mention that the documentation of circshift!(a, shift) with AbstractVector is still missing. The current documentation only covers the usage of circshift!(dest, src, shifts), which is not specifically tailored for AbstractVector (see docs). The usage of circshift!(a, shift) still remains undocumented.

julia/base/abstractarray.jl

Lines 3657 to 3668 in 8f5b7ca

## 1-d circshift ##
function circshift!(a::AbstractVector, shift::Integer)
n = length(a)
n == 0 && return a
shift = mod(shift, n)
shift == 0 && return a
l = lastindex(a)
reverse!(a, firstindex(a), l-shift)
reverse!(a, l-shift+1, lastindex(a))
reverse!(a)
return a
end

@nsajko nsajko added the arrays [a, r, r, a, y, s] label Feb 25, 2025
@nsajko nsajko marked this as a duplicate of #54868 Feb 25, 2025
barucden added a commit to barucden/julia that referenced this issue Feb 26, 2025
@barucden barucden linked a pull request Feb 26, 2025 that will close this issue
barucden added a commit to barucden/julia that referenced this issue Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants