# 2dL

**2dL** is a 2d representation of lambda calculus.its not exactly lambda calculus but.. also it was created by User:Yayimhere

## overview

memory is stored in two stacks. on stack holds functions(the **function stack**) and another holds the input of these function(the **input stack**). there is also a double tape(or tape with two rows) to store variables. the `λ`

command(the main command) will create a function. it constructed like this(also the code below is just `λx. x`

):

λ-.-π x x

first there is a lambda then a dash which is where the input(s) go. for each dash there is one of the inputs. and yes these lambda function have more than one input. then a dot and then another dash. whats under this dash is the function structure written like a normal lambda calculus function. the body ends with a pi. then it pushed onto the function stack. using a function:

(λ.)

this will pop and run the top function on the function stack with the inputs as the top values on the stack. the first input of the function will be the top of the input stack. it will push the result to the input stack. to save a function that uses the current cell on the tape(explained later) this is written instead:

(λ. A)

this will use the cell with label A(explained later). the arrows are:

{ left } right ¯ up _ down

to push a symbol onto the input stack:

!-? x

where x is the symbol. also if a variable is wanted in a function a # must be underneath it like this:

λ-.--π x xA #

where A is the variable(on the tape)

## other syntax

some other syntax

function stack | input stack | description |
---|---|---|

`^` |
`'` |
pop the top element on the stack and push it to the bottom |

`@` |
`ø` |
pop the top value of the stack |

`+` |
none | pop the top of function stack and push it onto the input stack |

none | `·` |
pop the top of the input stack and put it into the current cell |

`⌥` |
`$` |
reverse the stack |

none | `±` |
pop the top two values on the stack as first A and second B and do "A"+"B" as a string. Can be used on function but function will no longer be useable |

none | `i` |
push user input onto the top of the input stack |

`u` |
`U` |
pop the top of the stack and output it |

`(` |
`)` |
copy the top of the stack |

## the tape

the tape has to rows. the first row is whats held by the cell and whats in the second row is its "name". this basically works as a variable. the tape extends infintily to the left and right. to move around the tape:

< and >

to set the current cell name to something:

α-ά A

this will set its name to A. the name cant be longer than one char.

## other

there is one conditional command:

ι-.-&- A b c

if the top of the input stack is equal to A(if its a variable name it uses the variable but else it just uses the symbol) do the command b else do command c.

all code most be rotated so it is in the same direction as the code pointer. Horizontal dash is a pipe or `|`

the code pointers start by going right and start is the top left corner

## computational class

im pretty sure its turing complete since it both has a loop and lambda calculus itself is turing complete but it uses a stack and such and im to lazy to proove it

## examples

iι----.-&- f(x) _ }λ-.-πu _ x x }λ-.----π_u{ x f(x) }(¯

Conditional unary/binary increment:

_{{{{{{{{{{{ i}ι----.-&- ¯{{{+(U({ f(x) _ }@λ-.----π¯ _ x f(x) }+_{{{{ })±U¯

!-?}!-?±)U_ * ¯ * _ ¯{{{{{{{