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

Example in readme missing (s, t) initialization #115

Open
matbesancon opened this issue Jan 31, 2022 · 2 comments
Open

Example in readme missing (s, t) initialization #115

matbesancon opened this issue Jan 31, 2022 · 2 comments

Comments

@matbesancon
Copy link

julia> using FLoops  # exports @floop macro

julia> @floop for (x, y) in zip(1:3, 1:2:6)
           a = x + y
           b = x - y
           @reduce s += a
           @reduce t += b
       end
       (s, t)
(15, -3)

shouldn't s and t be initialized somewhere?

@tkf
Copy link
Member

tkf commented Jan 31, 2022

This example is correct. (You can check this in the REPL.)

That said, I understand that it may feel jarring for people trained to write sequential programs. It's better to clarify this in the documentation.

@matbesancon
Copy link
Author

Indeed I had a doubt, in that case yes a mention of the special syntax working with an undefined left-hand-side of += would be great, thanks!

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