Created
March 20, 2020 17:00
-
-
Save bronco-creek/dbd1bb1acfc2fcfb0d1b8535737c389d to your computer and use it in GitHub Desktop.
This Raku code demonstrates a behavior that I don't understand. When the variable $x and $y are assigned to values in hashes, the hashes behave as I'd expect. But when those hashes are pushed into an array, it looks like $x and $y are bound to their slots in the hashes rather than assigned. I don't get it...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $x = 33; | |
my $y = 33; | |
my @space; | |
my %coords = 'x', $x, 'y', $y; | |
%coords.say; | |
@space.push(%coords); | |
$x = 42; | |
%coords = 'x', $x, 'y', $y; | |
%coords.say; | |
@space.push(%coords); | |
put "From the array"; | |
for @space { $_.say } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment