JuliaArrays / JuliaArrays/StructArrays.jl

Simpler first example

Open
#310 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
402
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Hello,

I think it would help to have a simpler first example with a Vector and NamedTuple

Here is a proposal.

julia> using StructArrays

julia> adata = [1, 2]
2-element Vector{Int64}:
 1
 2

julia> bdata = [10.1, 20.1]
2-element Vector{Float64}:
 10.1
 20.1

julia> x = StructArray{NamedTuple{(:a, :b), Tuple{Int, Float64}}}((adata, bdata))
2-element StructArray(::Vector{Int64}, ::Vector{Float64}) with eltype @NamedTuple{a::Int64, b::Float64}:
 (a = 1, b = 10.1)
 (a = 2, b = 20.1)

julia> x.a
2-element Vector{Int64}:
 1
 2

julia> x.b
2-element Vector{Float64}:
 10.1
 20.1

julia> x[1]
(a = 1, b = 10.1)

Any opinion?

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

Review the documentation's introductory example and compare it with the proposed Vector and NamedTuple example in the issue. Update the first example if appropriate, then verify that the Julia code and displayed results render correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.