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

Broadcasting for nested structs #45519

Closed
XLin0mu opened this issue May 30, 2022 · 1 comment
Closed

Broadcasting for nested structs #45519

XLin0mu opened this issue May 30, 2022 · 1 comment

Comments

@XLin0mu
Copy link

XLin0mu commented May 30, 2022

When I'm dealing with a nested structure, I have to use many circle structure if I wanna traverse more than a layer in a nested structure.
I mean, do we need a new operater like "dot dot" which's similar to the dot operater, to implement multi-layer
nested structure traversing?
For example:

a = b = c = h = rand(10, 1)
d = e = f = [a, b, c]
g = [d, e, f]
ar = Array{Any, 1}(undef, 3)

Usually I do this:

for i in 1 : length(g)
    ar[i] = g[i] .* h
end

Could we make a "dot dot" operater working like this:

ar = g ..* h

or some forms look more scientific.
Actually I don't have a nice idea on forming this operater, if you think it's a good idea as well, I believe you can struct a great operater for us.
Sorry for bothering.

@fredrikekre fredrikekre changed the title Do we need a operater to easily traverse each layer in a nested structure? Broadcasting for nested structs May 30, 2022
@fredrikekre
Copy link
Member

See #20502

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

No branches or pull requests

2 participants