Created
November 13, 2009 01:16
-
-
Save masak/233491 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
$ cat /tmp/test | |
class M { | |
has M @.ms is rw; | |
method s($i=0) { | |
$i ~ "[{ map { "{$_.s($i + 1)}" }, self.ms }]" | |
} | |
} | |
my $m = M.new; | |
my $m2 = M.new; | |
$m2.ms = M.new; | |
$m.ms = M.new, $m2, M.new; | |
say $m.s; | |
$ perl6 /tmp/test | |
0[1[] 2[3[]] 4[]] | |
# expected output: | |
# 0[1[] 1[2[]] 1[]] | |
# This used to be code doing indentation before I golfed it. The numbers correspond | |
# to nesting level. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment