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

breakage of: .list for m:g/ (\d+)+ % '.' /; # advent 2012 day 22 #3377

Closed
p6rt opened this issue May 2, 2014 · 6 comments
Closed

breakage of: .list for m:g/ (\d+)+ % '.' /; # advent 2012 day 22 #3377

p6rt opened this issue May 2, 2014 · 6 comments

Comments

@p6rt
Copy link

p6rt commented May 2, 2014

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

Searchable as RT121789$

@p6rt
Copy link
Author

p6rt commented May 2, 2014

From @dwarring

The following is derived from http://perl6advent.wordpress.com/2012/12/22/day-22-parsing-an-ipv4-address/

$_ = "Go 127.0.0.1, I said!....";
{
  say .list>>.Str.perl;
  say $_.perl;
} for m​:g/ (\d+)+ % '.' /;

rakudo-2012.11​:
("127", "0", "0", "1")
Match.new(orig => "Go 127.0.0.1, I said!....", from => 3, to => 12, ast => Any, list => ((Match.new(orig => "Go 127.0.0.1, I said!....", \
from => 3, to => 6, ast => Any, list => ().list, hash => EnumMap.new()), Match.new(orig => "Go 127.0.0.1, I said!....", from => 7, to => \
8, ast => Any, list => ().list, hash => EnumMap.new()), Match.new(orig => "Go 127.0.0.1, I said!....", from => 9, to => 10, ast => Any, l\
ist => ().list, hash => EnumMap.new()), Match.new(orig => "Go 127.0.0.1, I said!....", from => 11, to => 12, ast => Any, list => ().list,\
hash => EnumMap.new())),).list, hash => EnumMap.new())

rakudo 2014.04-134-gfd5f8eb (all backends)​:
("127 0 0 1",)
Match.new(orig => "Go 127.0.0.1, I said!....", from => 3, to => 12, ast => Any, list => ([Match.new(orig => "Go 127.0.0.1, I said!....", \
from => 3, to => 6, ast => Any, list => ().list, hash => EnumMap.new()), Match.new(orig => "Go 127.0.0.1, I said!....", from => 7, to => \
8, ast => Any, list => ().list, hash => EnumMap.new()), Match.new(orig => "Go 127.0.0.1, I said!....", from => 9, to => 10, ast => Any, l\
ist => ().list, hash => EnumMap.new()), Match.new(orig => "Go 127.0.0.1, I said!....", from => 11, to => 12, ast => Any, list => ().list,\
hash => EnumMap.new())],).list, hash => EnumMap.new())

In summary there seems to have been a slight change in the structure of the capture which has broken this use of the .list() method

@p6rt
Copy link
Author

p6rt commented Aug 31, 2015

From @ShimmerFairy

Behavior has changed in rakudo​:

<ShimmerFairy> m​: say ("Go 127.0.0.1, I said! He went to 173.194.32.32." ~~ m​:g/ (\d ** 1..3) ** 4 % '.' /).map(*.list».Str.perl)
<camelia> rakudo-moar 5ba44f​: OUTPUT«(["127", "0", "0", "1"],) (["173", "194", "32", "32"],)␤»

And on current GLR​:

<ShimmerFairy> m​: say ("Go 127.0.0.1, I said! He went to 173.194.32.32." ~~ m​:g/ (\d ** 1..3) ** 4 % '.' /).map(*.list».Str.perl)
<GLRelia> rakudo-moar 36ea47​: OUTPUT«(($["127", "0", "0", "1"]) ($["173", "194", "32", "32"]))␤»

Without the .perl in the map, on nom it's a List of Parcel of Array, and on GLR it's a Seq of List of Array. (Using .list or .eager on the Seq would result in a List of List of Array.)

@p6rt
Copy link
Author

p6rt commented Aug 31, 2015

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

@p6rt
Copy link
Author

p6rt commented Aug 31, 2015

From @dwarring

I don't think we need the outer array, which only ever contains one element. How about​:

  $_ = "Go 127.0.0.1, I said! He went to 173.194.32.32.";
  say .list>>.Str.[0].perl for m​:g/ (\d ** 1..3) ** 4 % '.' /;
  # output​:
  # ["127", "0", "0", "1"]
  # ["173", "194", "32", "32"]

On Sun Aug 30 20​:52​:15 2015, lue wrote​:

Behavior has changed in rakudo​:

<ShimmerFairy> m​: say ("Go 127.0.0.1, I said! He went to
173.194.32.32." ~~ m​:g/ (\d ** 1..3) ** 4 % '.'
/).map(*.list».Str.perl)
<camelia> rakudo-moar 5ba44f​: OUTPUT«(["127", "0", "0", "1"],)
(["173", "194", "32", "32"],)␤»

And on current GLR​:

<ShimmerFairy> m​: say ("Go 127.0.0.1, I said! He went to
173.194.32.32." ~~ m​:g/ (\d ** 1..3) ** 4 % '.'
/).map(*.list».Str.perl)
<GLRelia> rakudo-moar 36ea47​: OUTPUT«(($["127", "0", "0", "1"])
($["173", "194", "32", "32"]))␤»

Without the .perl in the map, on nom it's a List of Parcel of Array,
and on GLR it's a Seq of List of Array. (Using .list or .eager on the
Seq would result in a List of List of Array.)

@p6rt
Copy link
Author

p6rt commented Sep 1, 2015

From @dwarring

I've modified and unfudged the test in advent2012-day22.t

Taking this as the new idiom and closing this ticket.

On Mon Aug 31 15​:41​:04 2015, david.warring wrote​:

I don't think we need the outer array, which only ever contains one
element. How about​:

$_ = "Go 127.0.0.1, I said! He went to 173.194.32.32.";
say .list>>.Str.[0].perl for m​:g/ (\d ** 1..3) ** 4 % '.' /;
# output​:
# ["127", "0", "0", "1"]
# ["173", "194", "32", "32"]

On Sun Aug 30 20​:52​:15 2015, lue wrote​:

Behavior has changed in rakudo​:

<ShimmerFairy> m​: say ("Go 127.0.0.1, I said! He went to
173.194.32.32." ~~ m​:g/ (\d ** 1..3) ** 4 % '.'
/).map(*.list».Str.perl)
<camelia> rakudo-moar 5ba44f​: OUTPUT«(["127", "0", "0", "1"],)
(["173", "194", "32", "32"],)␤»

And on current GLR​:

<ShimmerFairy> m​: say ("Go 127.0.0.1, I said! He went to
173.194.32.32." ~~ m​:g/ (\d ** 1..3) ** 4 % '.'
/).map(*.list».Str.perl)
<GLRelia> rakudo-moar 36ea47​: OUTPUT«(($["127", "0", "0", "1"])
($["173", "194", "32", "32"]))␤»

Without the .perl in the map, on nom it's a List of Parcel of Array,
and on GLR it's a Seq of List of Array. (Using .list or .eager on the
Seq would result in a List of List of Array.)

@p6rt
Copy link
Author

p6rt commented Sep 1, 2015

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

@p6rt p6rt closed this as completed Sep 1, 2015
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

1 participant