Print all ASCII alphanumeric characters without using them
Octave, 52 46 40 bytes
['['-('"':'+'),'{'-(_='!':':'),_+'@','']
This evaluates to
9876543210ZYXWVUTSRQPONMLKJIHGFEDCBAabcdefghijklmnopqrstuvwxyz
Explanation
Here we are using the fact that characters are implicitly converted to integers when arithmetic operations like +-
or the range function :
are applied. When concatenated with an empty string ([...,'']
), the numbers again are converted to characters.
Try it online!
brainfuck, 77 76 75 72 bytes
++++++++[>+>++++++>++++>-<<<<-]>++[>.+<-]>>[>+>++>+++<<<-]>++[>+.>+.<<-]
Try it online!
How it works
The interpreter begins with a tape of 0 cells.
++++++++
This sets the first cell to 8, leaving the tape in the following state.
8
^
[>+>++++++>++++>-<<<<-]
This increments the second cell once, the third cell 6 times, the fourth cell 4 times, decrements the fifth cell once, then goes back to the beginning of the tape and decrements the first cell. After 8 iterations, the tape looks like follows.
0 8 48 32 -8
^
>++
We advance to the second cell and increment it twice, getting ready to print the digits.
0 10 48 32 -8
^
[>.+<-]
This prints the third cell, increments it, then goes back to the second cell and decrements it. After 10 iterations, we've printed 0123456789
and the tape looks like follows.
0 0 58 32 -8
^
>>
Time to prep the tape for the letters! We begin by advancing two cells.
0 0 58 32 -8 0 0
^
[>+>++>+++<<<-]
This increments the fifth cell once, the sixth cell twice, the seventh cell thrice, then goes back to the fourth cell and decrements it. After 32 iterations, the tape looks like follows.
0 0 58 0 24 64 96
^
>++
As a last step before printing the letters, we advance to the fifth cell and increment it twice.
0 0 58 0 26 64 96
^
[>+.>+.<<-]
Finally, we advance to the sixth cell to increment and print it, do the same for the seventh cell, then go back to the fifth cell and decrement it. After 26 iterations, we've printed Aa...Zz
.
Ruby, 42 bytes
->{[*?/...?:,*?@...?[,*?`...?{]-[?/,?@,?`]}
A function that returns a char array. A program that outputs just the characters is 49 bytes:
$><<([*?/...?:,*?@...?[,*?`...?{]-[?/,?@,?`])*''
This simply uses the ascii characters on either side of the relevant ranges to define a range. For example, ?/...?:
means the characters between a forward slash and a colon, excluding the end. To get rid of the beginnings, we subtract an array containing the three beginning characters.