We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Lazy Elementary Arithmetic

From Esolang
Jump to navigation Jump to search

Lazy Elementary Arithmetic (or LEA) is invented by User:AnyFunc.

Syntax

All of the rules look like this:

(1) FunctionName: Parameter1, Parameter2 ... = ExprReturned1, ExprReturned2 ...
(2) FunctionName. ExprApplied1, ExprApplied2 ...


Example:

F:x=3*x+2

F(x)=3x+2

G:x=G.x

G(x)=G(x)

C:x,y=x*x,y*y
U:x,y=x-y
A:x,y=x*U.x,y+y*U.x,y
U.C.5,4
A.5,4

x^2-y^2=(x+y)(x-y)=x(x-y)+y(x-y)


The available conditions/symbols/variable names/operators are:

Numbers

{x:x∈ℤ}

Letters

{x:x∈{Permutation({English Alphabet},+∞)}}

Operator

Indicated by the name, thus only elementary four operations:

+ : Addition
- : Subtraction
* : Mutiplication
/ : Truncated division (truncated to 0, remove digits after decimal point, eg. 5/2=2, -10/3=-3)

Examples

Truth-machine

NOT:x=1-x
C:c,x,y=c*x+NOT.c*y
P:x=1,P.x
C.c,P.x,0

Factorial

NOT:x=1-x
SQ:x=x*x
N:x=-1*x
S:x=x+1
P:x=x-1
Z:x=1/S.SQ.x-1
IZ:N.Z.x
C:c,x,y=c*x+NOT.c*y
fact:x=C.IZ.x,x*fact.P.x,1

Looping counter

S:x=x+1
N:x=x+1,N.S.x
N.0

Computational class

Elementary Arithmetic ensures:

  • Data manipulation
  • Storage


Lazy evaluation ensures:

  • Unbounded Recursion
  • Primitive Conditional Branching


I believe it is turing complete, need formal proof.


Interpreter

Developing in Python