why tho

From Esolang
Jump to navigation Jump to search

why tho is a esolang created by User:Yayimhere and is inspired by Lambda calculus and Fractran.

How it works

The start of the program is a two lambda calculus expression (the first one is xn, and the second one is xm), each encased by square brackets.
The rest of the program consists of a list of lambda calculus expressions(all must be encased by normal brackets). Now the program sees if there is a lambda calculus function, f, such that when f is applied to xn, it evaluates xm.
If so, xn will be set to f, and xm will be set to xn. Every iteration of this, it will print xm, and f. 
if two functions are valid, it will set xn to the first function with input as the second function
If f cannot be found, xn will be added to the list, and xm will be swapped with xn
the program halts if xn=xm or xm=f
Why tho has input that can replace xn, By simply replacing the expression with µ

simple example

heres a simple example:

[λx. x] [λx. y] (λx.(x y)) (λx. x) (λx. λx. y)
f = λx. λx. y
Beta reducing '(λx. x)' into '(λx. (λx. y))'
β > (λx. y)
xn is equal to (λx. y)
now:
xn = λx. x
xm = λx. λx. y
f cannot be found
add xm to the list:
(λx.(x y)) (λx. x) (λx. λx. y) (λx. λx. y)
do the swap:
xn = λx. λx. y
xm = λx. x
f cannot be found
...

the loop continues

computational class

ok. heres how to represent any expression(here the expression is A) in lambda calculus proving why tho TC. then the program would become:

[(λx.x)] [A] (λx.x A)

yea that simple. note that only the first iteration of why tho is considered for computation

see also