Selfie

From Esolang
Jump to navigation Jump to search

Selfie is language by User:ChuckEsoteric08 inspired by Muriel

Specification

At the start of the program variables are set to 0. Unlike Muriel after executing subprogram it would go back to the program

.X. Output X
,X'Y, Set variable X to Y
!X! Execute X as Selfie program
(X'Y'Z) Execute Z as Selfie program if variable X is not Y

Arguments

X+Y Return X + Y
X-Y Return X - Y
X*Y Return X * Y
X/Y Return X / Y
=X= Return value of variable X
? Return user input
~ Return currently running program's source code

Examples

Hello, World!

.Hello, World!.

Infinite loop

!~!

Truth machine

,loop'.!=loop=!,,a'?',.=a=(a'0'=loop=)

Use of ~

In the program:

.a!.a,x'~,!

variable x would be .a,x'~,, not .a!.a,x'~,!

Computational class

Selfie is Turing-complete because it is possible to translate PMMN without "else" blocks to it.

inc(x):

,x'=x=+1,

dec(x):

,x'=x=-1,

if(dec(x)) {...}:

(=x='0'...)

while(dec(x)) {...} and loop is named y:

,y'(x'0'...!=y=!),!=y=!