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

Reduce with numeric ops does not numify things if only one arg is passed ([*] set(1,2,3)) #5495

Closed
p6rt opened this issue Jul 27, 2016 · 15 comments

Comments

@p6rt
Copy link

p6rt commented Jul 27, 2016

Migrated from rt.perl.org#128758 (status was 'resolved')

Searchable as RT128758$

@p6rt
Copy link
Author

p6rt commented Jul 27, 2016

From @AlexDaniel

Code​:
say [*] set(1,2,3), set(4,5,6)

Result​:
9

OK, that ↑ makes sense.

Code​:
say [*] set(1,2,3)

Result​:
set(3, 1, 2)

Huh? I expected 3.

Related​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128757 (single arg thing does not really work with +)
IRC discussion​: http://irclog.perlgeek.de/perl6/2016-07-27#i_12921657

@p6rt
Copy link
Author

p6rt commented Jul 27, 2016

From @lizmat

Hmmm…. in RT #​128757 you expect a single value to return identity, and here you expect it not to return it? By the same reasoning that [/] “hello” returns “hello”, I think [*] set(1,2,3) should return set(1,2,3).

Or am I missing something?

On 27 Jul 2016, at 23​:29, Aleks-Daniel Jakimenko-Aleksejev (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev
# Please include the string​: [perl #​128758]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128758 >

Code​:
say [*] set(1,2,3), set(4,5,6)

Result​:
9

OK, that ↑ makes sense.

Code​:
say [*] set(1,2,3)

Result​:
set(3, 1, 2)

Huh? I expected 3.

Related​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128757 (single arg thing
does not really work with +)
IRC discussion​: http://irclog.perlgeek.de/perl6/2016-07-27#i_12921657

@p6rt
Copy link
Author

p6rt commented Jul 27, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 27, 2016

From @pmichaud

On Wed Jul 27 14​:38​:42 2016, elizabeth wrote​:

Hmmm…. in RT #​128757 you expect a single value to return identity, and
here you expect it not to return it? By the same reasoning that [/]
“hello” returns “hello”, I think [*] set(1,2,3) should return
set(1,2,3).

Or am I missing something?

I don't think you're missing anything; but I do think there's a really strong case that [*] should numify its arguments, even if there's only one.

In #​128757 my impression of the OP's ticket was that a pattern was established by [*], [/], and [-] that [+] didn't follow that pattern (it was inconsistent)... not that the "return identity" behavior was the correct/desired one.

Pm

@p6rt
Copy link
Author

p6rt commented Jul 27, 2016

From @AlexDaniel

On 2016-07-27 14​:38​:42, elizabeth wrote​:

Hmmm…. in RT #​128757 you expect a single value to return identity, and
here you expect it not to return it? By the same reasoning that [/]
“hello” returns “hello”, I think [*] set(1,2,3) should return
set(1,2,3).

Or am I missing something?

On 27 Jul 2016, at 23​:29, Aleks-Daniel Jakimenko-Aleksejev (via RT)
<perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev
# Please include the string​: [perl #​128758]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128758 >

Code​:
say [*] set(1,2,3), set(4,5,6)

Result​:
9

OK, that ↑ makes sense.

Code​:
say [*] set(1,2,3)

Result​:
set(3, 1, 2)

Huh? I expected 3.

Related​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128757 (single
arg thing
does not really work with +)
IRC discussion​: http://irclog.perlgeek.de/perl6/2016-07-27#i_12921657

Yes, you are right. A fix that will make it numify everything will solve both tickets (probably?).
However, I am not sure what would be the final decision, so I thought that it is better to keep these tickets separated. If you think that it has to be merged, then feel free to do so.

@p6rt
Copy link
Author

p6rt commented Oct 2, 2016

From @MasterDuke17

On Wed Jul 27 15​:03​:26 2016, alex.jakimenko@​gmail.com wrote​:

On 2016-07-27 14​:38​:42, elizabeth wrote​:

Hmmm…. in RT #​128757 you expect a single value to return identity,
and
here you expect it not to return it? By the same reasoning that [/]
“hello” returns “hello”, I think [*] set(1,2,3) should return
set(1,2,3).

Or am I missing something?

On 27 Jul 2016, at 23​:29, Aleks-Daniel Jakimenko-Aleksejev (via RT)
<perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev
# Please include the string​: [perl #​128758]
# in the subject line of all future correspondence about this
issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128758 >

Code​:
say [*] set(1,2,3), set(4,5,6)

Result​:
9

OK, that ↑ makes sense.

Code​:
say [*] set(1,2,3)

Result​:
set(3, 1, 2)

Huh? I expected 3.

Related​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128757 (single
arg thing
does not really work with +)
IRC discussion​: http://irclog.perlgeek.de/perl6/2016-07-
27#i_12921657

Yes, you are right. A fix that will make it numify everything will
solve both
tickets (probably?).
However, I am not sure what would be the final decision, so I thought
that it
is better to keep these tickets separated. If you think that it has to
be
merged, then feel free to do so.

Seems to be fixed now​:
perl6 -e 'say [*] set(1,2,3)'
3
perl6 --version
This is Rakudo version 2016.09-108-g3a6cd8a built on MoarVM version 2016.09-15-gc8b4228
implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Oct 3, 2016

From @AlexDaniel

Yeah, seems so. Marking as testneeded.

It would be nice to know when exactly it was fixed, but bisectable is down. Eh.

On 2016-10-02 15​:05​:24, ddgreen@​gmail.com wrote​:

On Wed Jul 27 15​:03​:26 2016, alex.jakimenko@​gmail.com wrote​:

On 2016-07-27 14​:38​:42, elizabeth wrote​:

Hmmm…. in RT #​128757 you expect a single value to return identity,
and
here you expect it not to return it? By the same reasoning that [/]
“hello” returns “hello”, I think [*] set(1,2,3) should return
set(1,2,3).

Or am I missing something?

On 27 Jul 2016, at 23​:29, Aleks-Daniel Jakimenko-Aleksejev (via
RT)
<perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev
# Please include the string​: [perl #​128758]
# in the subject line of all future correspondence about this
issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128758 >

Code​:
say [*] set(1,2,3), set(4,5,6)

Result​:
9

OK, that ↑ makes sense.

Code​:
say [*] set(1,2,3)

Result​:
set(3, 1, 2)

Huh? I expected 3.

Related​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128757
(single
arg thing
does not really work with +)
IRC discussion​: http://irclog.perlgeek.de/perl6/2016-07-
27#i_12921657

Yes, you are right. A fix that will make it numify everything will
solve both
tickets (probably?).
However, I am not sure what would be the final decision, so I thought
that it
is better to keep these tickets separated. If you think that it has
to
be
merged, then feel free to do so.

Seems to be fixed now​:
perl6 -e 'say [*] set(1,2,3)'
3
perl6 --version
This is Rakudo version 2016.09-108-g3a6cd8a built on MoarVM version
2016.09-15-gc8b4228
implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Oct 10, 2016

From @AlexDaniel

On 2016-10-02 18​:18​:12, alex.jakimenko@​gmail.com wrote​:

Yeah, seems so. Marking as testneeded.

It would be nice to know when exactly it was fixed, but bisectable is
down. Eh.

On 2016-10-02 15​:05​:24, ddgreen@​gmail.com wrote​:

On Wed Jul 27 15​:03​:26 2016, alex.jakimenko@​gmail.com wrote​:

On 2016-07-27 14​:38​:42, elizabeth wrote​:

Hmmm…. in RT #​128757 you expect a single value to return
identity,
and
here you expect it not to return it? By the same reasoning that
[/]
“hello” returns “hello”, I think [*] set(1,2,3) should return
set(1,2,3).

Or am I missing something?

On 27 Jul 2016, at 23​:29, Aleks-Daniel Jakimenko-Aleksejev (via
RT)
<perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev
# Please include the string​: [perl #​128758]
# in the subject line of all future correspondence about this
issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128758 >

Code​:
say [*] set(1,2,3), set(4,5,6)

Result​:
9

OK, that ↑ makes sense.

Code​:
say [*] set(1,2,3)

Result​:
set(3, 1, 2)

Huh? I expected 3.

Related​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128757
(single
arg thing
does not really work with +)
IRC discussion​: http://irclog.perlgeek.de/perl6/2016-07-
27#i_12921657

Yes, you are right. A fix that will make it numify everything will
solve both
tickets (probably?).
However, I am not sure what would be the final decision, so I
thought
that it
is better to keep these tickets separated. If you think that it has
to
be
merged, then feel free to do so.

Seems to be fixed now​:
perl6 -e 'say [*] set(1,2,3)'
3
perl6 --version
This is Rakudo version 2016.09-108-g3a6cd8a built on MoarVM version
2016.09-15-gc8b4228
implementing Perl 6.c.

Ah, bisectable is now up. It is this​: rakudo/rakudo@b1c444f

@p6rt
Copy link
Author

p6rt commented Dec 31, 2016

@p6rt
Copy link
Author

p6rt commented Dec 31, 2016

@moritz - Status changed from 'open' to 'resolved'

@p6rt
Copy link
Author

p6rt commented Jun 29, 2017

From @smls

It looks like this bug hasn't been *completely* fixed​:

  dd &infix​:<+>( "2" ); # 2
  dd &infix​:<*>( "2" ); # 2

  dd [*] "2"; # 2
  dd [+] "2"; # 2

  dd reduce &infix​:<*>, "2"; # 2
  dd reduce &infix​:<+>, "2"; # "2"

i.e. it doesn't work when using the + operator with the functional form of reduce, even though it works with other numeric operators and with the meta-operator form.

@p6rt
Copy link
Author

p6rt commented Jun 29, 2017

@smls - Status changed from 'resolved' to 'open'

@p6rt
Copy link
Author

p6rt commented Mar 25, 2018

From @dogbert17

On Thu, 29 Jun 2017 12​:50​:43 -0700, smls75@​gmail.com wrote​:

It looks like this bug hasn't been *completely* fixed​:

dd &infix​:<+>( "2" ); # 2
dd &infix​:<*>( "2" ); # 2

dd [*] "2"; # 2
dd [+] "2"; # 2

dd reduce &infix​:<*>, "2"; # 2
dd reduce &infix​:<+>, "2"; # "2"

i.e. it doesn't work when using the + operator with the functional
form of reduce, even though it works with other numeric operators and
with the meta-operator form.

Last example fixed with commit (2018-01-13) rakudo/rakudo@0af3f4d

@p6rt
Copy link
Author

p6rt commented Mar 26, 2018

From @dogbert17

On Sun, 25 Mar 2018 08​:43​:30 -0700, jan-olof.hendig@​bredband.net wrote​:

On Thu, 29 Jun 2017 12​:50​:43 -0700, smls75@​gmail.com wrote​:

It looks like this bug hasn't been *completely* fixed​:

dd &infix​:<+>( "2" ); # 2
dd &infix​:<*>( "2" ); # 2

dd [*] "2"; # 2
dd [+] "2"; # 2

dd reduce &infix​:<*>, "2"; # 2
dd reduce &infix​:<+>, "2"; # "2"

i.e. it doesn't work when using the + operator with the functional
form of reduce, even though it works with other numeric operators and
with the meta-operator form.

Last example fixed with commit (2018-01-13)
rakudo/rakudo@0af3f4d

Test added with commit Raku/roast@6b0fcc2

@p6rt p6rt closed this as completed Mar 26, 2018
@p6rt
Copy link
Author

p6rt commented Mar 26, 2018

@dogbert17 - Status changed from 'open' to 'resolved'

@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant