LambdaWreck

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Syntax

  • func x =: declare new function x
  • lambda.(type) x: declare new lambda function with type and input x
  • pass: x return x

Example:

func Id =:
 lambda.any x: -> lambda.any x:
  pass: x          pass: x      -> x
 end              end
end 

Eval: lazy

Programs

Hello World!

This program outputs "Hello World" to the console

func hello =:
 lambda.str x: 
  pass: "Hello World"
 end
end
out:
 func.hello (x)
end

Omega

Feeds the input itself

func Omega =:
 lambda.any x:
  pass: x(x)
 end
end
out:
 func.Omega (x)
end

Y combinator

func Omega =:
 lambda.any x:
  pass: x(x)
 end
end
func Y =:
 lambda.any x:
  pass: func.Omega ( Omega(null) )
 end
end

If statement

func if =:
 lambda.bool f:
  lambda.any x:
   lambda.any y:
    pass: f(x,y)
   end
  end
 end
end

Truth-machine

Goes into a infinte loop if var is true

func var =:
 lambda.bool x
  pass: true
 end
end
func if =:
 lambda.bool f:
  lambda.any x:
   lambda.any y:
    pass: f(x,y)
   end
  end
 end
end
func Omega =:
 lambda.any x:
  pass: x(x)
 end
end
func Y =:
 lambda.any x:
  pass: func.Omega ( Omega(null) )
 end
end
out:
 func.if (var(), Y(), 0)
end