Last active
May 3, 2016 02:21
-
-
Save AlexDaniel/0876e6e4b27af71c7d7048f9b05be590 to your computer and use it in GitHub Desktop.
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 class a { | |
has @.b; | |
method get-flat { @!b.map(|*.get-flat); } | |
method p { | |
say 'A: ', WHAT $.get-flat; | |
# why doesn't this loop act like D: below? | |
for self.get-flat() -> $c { | |
say 'B: ', $c.perl | |
} | |
} | |
} | |
my class b { | |
has @.c; | |
method get-flat { @!c }; | |
} | |
my $a = a.new( | |
:b( | |
b.new( :c(1, 2) ), | |
b.new( :c(5, 6) ), | |
) | |
); | |
$a.p(); | |
say ''; | |
say 'C: ', WHAT $a.get-flat; | |
for $a.get-flat() -> $c { | |
say 'D: ', $c.perl | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment