File download
- File size:
- 12 472 bytes (12.18K)
- File date:
- 2024-12-29 14:13:04
- Download count:
- all-time: 0
Preview
- APL_34b.txt 49B
- code.png 4.70K
- file_id.diz 2.41K
- result.png 8.81K
file_id.diz
Christmas Present APL 34b
Author: Logiker
Language: APL
Usage:
Use https://tryapl.org/ to execute the code.
Or https://norbertkehrer.github.io/ibm_5110/emu5110.html.
Code:
⌽11↑'/o\'⋄' -|+'[1+T∘.+2×T←19⍴9↑1]
Length:
34 chars (stored with unicode it takes 49 chars)
Description:
9↑1 .. (Dyadic function: Take) .. 1 0 0 0 0 0 0 0 0
19⍴9↑1 .. (Dyadic function: Reshape) .. 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1
2×T←19⍴9↑1 .. 2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
T∘.+2×T←19⍴9↑1 .. outer product of the uppter two vectors using addition
3 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 3
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
3 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 3
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
2 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 2
3 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 3
Now we can print the box using: ' -|+'[1+T∘.+2×T←19⍴9↑1]
+--------+--------+
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
+--------+--------+
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
+--------+--------+
Now let's add the ribbon...
11↑'/o\' gives:
"/o\ " .. notice, that the string is filled up with blanks
⌽11↑'/o\' .. reverse it .. " \o/"
And finally combine all together!
⌽11↑'/o\'⋄' -|+'[1+T∘.+2×T←19⍴9↑1]
\o/
+--------+--------+
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
+--------+--------+
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
+--------+--------+