JuliaArrays / JuliaArrays/StaticArrays.jl

map SOneTo to SVector

Open
#1,032 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

Issue

julia> using StaticArrays

julia> map(i -> (a = i, b = i + 1), axes(SVector(1, 2, 3), 1))
3-element MVector{3, NamedTuple{(:a, :b), Tuple{Int64, Int64}}} with indices SOneTo(3):
 (a = 1, b = 2)
 (a = 2, b = 3)
 (a = 3, b = 4)

is an MVector, while intuitively (and perhaps incorrectly?) I expected an SVector.

Versions

(@v1.8) pkg> st StaticArrays
Status `~/.julia/environments/v1.8/Project.toml`
  [90137ffa] StaticArrays v1.4.4 `~/.julia/dev/StaticArrays`

julia> VERSION
v"1.8.0-beta3"

though discussion in #855 suggests this has been around for a while.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Julia reproducer using map over axes(SVector(1, 2, 3), 1), then read the related discussion in issue #855. Determine whether this operation should preserve an SVector rather than produce an MVector, and add or update coverage for the expected result before resolving the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.