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
[+] does not behave like the other [binop]s on single Iterables #5205
Comments
Thanks for the report! |
Actually, due to single argument, I would expect this to produce 6. A stronger case could be made that Arguably |
Yeah, but they have been exposing this behaviour for a long time already. So fixing would probably need to be done at a language level. |
@thundergnat I agree that it would at least be more useful for the other operators to behave like [+] in this regard. It should be consistent either way, though. @lizmat So for those of us keeping score at home, you tried to fix this, it broke other stuff, so the fix was reverted. Right? |
Yes, the fix was reverted, in the sense that |
Well, I am mildly of the opinion that the meta reduce binops should follow the single argument rule, for consistency if nothing else, but also think that it is a relatively minor issue in general and that core devs time may be better spent on more critical things. And, like lizmat said, they have been that way for some time; changing them should at least be discussed in problem-solving, with maybe some input from jnthn or even (wistfully) Timtoady. |
The Problem
Given a single scalarized Iterable,
[+]
reduces its elements.Expected Behavior
[+]
should behave like the other reduced arithmetic operators.Actual Behavior
[+]
appears to decontainerize a single Iterable, reducing across its elements. This seems to be because it uses Array.sum when available, instead of just doing an actual reduce with+
.Steps to Reproduce
Note that replacing
+
with any of the other three arithmetic ops here does produce 3.Environment
perl6 -v
orraku -v
):Welcome to Rakudo™ v2022.12.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.12.
The text was updated successfully, but these errors were encountered: