VTL-2, 194 bytes
33 ~=#-1
51 ~=~+1
53 #=51*((~=35)+(~=(35+1))+(~=(35+5))+(~=(35+5+1))+(~=(35+5+1+1))
55 #=51*((~=(35+5+3))+(~=(35+5+5))+(~=(51-1-1))+(~=51)+(~=53)
111 #=51*(55+5+1=~
113 $=~
115 #=51*(1-(~=(115+5+5
Prints !"%&',./0246789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}
. It's about double the length of the comment approach, but much more interesting. I had to use some digits, and restricting it to 1, 3, and 5 seemed to work the best... though I haven't proven this. Line-by-line explanation:
33: Assigns the variable ~
to the current line number (#
) less 1. Originally I was going to use !
and be able to start printing from 34 on, but... !
is a system variable.
51: Increments the value in ~
53, 55, 111: These all basically say IF ~ == 35 OR ~ == 36 OR ~ == 40 [...] GOTO 51
. VTL relies heavily on system variables. #
is the line number variable - as in line 33, we can pull the value of the current line number, but if we assign a value to #
, it's a GOTO. The initial #=
is this assignment, everything else is evaluation. Any given ~=35
type evaluation returns one for true (equality) or zero otherwise. We do as many of these as fit in a line (72 characters), sum them, and multiply this by our target line number. If any of those evaluations were true, we end up with #=51
; if not, we end up with #=0
, essentially a NOP.
113: Output character corresponding to code point.
115: Same sort of GOTO construction as above, except we're looping back IF ~ != 125
. So, first we have to see if ~
does equal 125, then subtract that from 1 to make it a NOT.
Keeping in mind the line length restrictions, the lazy commented version comes in at 93 bytes:
12340 )"#$%&'(*+,-./:;<=>?ABCDEFGHIJKLMNOPQRSTU!
56789 )VWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@
...although I can't actually enter this because the @
chokes it. And now I know why: "At any time before hitting Return, the entire line may be erased by typing the At-signcharacter ‘@’ (Shift-P or “Cancel” on some terminals.)". So the non-printing commented version is purely theoretical, and some code would have to be written to at least print the @
... which would mean code to print the characters used in that code, etc...
0x20
to0x7e
, which are defined as the "printable ASCII characters". Technically tabs and newlines are actually control characters. \$\endgroup\$ – Joe Z. Aug 23 '13 at 19:22