Last active
April 11, 2019 02:55
-
-
Save ugexe/94f0b84848ed869720e6d214a08674c7 to your computer and use it in GitHub Desktop.
Polyglot Perl 5/6 pascals triangle
This file contains hidden or 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 @ARGV = do { sub eval { &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; | |
my @state = (1,); | |
for (1 .. @ARGV[0]) { | |
print(join(" ", @state), "\n"); | |
my @row = map &{ sub ($_) { @state[$_] + (@state[$_ + 1] // 0) } }.(), (0 .. ($_ - 2)); | |
@state = (); | |
push(@state, 1); | |
push(@state, $_) for @row; | |
push(@state, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment