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

.max methods on hashes and pairs seem to ignore their :by argument in Rakudo #2975

Open
p6rt opened this issue Nov 16, 2012 · 4 comments
Open
Labels

Comments

@p6rt
Copy link

p6rt commented Nov 16, 2012

Migrated from rt.perl.org#115758 (status was 'open')

Searchable as RT115758$

@p6rt
Copy link
Author

p6rt commented Nov 16, 2012

From @masak

<masak> r​: say { 0 => 1, 1 => 0 }.max(​:by(*.value))
<p6eval> rakudo a41a48​: OUTPUT«"1" => 0␤»
<masak> looks like a bug to me.
* masak submits rakudobug
<masak> grondilu++ # discoverer
<moritz> r​: say { 0 => 1, 1 => 0 }.pairs.max(​:by(*.value))
<p6eval> rakudo a41a48​: OUTPUT«"1" => 0␤»
<moritz> r​: say (0 => 1, 1 => 0).max(​:by(*.value))
<p6eval> rakudo a41a48​: OUTPUT«1 => 0␤»
<masak> r​: say max :by(*.value), { 0 => 1, 1 => 0 }.list
<p6eval> rakudo a41a48​: OUTPUT«"0" => 1␤»
<masak> I think a number of method forms may simply be missing their
:by parameter.
<moritz> r​: say List.can('max')
<p6eval> rakudo a41a48​: OUTPUT«max␤»
<moritz> r​: say List.can('max')[0].signature.perl
<p6eval> rakudo a41a48​: OUTPUT«​:(​: $by = { ... }, Mu *%_)␤»
<moritz> r​: say Parcel.can('max')[0].signature.perl
<p6eval> rakudo a41a48​: OUTPUT«​:(​: $by = { ... }, Mu *%_)␤»
<moritz> seems it should work
<masak> weird.

@p6rt
Copy link
Author

p6rt commented Aug 31, 2016

From @MasterDuke17

On Fri Nov 16 03​:25​:43 2012, masak wrote​:

<masak> r​: say { 0 => 1, 1 => 0 }.max(​:by(*.value))
<p6eval> rakudo a41a48​: OUTPUT«"1" => 0␤»
<masak> looks like a bug to me.
* masak submits rakudobug
<masak> grondilu++ # discoverer
<moritz> r​: say { 0 => 1, 1 => 0 }.pairs.max(​:by(*.value))
<p6eval> rakudo a41a48​: OUTPUT«"1" => 0␤»
<moritz> r​: say (0 => 1, 1 => 0).max(​:by(*.value))
<p6eval> rakudo a41a48​: OUTPUT«1 => 0␤»
<masak> r​: say max :by(*.value), { 0 => 1, 1 => 0 }.list
<p6eval> rakudo a41a48​: OUTPUT«"0" => 1␤»
<masak> I think a number of method forms may simply be missing their
:by parameter.
<moritz> r​: say List.can('max')
<p6eval> rakudo a41a48​: OUTPUT«max␤»
<moritz> r​: say List.can('max')[0].signature.perl
<p6eval> rakudo a41a48​: OUTPUT«​:(​: $by = { ... }, Mu *%_)␤»
<moritz> r​: say Parcel.can('max')[0].signature.perl
<p6eval> rakudo a41a48​: OUTPUT«​:(​: $by = { ... }, Mu *%_)␤»
<moritz> seems it should work
<masak> weird.

Some notes from today​:

18​:18 MasterDuke r​: say (0 => 1, 1 => 0).max(​:by(*.value))
18​:18 camelia rakudo-moar 68443f, rakudo-jvm cd19db​: OUTPUT«1 => 0␤»
18​:18 MasterDuke r​: say (0 => 1, 1 => 0).max(*.value)
18​:18 camelia rakudo-moar 68443f, rakudo-jvm cd19db​: OUTPUT«0 => 1␤»
18​:20 MasterDuke r​: say List.can("max")[0].signature.perl
18​:20 camelia rakudo-moar 68443f, rakudo-jvm cd19db​: OUTPUT«​:($​: | is raw)␤»
18​:20 MasterDuke i was looking at RT #​115758, but it's pretty old
18​:20 synopsebot6 Link​: https://rt-archive.perl.org/perl6//Publ​ic/Bug/Display.html?id=115758
18​:21 MasterDuke r​: say max :by(*.value), { 0 => 1, 1 => 0 }
18​:21 camelia rakudo-moar 68443f, rakudo-jvm cd19db​: OUTPUT«0 => 1␤»

19​:55 MasterDuke masak, moritz​: do you think RT #​115758 is still valid?

20​:14 masak MasterDuke​: yes, I think it's still valid. unless something has happened that's outside of the scope of what I'm reading in that ticket. but I know of no such thing.

@p6rt
Copy link
Author

p6rt commented Aug 31, 2016

From @MasterDuke17

On Tue Aug 30 20​:00​:31 2016, ddgreen@​gmail.com wrote​:

On Fri Nov 16 03​:25​:43 2012, masak wrote​:

<masak> r​: say { 0 => 1, 1 => 0 }.max(​:by(*.value))
<p6eval> rakudo a41a48​: OUTPUT«"1" => 0␤»
<masak> looks like a bug to me.
* masak submits rakudobug
<masak> grondilu++ # discoverer
<moritz> r​: say { 0 => 1, 1 => 0 }.pairs.max(​:by(*.value))
<p6eval> rakudo a41a48​: OUTPUT«"1" => 0␤»
<moritz> r​: say (0 => 1, 1 => 0).max(​:by(*.value))
<p6eval> rakudo a41a48​: OUTPUT«1 => 0␤»
<masak> r​: say max :by(*.value), { 0 => 1, 1 => 0 }.list
<p6eval> rakudo a41a48​: OUTPUT«"0" => 1␤»
<masak> I think a number of method forms may simply be missing their
:by parameter.
<moritz> r​: say List.can('max')
<p6eval> rakudo a41a48​: OUTPUT«max␤»
<moritz> r​: say List.can('max')[0].signature.perl
<p6eval> rakudo a41a48​: OUTPUT«​:(​: $by = { ... }, Mu *%_)␤»
<moritz> r​: say Parcel.can('max')[0].signature.perl
<p6eval> rakudo a41a48​: OUTPUT«​:(​: $by = { ... }, Mu *%_)␤»
<moritz> seems it should work
<masak> weird.

Some notes from today​:

18​:18 MasterDuke r​: say (0 => 1, 1 => 0).max(​:by(*.value))
18​:18 camelia rakudo-moar 68443f, rakudo-jvm cd19db​:
OUTPUT«1 => 0␤»
18​:18 MasterDuke r​: say (0 => 1, 1 => 0).max(*.value)
18​:18 camelia rakudo-moar 68443f, rakudo-jvm cd19db​:
OUTPUT«0 => 1␤»
18​:20 MasterDuke r​: say List.can("max")[0].signature.perl
18​:20 camelia rakudo-moar 68443f, rakudo-jvm cd19db​:
OUTPUT«​:($​: | is raw)␤»
18​:20 MasterDuke i was looking at RT #​115758, but it's pretty
old
18​:20 synopsebot6 Link​: https://rt-archive.perl.org/perl6//Publ
ic/Bug/Display.html?id=115758
18​:21 MasterDuke r​: say max :by(*.value), { 0 => 1, 1 => 0 }
18​:21 camelia rakudo-moar 68443f, rakudo-jvm cd19db​:
OUTPUT«0 => 1␤»

19​:55 MasterDuke masak, moritz​: do you think RT #​115758 is
still valid?

20​:14 masak MasterDuke​: yes, I think it's still valid. unless
something has happened that's outside of the scope of what I'm reading
in that ticket. but I know of no such thing.

Commentary from jnthn​: http://irclog.perlgeek.de/perl6-dev/2016-08-31#i_13127809

Some of the most relevant portions quoted below.

<jnthn> I'm curious if any other non-max methods take :by though. I'd thought we were doing that on the sub forms to not confuse the transform with a list value
<jnthn> But on the method forms there's no such ambiguity
<MasterDuke> git grep 'method.*​:by' (or git grep 'method.*​:&by')
<MasterDuke> returns no results
<jnthn> Suggests "no" then :)
<jnthn> In which case the ticket is kinda asking us to add them *everywhere* since it'd be odd to do it just for max. :)
<jnthn> But I'm not really that inclined to.
<jnthn> Yeah, so far as I recall we went that way on the subs, and positional for the methods, and it was a deliberate choice

Based on the above conversation I'm going to recommend this be closed as not a bug.

@p6rt
Copy link
Author

p6rt commented Aug 31, 2016

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

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

No branches or pull requests

1 participant