Def run(t):

From Esolang
Jump to navigation Jump to search

def run(t): is an esoteric subset of Python named by User: Jan jelo. In contrast to LambdaPython, there is no lambda or anything else here except def, return, function calling and name of function.

Characters

There are only 9 characters in def run(t): defrunt(): \n This allows to define function,function call and return a value.

Turing Completeness

In def run(t), the recursive depth limit has been removed, and it is possible to use it to encode untyped lambda calculus, so it ought to be Turing-complete. It is also possible to encode a Turing-complete basis from combinatory logic, like SKI:

# K
def f(t):
 def ff(tt): return t
 return ff
# S
def f(t):
 def ff(tt):
  def fff(ttt): return t(ttt)(tt(ttt))
# I
def f(t): return t

Output

If the last line of program is a function call,assume that it is a church number and convert it into a integer to print.

Example

Church numeral

def f(t):#this is zero
  def ff(tt):return tt
  return ff
def ft(t):#this is succ
  def fft(tt):
    def ffft(ttt):return tt(t(tt)(ttt))
    return ffft
  return fft
              

fixed point combinator

def ftt(t):
  def fftt(tt):return ftt(t)(tt)
  return t(fftt)