Skip to content

Specialize map!(f, array) #1307

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

Merged
merged 1 commit into from
May 20, 2025
Merged

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented May 13, 2025

Julia v1.12 introduces the 2-term map!, where the source and the destination are identical. Currently, this package errors without a third term, as it can't find the source array. This PR ensures that the method works for StaticArrayss.

After this,

julia> M = MVector(1,3,4)
3-element MVector{3, Int64} with indices SOneTo(3):
 1
 3
 4

julia> map!(x->x^2, M)
3-element MVector{3, Int64} with indices SOneTo(3):
  1
  9
 16

julia> M
3-element MVector{3, Int64} with indices SOneTo(3):
  1
  9
 16

@jishnub jishnub merged commit 563adeb into JuliaArrays:master May 20, 2025
17 of 24 checks passed
@jishnub jishnub deleted the jishnub/map_2term branch May 20, 2025 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants