Timeline for Print a Block-Diagonal Matrix
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 11, 2015 at 14:39 | comment | added | nutki | @MartinBüttner, it is all moot anyway as randomra's approach gives much shorter solution: -lna //,print join$",map$'==$_|0,@,for@,=map{(++$i)x$_}@F. BTW my version of Perl does not set -n with -a, it must be a recent addition. | |
| Feb 11, 2015 at 14:03 | comment | added | nutki | The program reuses the eol from the standard input. Your ideone setup works when you add it. As for the character count, I count it this way in all my answers, and I've seen others do it this way too. I have seen the post you linked before, but I don't get what it means by "count the difference to perl -nl file.pl". Original perlgolf rules would count the hyphen but not the space so 3 characters in this case. | |
| Feb 11, 2015 at 11:53 | comment | added | Martin Ender | strangely, this doesn't print newlines for me on ideone. also, according to this post you should code the custom shebang as 4 bytes, not two. you can fix that by not using the shebag but instead using the flags on the interpreter and calling the code with -e instead of from a file (see examples in that meta post). also, I think you don't need the n flag - according to the perldoc, a sets n implicitly. | |
| Feb 11, 2015 at 11:22 | history | answered | nutki | CC BY-SA 3.0 |