hi\n is a joke language created by User:Xavo in May 2015. It is a completely useless language that does the following things:
- It instantiates the string "eat pie" 98 times using a for loop.
- It sets the variable 'x' to a string with exactly 1,000,000 'a's.
- It sets the variable 'squiggly' to the square root of 5.
- Most importantly, it prints 'hi' with a trailing newline.
How to write an interpreter
The program must do the following things in this order to be considered a hi\n interpreter:
- It must instantiate the string "eat pie" exactly 98 times, using a for loop.
- It must set the variable 'x' to a string containing exactly 1,000,000 'a's.
- It must set the variable 'squiggly' to the square root of 5.
- Most importantly, it must print 'hi' with a trailing newline.
- Standard libraries are allowed.
- It does not have to read any file at all.
Faulty Interpreter in Ruby
for i in 1..98 do "eat pie" end x = "a"*1_000_000 squiggly = Math::sqrt(5) print "hi\n"
Note that the square root of 5 is an irrational number and the current version of Ruby does not support this number format.
import math for i in range(98): "eat pie" x = "a" * 1000000 squiggly = math.sqrt(5) print("hi")
Prints "hi" with a trailing newline:
Also prints "hi" with a trailing newline:
Potato potato potato, potato potato. Potato potato? Potato! Potato potato, potato.