-
Notifications
You must be signed in to change notification settings - Fork 465
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
New package: ProductArrays v1.0.0 #84683
New package: ProductArrays v1.0.0 #84683
Conversation
UUID: 39a08dd0-b4b7-4086-afbb-eb1796240846 Repo: https://github.com/lazyLibraries/ProductArrays.jl.git Tree: b101c921fe636be236ba9ab5e5ea348e67f1f72e Registrator tree SHA: f73a20c99934db92a256057d0d83ba394036a701
Your Since you are registering a new package, please make sure that you have read the package naming guidelines: https://julialang.github.io/Pkg.jl/dev/creating-packages/#Package-naming-guidelines-1 If you want to prevent this pull request from being auto-merged, simply leave a comment. If you want to post a comment without blocking auto-merging, you must include the text |
There are at least three packages that do similar things already. In the order of registration date and increasing functionality: [noblock] |
I actually didn't know about them - thanks for pointing them out. I didn't know I should search for "grid". julia> grid(1:2, (:a, :b))
ERROR: MethodError: no method matching grid(::UnitRange{Int64}, ::Tuple{Symbol, Symbol})
Closest candidates are:
grid(::AbstractVector...) at ~/.julia/packages/RectiGrids/K7F4a/src/RectiGrids.jl:88
Stacktrace:
[1] top-level scope
@ REPL[24]:1
julia> grid([1 2; 3 4], (:a, :b))
ERROR: MethodError: no method matching grid(::Matrix{Int64}, ::Tuple{Symbol, Symbol})
Stacktrace:
[1] top-level scope
@ REPL[25]:1
julia> Iterators.product(1:2, (:a, :b)) |> collect
2×2 Matrix{Tuple{Int64, Symbol}}:
(1, :a) (1, :b)
(2, :a) (2, :b)
julia> Iterators.product([1 2; 3 4], (:a, :b)) |> collect
2×2×2 Array{Tuple{Int64, Symbol}, 3}:
[:, :, 1] =
(1, :a) (2, :a)
(3, :a) (4, :a)
[:, :, 2] =
(1, :b) (2, :b)
(3, :b) (4, :b) I will check out the other packages shortly. EDIT: LazyGrids does something else: it is a tuple of grids not a grid of tuples. [noblock] |
See also:
All of these work with abstractarrays only, indeed - no tuples. Just wanted to point out prior art so that not to duplicate functionality unnecessarily. [noblock] |
collect(Iterators.product(it...))