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

Shaped variables #1756

Closed
p6rt opened this issue May 10, 2010 · 6 comments
Closed

Shaped variables #1756

p6rt opened this issue May 10, 2010 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 10, 2010

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

Searchable as RT75002$

@p6rt
Copy link
Author

p6rt commented May 10, 2010

From @MasterDuke17

I was testing rakudo out on a project euler problem and noticed some
odd behavior in multi-dimensional arrays. I modified the array in a
loop, but when that loop was finished and I printed the array in
another loop it had incorrect values. Below is some code that
demonstrates the behavior. @​d[0..3;1] should be 3,5,7,9, but instead
they're all 9. This was tested on the trunk, current as of a couple
hours ago.

Daniel Green

#/usr/bin/perl6

use v6;

my @​d[4;4];

for 0..3 -> $x {
  @​d[$x;0] = 1;
  my $s = 2 * ($x + 1);

  print "\$x=$x, \$s=$s, \@​d[\$x;0]=@​d[$x;0], \$s + \@​d[\$x;0]=" ~
$s + @​d[$x;0];

  @​d[$x;1] = $s + @​d[$x;0];
  say ", \@​d[\$x;1]=@​d[$x;1]";
}

print "\n";

for 0..3 -> $x {
  for 0..3 -> $y {
  say "\$x=$x, \$y=$y, \@​d[\$x;\$y]=@​d[$x;$y]";
  }
}

@p6rt
Copy link
Author

p6rt commented Dec 10, 2010

From @thundergnat

This is Rakudo Perl 6, version 2010.11 built on parrot 2.10.1
RELEASE_2_10_1-679-g9bec614

Not sure what exactly the problem was or how/when it got fixed, but it
returns what I would expect.

perl6 RT75002.pl
$x=0, $s=2, @​d[$x;0]=1, $s + @​d[$x;0]=3, @​d[$x;1]=3
$x=1, $s=4, @​d[$x;0]=1, $s + @​d[$x;0]=5, @​d[$x;1]=5
$x=2, $s=6, @​d[$x;0]=1, $s + @​d[$x;0]=7, @​d[$x;1]=7
$x=3, $s=8, @​d[$x;0]=1, $s + @​d[$x;0]=9, @​d[$x;1]=9

$x=0, $y=0, @​d[$x;$y]=1
$x=0, $y=1, @​d[$x;$y]=9
$x=0, $y=2, @​d[$x;$y]=Any()
$x=0, $y=3, @​d[$x;$y]=Any()
$x=1, $y=0, @​d[$x;$y]=1
$x=1, $y=1, @​d[$x;$y]=9
$x=1, $y=2, @​d[$x;$y]=Any()
$x=1, $y=3, @​d[$x;$y]=Any()
$x=2, $y=0, @​d[$x;$y]=1
$x=2, $y=1, @​d[$x;$y]=9
$x=2, $y=2, @​d[$x;$y]=Any()
$x=2, $y=3, @​d[$x;$y]=Any()
$x=3, $y=0, @​d[$x;$y]=1
$x=3, $y=1, @​d[$x;$y]=9
$x=3, $y=2, @​d[$x;$y]=Any()
$x=3, $y=3, @​d[$x;$y]=Any()

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @diakopter

Well, it now outputs​:

14​:01 <diakopter> r​: https://gist.github.com/2830046
14​:01 <p6eval> rakudo e2d876​: OUTPUT«===SORRY!===␤Shaped variable
declarations not yet
  implemented. Sorry. ␤at /tmp/0vgPqDbaIV​:1␤»

@p6rt
Copy link
Author

p6rt commented May 29, 2012

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

@p6rt
Copy link
Author

p6rt commented Nov 20, 2015

From @jnthn

On Tue May 29 12​:02​:02 2012, diakopter wrote​:

Well, it now outputs​:

14​:01 <diakopter> r​: https://gist.github.com/2830046
14​:01 <p6eval> rakudo e2d876​: OUTPUT«===SORRY!===␤Shaped variable
declarations not yet
implemented. Sorry. ␤at /tmp/0vgPqDbaIV​:1␤»

Shaped arrays, both object and native, are now implemented and, so far, covered by around 300 tests in the S09-multidim directory. We'll likely find various bits and pieces to fix, but they can be tracked by their own tickets as we discover them.

/jnthn

@p6rt p6rt closed this as completed Nov 20, 2015
@p6rt
Copy link
Author

p6rt commented Nov 20, 2015

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

@p6rt p6rt added the Todo 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