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

problem using arrays of things, some of themt should be arrays #1968

Closed
p6rt opened this issue Jul 24, 2010 · 10 comments
Closed

problem using arrays of things, some of themt should be arrays #1968

p6rt opened this issue Jul 24, 2010 · 10 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 24, 2010

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

Searchable as RT76698$

@p6rt
Copy link
Author

p6rt commented Jul 24, 2010

From @cognominal

I don't know if this is a problem with my code, with the Rakudo
implementation or the spec.
I end up with a Seq at $a[3] where I want an Array. This is not
indifferent because if I later handle the resulting data comparing
with eqv a Seq with an Array never returns true.

  $ perl6
  > my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is",
"so", "funny" ]; my $c = $b[2..3]; $a[3] = @​( $c ); say $a.perl
  ["this", "is", "so", ("so", "funny")]
  > my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is",
"so", "funny" ]; my $c = $b[2..3]; $a[3] = $c ; say $a.perl
  ["this", "is", "so", ("so", "funny")]
  > my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is",
"so", "funny" ]; my $c = $b[2..3]; $a[3] = $c ; say $a[3].WHAT
  Seq()

$ perl6

say @​( 1, 2).perl; my $a = (1,2); say @​( $a ).perl; my @​a = (1,2); say @​a.perl;
(1, 2)
(1, 2)
[1, 2]
say (1, 2) eqv [1, 2]
0

--
cognominal stef

@p6rt
Copy link
Author

p6rt commented Jul 24, 2010

From @cognominal

I am trying to to obtain ["this", "is", "so", ["so", "funny"]] for
the value of $a.
Without success.

Getting ["this", "is", "so", ("so", "funny")] bites me down the road
because a Seq and an Array with the same content do not compare as
equal.

my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c = $b[2..3]; $a[3] = @​( $c ); say $a.perl
["this", "is", "so", ("so", "funny")]
my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c = $b[2..3]; $a[3] = $c ; say $a.perl
["this", "is", "so", ("so", "funny")]
my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c = $b[2..3]; $a[3] = $c ; say $a[3].WHAT
Seq()

say @​( 1, 2).perl; my $a = (1,2); say @​( $a ).perl; my @​a = (1,2); say @​a.perl;
(1, 2)
(1, 2)
[1, 2]
(1,2) eqv [1,2]
0

--
cognominal stef

@p6rt
Copy link
Author

p6rt commented Jul 25, 2010

From @cognominal

On Sat, Jul 24, 2010 at 4​:54 PM, Stephane Payrard
<perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by  Stephane Payrard
# Please include the string​:  [perl #​76700]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=76700 >

I am trying to to obtain  ["this", "is", "so", ["so", "funny"]] for
the value of $a.
Without success.

Getting  ["this", "is", "so", ("so", "funny")] bites me down the road
because a Seq and an Array with the same content do not compare as
equal.

 my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ];  my $c = $b[2..3]; $a[3] = @​( $c );  say $a.perl
["this", "is", "so", ("so", "funny")]
 my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ];  my $c = $b[2..3]; $a[3] =  $c ;  say $a.perl
["this", "is", "so", ("so", "funny")]
 my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ];  my $c = $b[2..3]; $a[3] =  $c ;  say $a[3].WHAT
Seq()

 say @​( 1, 2).perl; my $a = (1,2); say @​( $a ).perl;  my @​a = (1,2); say @​a.perl;
(1, 2)
(1, 2)
[1, 2]
(1,2) eqv [1,2]
0

--
cognominal stef

This (non) bug is a duplicate of #​76698 that I thought lost by gmail.

--
cognominal stef

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

@coke - Status changed from 'new' to 'open'

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 7, 2011

From @coke

On Sat Jul 24 07​:42​:49 2010, cognominal wrote​:

I don't know if this is a problem with my code, with the Rakudo
implementation or the spec.
I end up with a Seq at $a[3] where I want an Array. This is not
indifferent because if I later handle the resulting data comparing
with eqv a Seq with an Array never returns true.

$ perl6

my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is",
"so", "funny" ]; my $c = $b[2..3]; $a[3] = @​( $c ); say $a.perl
["this", "is", "so", ("so", "funny")]
my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is",
"so", "funny" ]; my $c = $b[2..3]; $a[3] = $c ; say $a.perl
["this", "is", "so", ("so", "funny")]
my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is",
"so", "funny" ]; my $c = $b[2..3]; $a[3] = $c ; say $a[3].WHAT
Seq()

This now gives a Parcel() instead of a Seq​:

14​:35 < [Coke]> rakudo​: my $a = [ "this", "is", "so", "gross" ]; my $b =
[
  "that", "is", "so", "funny" ]; my $c = $b[2..3]; $a[3] =
$c ;
  say $a[3].WHAT
14​:35 <+p6eval> rakudo 1c2c2d​: OUTPUT«Parcel()␤»

$ perl6

say @​( 1, 2).perl; my $a = (1,2); say @​( $a ).perl; my @​a = (1,2);
say @​a.perl;
(1, 2)
(1, 2)
[1, 2]
say (1, 2) eqv [1, 2]
0

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 9, 2011

From @coke

On Sun Jul 25 12​:14​:50 2010, cognominal wrote​:

This (non) bug is a duplicate of #​76698 that I thought lost by gmail.

Ok, merged.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Sep 2, 2015

From @usev6

For the records​: Now (post GLR) this gives List() -- which looks correct​:

< bartolin> m​: my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c =
  $b[2..3]; $a[3] = $c; say $a[3].WHAT # RT #​76698
<+camelia> rakudo-moar 00be1e​: OUTPUT«(Parcel)␤»
< GLRelia> rakudo-moar 467b79​: OUTPUT«(List)␤»

But anyway, one way of setting $a to ["this", "is", "so", ["so", "funny"]] would have been

$ perl6 -e 'my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c = $b[2..3].Array; $a[3] = $c ; say $a.perl'
["this", "is", "so", ["so", "funny"]]

This also worked pre GLR -- the method Array was added back in 2011 with commit 0516515875.

I'm closing this ticket as 'resolved'. (No test added, since there doesn't seem to be a bug involved.)

Finally, some further notes from IRC​:

< ShimmerFairy> There was a Seq() way back when? Weeeeird O_o
< FROGGS> m​: my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c =
  $b[2..3]; say $c.WHAT; $a[3] = $c; say $a[3].WHAT
<+camelia> rakudo-moar 00be1e​: OUTPUT«(Parcel)␤(Parcel)␤»
< GLRelia> rakudo-moar 467b79​: OUTPUT«(List)␤(List)␤»
< timotimo> "way back when"? at that time Seq didn't exist :)
< ShimmerFairy> timotimo​: it's in that 2010 bug report though
< bartolin> ShimmerFairy​: If you have looked at the ticket​: I'm going to close it, because I don't see a
  bug there. At least nowadays one could use .Array if needed. Do you agree?
< FROGGS> bartolin​: it very much seems fixed
< ShimmerFairy> bartolin​: not to mention GLR has thrown a wrench in any list-related ticket :)
< bartolin> m​: my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c =
  $b[2..3].Array; $a[3] = $c; say $a.perl
<+camelia> rakudo-moar 00be1e​: OUTPUT«["this", "is", "so", ["so", "funny"]]␤»
< GLRelia> rakudo-moar 467b79​: OUTPUT«["this", "is", "so", ["so", "funny"]]␤»
< FROGGS> a slice returns a list, and it stays a list, which is correct

1 similar comment
@p6rt
Copy link
Author

p6rt commented Sep 2, 2015

From @usev6

For the records​: Now (post GLR) this gives List() -- which looks correct​:

< bartolin> m​: my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c =
  $b[2..3]; $a[3] = $c; say $a[3].WHAT # RT #​76698
<+camelia> rakudo-moar 00be1e​: OUTPUT«(Parcel)␤»
< GLRelia> rakudo-moar 467b79​: OUTPUT«(List)␤»

But anyway, one way of setting $a to ["this", "is", "so", ["so", "funny"]] would have been

$ perl6 -e 'my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c = $b[2..3].Array; $a[3] = $c ; say $a.perl'
["this", "is", "so", ["so", "funny"]]

This also worked pre GLR -- the method Array was added back in 2011 with commit 0516515875.

I'm closing this ticket as 'resolved'. (No test added, since there doesn't seem to be a bug involved.)

Finally, some further notes from IRC​:

< ShimmerFairy> There was a Seq() way back when? Weeeeird O_o
< FROGGS> m​: my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c =
  $b[2..3]; say $c.WHAT; $a[3] = $c; say $a[3].WHAT
<+camelia> rakudo-moar 00be1e​: OUTPUT«(Parcel)␤(Parcel)␤»
< GLRelia> rakudo-moar 467b79​: OUTPUT«(List)␤(List)␤»
< timotimo> "way back when"? at that time Seq didn't exist :)
< ShimmerFairy> timotimo​: it's in that 2010 bug report though
< bartolin> ShimmerFairy​: If you have looked at the ticket​: I'm going to close it, because I don't see a
  bug there. At least nowadays one could use .Array if needed. Do you agree?
< FROGGS> bartolin​: it very much seems fixed
< ShimmerFairy> bartolin​: not to mention GLR has thrown a wrench in any list-related ticket :)
< bartolin> m​: my $a = [ "this", "is", "so", "gross" ]; my $b = [ "that", "is", "so", "funny" ]; my $c =
  $b[2..3].Array; $a[3] = $c; say $a.perl
<+camelia> rakudo-moar 00be1e​: OUTPUT«["this", "is", "so", ["so", "funny"]]␤»
< GLRelia> rakudo-moar 467b79​: OUTPUT«["this", "is", "so", ["so", "funny"]]␤»
< FROGGS> a slice returns a list, and it stays a list, which is correct

@p6rt p6rt closed this as completed Sep 2, 2015
@p6rt
Copy link
Author

p6rt commented Sep 2, 2015

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

@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