Timeline for Implement a Truth-Machine
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2020 at 9:04 | history | edited | CommunityBot |
Commonmark migration
|
|
Nov 4, 2015 at 14:25 | comment | added | ThisSuitIsBlackNot |
@Dennis ...which I just realized can be fixed with -l : perl -lpE 'say while$_' (11 bytes + 2 for -lp ).
|
|
Nov 4, 2015 at 14:21 | comment | added | ThisSuitIsBlackNot |
@Dennis As I mentioned in my first comment, say doesn't work for this because it leaves a newline after 1, but no newline after 0, which violates the rule that usage of newlines must be consistent.
|
|
Nov 4, 2015 at 5:26 | comment | added | Dennis |
say is shorter, even if you count -E as an extra byte.
|
|
Nov 4, 2015 at 4:52 | comment | added | ThisSuitIsBlackNot |
Yep, the string 0 is false but 0 + newline is true. See perldoc perlsyn .
|
|
Nov 4, 2015 at 4:48 | history | edited | a spaghetto | CC BY-SA 3.0 |
added 126 characters in body
|
Nov 4, 2015 at 4:47 | comment | added | a spaghetto | @ThisSuitIsBlackNot Ah-ha! I tried print while$_ but I couldn't figure out why it didn't work. I didn't realize you couldn't have the trailing newline on the input. | |
Nov 4, 2015 at 4:46 | comment | added | ThisSuitIsBlackNot |
Statement modifiers are your friend! Also, if you ensure that the input has no trailing newline, you can drop the +0 : echo -n 0 | perl -pe'print while$_' (13 bytes + 1 for -p ). perl -M5.010 -pe'say while$_' would be even shorter, but that results in inconsistent newlines between 0 vs. 1.
|
|
Nov 3, 2015 at 17:37 | history | answered | a spaghetto | CC BY-SA 3.0 |