Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel
Last active May 3, 2016 02:21
Show Gist options
  • Save AlexDaniel/0876e6e4b27af71c7d7048f9b05be590 to your computer and use it in GitHub Desktop.
Save AlexDaniel/0876e6e4b27af71c7d7048f9b05be590 to your computer and use it in GitHub Desktop.
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