Gift
Write a wish list. If nothing on it is too expensive, you get the first letter of every wish. Otherwise, coal.
UW, 2021 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 38 known programs · Test method
Run it
The idea
UW made Gift in 2021 as a festive joke with no practical use. The program is a wish list, one item per line. Gift does not read the words. It hashes each line, and a hash that is not a multiple of 4 means the item is too expensive. One expensive item and the whole output is coal, with no word on which item it was.
Read the story
Three lines in four come out too expensive, so most lists get coal. To print something you pick a line that starts with the letter you want and change the rest until the hash happens to be cheap.
The machine
| Step | Does |
|---|---|
| Split | One item per line; blank lines are skipped |
| Hash | 32-bit FNV-1a of the line in lower case, without spaces and tabs |
| Judge | Any hash not a multiple of 4 prints coal |
| Give | Otherwise print the first character of every item |
Since spaces never count, Gift cannot print one. The specification writes _ where Hello World needs a space.
Example
The successful list.
The successful list. The blank line is skipped, and the three first letters spell Lol.
The failed list. The second item is too expensive.
The Hello World is 13 wishes, each found so that its hash is cheap.
coal is a quine, since its own hash is too expensive. The specification also lists 62 characters that are quines on their own, such as A, ! and }, and all 62 print themselves.
Patterns it teaches
- Every text runs: any text is a wish list, and every list prints something.
- Quine:
coalprintscoal.
Further
See also
Also in Jokes
Write your own in Run Convert a program from Gift
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: gift.
Command line
shib run gift -e '!'shib manual giftSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/gift.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org