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

sort method returns an empty sequence when looking a Nth-indexed value of the given element of the sequence #6209

Closed
p6rt opened this issue Apr 28, 2017 · 7 comments
Labels
Bug LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Apr 28, 2017

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

Searchable as RT131222$

@p6rt
Copy link
Author

p6rt commented Apr 28, 2017

From @titsuki

See the following result​:

$ perl6 -e '["1​:0.470572470261861", "2​:0.579981821025709"]>>.split("​:", :skip-empty).sort({ $^b[0] <=> $^a[0] }).perl.say;'
(Seq.new-consumed(), Seq.new-consumed()).Seq

I think if sort method cannot look (i.e. consume) a Nth-indexed value (e.g. $^b[0], $^b[1], ...) and this behavior is a specced one, it should return a warning message.

$ perl6 --version
This is Rakudo version 2017.03-217-ge681498 built on MoarVM version 2017.03-115-ge8231a3
implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Apr 28, 2017

From @zoffixznet

On Fri, 28 Apr 2017 09​:36​:52 -0700, cookbook_000@​yahoo.co.jp wrote​:

See the following result​:

$ perl6 -e '["1​:0.470572470261861",
"2​:0.579981821025709"]>>.split("​:", :skip-empty).sort({ $^b[0] <=>
$^a[0] }).perl.say;'
(Seq.new-consumed(), Seq.new-consumed()).Seq

I think if sort method cannot look (i.e. consume) a Nth-indexed value
(e.g. $^b[0], $^b[1], ...) and this behavior is a specced one, it
should return a warning message.

$ perl6 --version
This is Rakudo version 2017.03-217-ge681498 built on MoarVM version
2017.03-115-ge8231a3
implementing Perl 6.c.

Thank you for the report. This is now fixed.

The Seqs aren't actually consumed; it was a bug in .perl wrongly saying they're consumed.

Fix​: rakudo/rakudo@54f50956ad
Test​: Raku/roast@7d4092d940

@p6rt
Copy link
Author

p6rt commented Apr 28, 2017

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

@p6rt
Copy link
Author

p6rt commented Apr 28, 2017

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

@p6rt p6rt closed this as completed Apr 28, 2017
@p6rt
Copy link
Author

p6rt commented Apr 28, 2017

From @titsuki

On Fri, 28 Apr 2017 10​:40​:49 -0700, cpan@​zoffix.com wrote​:

On Fri, 28 Apr 2017 09​:36​:52 -0700, cookbook_000@​yahoo.co.jp wrote​:

See the following result​:

$ perl6 -e '["1​:0.470572470261861",
"2​:0.579981821025709"]>>.split("​:", :skip-empty).sort({ $^b[0] <=>
$^a[0] }).perl.say;'
(Seq.new-consumed(), Seq.new-consumed()).Seq

I think if sort method cannot look (i.e. consume) a Nth-indexed value
(e.g. $^b[0], $^b[1], ...) and this behavior is a specced one, it
should return a warning message.

$ perl6 --version
This is Rakudo version 2017.03-217-ge681498 built on MoarVM version
2017.03-115-ge8231a3
implementing Perl 6.c.

Thank you for the report. This is now fixed.

The Seqs aren't actually consumed; it was a bug in .perl wrongly
saying they're consumed.

Fix​: rakudo/rakudo@54f50956ad
Test​: Raku/roast@7d4092d940

Thanks for fixing a bug.

However, if leaving out a .perl calling, the following example also cause the issue in my environment​:

$ perl6 -e 'for ["1​:0.470572470261861", "2​:0.579981821025709"]>>.split("​:", :skip-empty).sort({ $^b[0] &lt;=&gt; $^a[0] }) -> ($k,$v) { ($k,$v).say }'
Too few positionals passed; expected 2 arguments but got 0 in sub-signature
  in block <unit> at -e line 1

$ perl6 --version
This is Rakudo version 2017.03-217-ge681498 built on MoarVM version 2017.03-115-ge8231a3
implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Apr 28, 2017

From @titsuki

On Fri, 28 Apr 2017 11​:41​:36 -0700, cookbook_000@​yahoo.co.jp wrote​:

On Fri, 28 Apr 2017 10​:40​:49 -0700, cpan@​zoffix.com wrote​:

On Fri, 28 Apr 2017 09​:36​:52 -0700, cookbook_000@​yahoo.co.jp wrote​:

See the following result​:

$ perl6 -e '["1​:0.470572470261861",
"2​:0.579981821025709"]>>.split("​:", :skip-empty).sort({ $^b[0] <=>
$^a[0] }).perl.say;'
(Seq.new-consumed(), Seq.new-consumed()).Seq

I think if sort method cannot look (i.e. consume) a Nth-indexed
value
(e.g. $^b[0], $^b[1], ...) and this behavior is a specced one, it
should return a warning message.

$ perl6 --version
This is Rakudo version 2017.03-217-ge681498 built on MoarVM version
2017.03-115-ge8231a3
implementing Perl 6.c.

Thank you for the report. This is now fixed.

The Seqs aren't actually consumed; it was a bug in .perl wrongly
saying they're consumed.

Fix​: rakudo/rakudo@54f50956ad
Test​: Raku/roast@7d4092d940

Thanks for fixing a bug.

However, if leaving out a .perl calling, the following example also
cause the issue in my environment​:

$ perl6 -e 'for ["1​:0.470572470261861",
"2​:0.579981821025709"]>>.split("​:", :skip-empty).sort({ $^b[0] <=>
$^a[0] }) -> ($k,$v) { ($k,$v).say }'
Too few positionals passed; expected 2 arguments but got 0 in sub-
signature
in block <unit> at -e line 1

$ perl6 --version
This is Rakudo version 2017.03-217-ge681498 built on MoarVM version
2017.03-115-ge8231a3
implementing Perl 6.c.

Sorry, please forget the above my post.
I noticed that the above one has nothing to do with .sort and doesn't match the title of this issue.

$ perl6 -e 'for ((1, 2).Seq, (3, 4).Seq) -> ($k,$v) { ($k,$v).say; }'
Too few positionals passed; expected 2 arguments but got 0 in sub-signature
  in block <unit> at -e line 1

@p6rt
Copy link
Author

p6rt commented Apr 28, 2017

From @zoffixznet

On Fri, 28 Apr 2017 11​:55​:40 -0700, cookbook_000@​yahoo.co.jp wrote​:

On Fri, 28 Apr 2017 11​:41​:36 -0700, cookbook_000@​yahoo.co.jp wrote​:

On Fri, 28 Apr 2017 10​:40​:49 -0700, cpan@​zoffix.com wrote​:

On Fri, 28 Apr 2017 09​:36​:52 -0700, cookbook_000@​yahoo.co.jp wrote​:

See the following result​:

$ perl6 -e '["1​:0.470572470261861",
"2​:0.579981821025709"]>>.split("​:", :skip-empty).sort({ $^b[0]
<=>
$^a[0] }).perl.say;'
(Seq.new-consumed(), Seq.new-consumed()).Seq

I think if sort method cannot look (i.e. consume) a Nth-indexed
value
(e.g. $^b[0], $^b[1], ...) and this behavior is a specced one, it
should return a warning message.

$ perl6 --version
This is Rakudo version 2017.03-217-ge681498 built on MoarVM
version
2017.03-115-ge8231a3
implementing Perl 6.c.

Thank you for the report. This is now fixed.

The Seqs aren't actually consumed; it was a bug in .perl wrongly
saying they're consumed.

Fix​: rakudo/rakudo@54f50956ad
Test​: Raku/roast@7d4092d940

Thanks for fixing a bug.

However, if leaving out a .perl calling, the following example also
cause the issue in my environment​:

$ perl6 -e 'for ["1​:0.470572470261861",
"2​:0.579981821025709"]>>.split("​:", :skip-empty).sort({ $^b[0] <=>
$^a[0] }) -> ($k,$v) { ($k,$v).say }'
Too few positionals passed; expected 2 arguments but got 0 in sub-
signature
in block <unit> at -e line 1

$ perl6 --version
This is Rakudo version 2017.03-217-ge681498 built on MoarVM version
2017.03-115-ge8231a3
implementing Perl 6.c.

Sorry, please forget the above my post.
I noticed that the above one has nothing to do with .sort and doesn't
match the title of this issue.

$ perl6 -e 'for ((1, 2).Seq, (3, 4).Seq) -> ($k,$v) { ($k,$v).say; }'
Too few positionals passed; expected 2 arguments but got 0 in sub-
signature
in block <unit> at -e line 1

Thanks. That's fixed now as well.

Fix​: rakudo/rakudo@98e137b1fe
Tests​: Raku/roast@b218a1ac01

@p6rt p6rt added Bug LTA Less Than Awesome; typically an error message that could be better labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant