WLWLWL
WLWLWL, We Live, We Love, We Lie, WeLiveWeLoveWeLie or 2 (a reference to the programming language's number system) is an esoteric programming language inspired by the Smurf Cat meme and SquidScript. It was created by User:LEOMOK. The instructions are lyrics fron Alan Walker's "The Spectre" and CG5's "Live Love Lie".
Syntax and instructions
WLWLWL uses variables and lists to store data. Variables in WLWLWL store 64-bit floats.
All WLWLWL programs should start with this line:
OnceUponATime
Literals and operators
Number literals in WLWLWL are written in binary, with WeLive
as 1, WeLove
as 0 and WeLie
to end the literal. Use And
for the bicimal point.
For example, 2.5 is:
WeLiveWeLoveAndWeLiveWeLie
There are also these predefined constants:
TheOtherSide Infinity, 1/0 ThePathUnknown NaN, 0/0 MyHead Pi, 3.14159... ThisRoadTooLong Euler's number, 2.71828...
Variable and list names match the regular expression [A-Z][A-Za-z]*
and cannot be a word in any instruction, or look like a literal, a predefined constant or an operator. Referencing a list name in a variable/value context returns its length.
To index a list, write (for example) List like Index
. List of Value
returns the first occurence of said value in said list, -1 if nonexistent. List indices start from 0.
Comments are written in square brackets.
And here are the operators (a and b are variable or list indices):
RareAs(a, b) returns a+b BlueAs(a, b) returns a-b Mushrooms(a, b) returns a*b UpTil(a, b) returns a/b NinthLife(a, b) returns a%b with the sign of a DeepestRiver(a, b) returns a**b. 0 to the power of 0 is 1. OldAs(a, b) returns log base b of a Time(a) returns -a BerryRipe(a) returns floor(a) Fairy(a) returns ceiling(a) HisKingdom(a) returns abs(a) TheDark(a, WeLiveWeLie) returns sin(a). All trig functions work in radians. TheDark(a, WeLiveWeLoveWeLie) returns cos(a) TheDark(a, WeLiveWeLiveWeLie) returns tan(a) TheLight(a, WeLiveWeLie) returns asin(a) TheLight(a, WeLiveWeLoveWeLie) returns acos(a) TheLight(a, WeLiveWeLiveWeLie) returns atan(a)
There are also these comparison and logical operators:
HeLived(a, b) returns 1 if a<b, else 0. HeLoved(a, b) returns 1 if a>b, else 0. HeLied(a, b) returns 1 if a==b, else 0. NaN == NaN in WLWLWL. AllWrong(a) logical not. Returns 1 if a is 0 or NaN, else 0. AllRight(a, b) logical and. 0 and NaN are the only falsy values, the rest are truthy. TooLong(a, b) logical or.
Instructions
Variables and lists
Hello a creates variable a and sets it to NaN HelloHello a creates empty list a TheresA a Inside b sets variable/list index b to a. If a is a list, truncates/extends a to b items, adding NaNs if extending. LetThe a TakeYouOnA b adds value b to list a. GazingOutOn a, b concatenates lists a and b to store back into a Seeing a Onthe b, c replaces subsegments of list a in list b with list c, acts in-place WalkinDownThis a, b, c finds subsegment of list a from indices b to c, then stores back into a SingItOutLike a, b, c removes items b to c in list a, acts in-place YeahThe a Were b convert a into a string with its decimal representation, then place the string's ascii values into list b AndThe a AreAlwaysInA b convert list b (as a Unicode string) into a decimal number, then store into a. NaN if invalid number. Before a FadeAway empty list a. WereTheWordsOf a fast list initialiser command. For details, see WLWLWL#Fast_list_initialisation. InThis a So b fill list a with the value of b.
Control flow
IsThatAPlace a start of if statement, a is the condition. WalkAlong a start of while loop, a is the condition. WhenEverythingIsAllWrong else in if statements. EverythingWillBeAllRight end of if statement or while loop. IBelieveYou breaks out of a loop, or ends the program if not in a loop HowCanIForget loop continue.
Input and output
CanYouHear a inputs a line, converts it into a number and puts it in a. NaN at EOF. NiceToMeet a inputs a character and puts its Unicode value in a. -1 at EOF. ItAllBelongsTo a inputs a string (until the first newline) and stores its Unicode values into the list a. Empties the list at EOF. VoiceInside a prints a as a decimal number. AsIScream a prints floor(a) as a Unicode character. Error if there is no such character. ToFind a print the list a (with all arguments floored) as a Unicode string. Error if any item has no Unicode character. DeepIn a open text file a (list, file name) for input. Until the file is closed or another file is opened, all input comes from that file. WeDontNeedThe a open text file a (list, file name) for output. Until the file is closed or another file is opened, all output goes to that file. Шайлушай close any open text files.
Function declaration
To declare a function definition, start with this line:
When FunctionName LivedForever ArgOne, ArgTwo, ArgThree...
The return value of the function will be stored in the variable Tale
(which need not be initialised). If it is not assigned at all, the function will return NaN.
After defining your function, simply call it like this:
FunctionName(ArgOne, ArgTwo, ArgThree)...
Functions can be used in expressions.
Fast list initialisation
There is a faster way to print and store strings in WLWLWL with the WereTheWordsOf
instruction. Simply write the string in single ''
or double ""
quotes, then the next line should be WereTheWordsOf
followed by a list name, which will set the list to the Unicode values of the string.
An example:
"We live, we love, we lie" WereTheWordsOf TheLittleFeline
Valid escape codes are \\
for a backslash, \"
for a double quote, \'
for a single quote, \n
for a newline and \(WeLiveWeLoveWeLie)
for an arbitrary character, in this case U+0002 (expression interpolation between the parentheses).
Turing-Completeness proof
WLWLWL is Turing-complete, as it can interpret Brainf***:
OnceUponATime HelloHello Tape TheresA WeLiveWeLiveWeLiveWeLoveWeLiveWeLoveWeLiveWeLoveWeLoveWeLiveWeLiveWeLoveWeLoveWeLoveWeLoveWeLie Inside Tape [Initialise 30000 cells...] InThis Tape So WeLoveWeLie [...which start at 0] HelloHello Input ItAllBelongsTo Input [input string] Hello Index TheresA WeLove Inside Index Hello Pointer TheresA WeLove Inside Pointer [set up pointer and loop] Hello Teleport Hello Nestings WalkAlong HeLived(Index, Input) IsThatAPlace HeLied(Input like Index, WeLiveWeLiveWeLiveWeLiveWeLiveWeLoveWeLie) [<] TheresA BlueAs(Pointer, WeLiveWeLie) Inside Pointer EverythingWillBeAllRight IsThatAPlace HeLied(Input like Index, WeLiveWeLiveWeLiveWeLiveWeLiveWeLoveWeLie) [>] TheresA RareAs(Pointer, WeLiveWeLie) Inside Pointer EverythingWillBeAllRight IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLoveWeLiveWeLiveWeLie) [+] TheresA RareAs(Tape like Pointer, WeLiveWeLie) Inside Tape like Pointer EverythingWillBeAllRight IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLiveWeLoveWeLiveWeLie) [-] TheresA BlueAs(Tape like Pointer, WeLiveWeLie) Inside Tape like Pointer EverythingWillBeAllRight IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLiveWeLiveWeLoveWeLie) [.] AsIScream Tape like Pointer EverythingWillBeAllRight IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLiveWeLoveWeLoveWeLie) [,] NiceToMeet Tape like Pointer IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLiveWeLoveWeLiveWeLiveWeLie) [start loop] IsThatAPlace HeLied(Tape like Pointer, WeLoveWeLie) TheresA Index Inside Teleport TheresA WeLove Inside Nestings WalkAlong HeLived(Input like Teleport, Input) IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLiveWeLoveWeLiveWeLiveWeLie) TheresA RareAs(Nestings, WeLiveWeLie) Inside Nestings EverythingWillBeAllRight IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLiveWeLiveWeLoveWeLiveWeLie) TheresA BlueAs(Nestings, WeLive) Inside Nestings EverythingWillBeAllRight IsThatAPlace HeLied(Nestings, Time(WeLiveWeLie)) TheresA Teleport Inside Index EverythingWillBeAllRight TheresA RareAs(Teleport, WeLiveWeLie) Inside Teleport EverythingWillBeAllRight IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLiveWeLiveWeLoveWeLiveWeLie) [end loop] IsThatAPlace HeLied(Tape like Pointer, WeLoveWeLie) TheresA Index Inside Teleport TheresA WeLove Inside Nestings WalkAlong TooLong(HeLoved(Input like Teleport, Input), HeLied(Input like Teleport, Input)) IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLiveWeLiveWeLoveWeLiveWeLie) TheresA RareAs(Nestings, WeLiveWeLie) Inside Nestings EverythingWillBeAllRight IsThatAPlace HeLied(Input like Index, WeLiveWeLoveWeLiveWeLiveWeLoveWeLiveWeLiveWeLie) TheresA BlueAs(Nestings, WeLive) Inside Nestings EverythingWillBeAllRight IsThatAPlace HeLied(Nestings, Time(WeLiveWeLie)) TheresA Teleport Inside Index EverythingWillBeAllRight TheresA BlueAs(Teleport, WeLiveWeLie) Inside Teleport EverythingWillBeAllRight TheresA RareAs(Index, WeLiveWeLie) Inside Index EverythingWillBeAllRight
Examples
OnceUponATime "Hello World!" WereTheWordsOf OutputString ToFind OutputString
FizzBuzz to input value:
OnceUponATime Hello EndLoop CanYouHear EndLoop TheresA WeLoveWeLie Inside Number "Fizz" WereTheWordsOf Fizz "Buzz" WereTheWordsOf Buzz "FizzBuzz" WereTheWordsOf FizzBuzz WalkAlong HeLived(Number, EndLoop) TheresA RareAs(Number, WeLiveWeLie) Inside Number IsThatAPlace HeLied(NinthLife(Number, WeLiveWeLiveWeLiveWeLiveWeLie), WeLove) ToFind FizzBuzz HowCanIForget EverythingWillBeAllRight IsThatAPlace HeLied(NinthLife(Number, WeLiveWeLiveWeLie), WeLove) ToFind Fizz HowCanIForget EverythingWillBeAllRight IsThatAPlace HeLied(NinthLife(Number, WeLiveWeLoveWeLiveWeLie), WeLove) ToFind Buzz HowCanIForget EverythingWillBeAllRight VoiceInside Number EverythingWillBeAllRight
Sieve of Eratosthenes to input value:
OnceUponATime Hello EndLoop CanYouHear EndLoop HelloHello IsPrime TheresA EndLoop Inside IsPrime InThis IsPrime So WeLiveWeLie [create list of 100 ones] TheresA WeLoveWeLie Inside IsPrime like WeLoveWeLie TheresA WeLoveWeLie Inside IsPrime Like WeLiveWeLie [remove indices 0 and 1] Hello Factor TheresA WeLiveWeLoveWeLie Inside Factor Hello Multiple WalkAlong AllWrong(HeLoved(Factor, DeepestRiver(EndLoop, WeLoveAndWeLiveWeLie))) IsThatAPlace IsPrime like Factor TheresA WeLiveWeLoveWeLie Inside Multiple WalkAlong HeLived(Mushrooms(Multiple, Factor), EndLoop) TheresA WeLove Inside IsPrime like Mushrooms(Multiple, Factor) TheresA RareAs(Multiple, WeLiveWeLie) Inside Multiple EverythingWillBeAllRight EverythingWillBeAllRight TheresA RareAs(Factor, WeLiveWeLie) Inside Factor EverythingWillBeAllRight Hello PrintIndex HelloHello Newline "\n" WereTheWordsOf Newline TheresA WeLiveWeLoveWeLie Inside PrintIndex WalkAlong HeLived(PrintIndex, EndLoop) IsThatAPlace IsPrime like PrintIndex VoiceInside PrintIndex ToFind Newline EverythingWillBeAllRight TheresA RareAs(PrintIndex, WeLiveWeLie) Inside PrintIndex EverythingWillBeAllRight