Coder Social home page Coder Social logo

hyperlamb's Introduction

hyperlamb

Hyperlamb is a hypermedia-driven lambda calculus evaluator. Yes.

This is very much work in progress.

Starting the lambda calculus evaluator

If you want, you can clone the repository, build the project, open a browser and navigate to http://localhost:8080/hyperlamb. However, it's even easier to go to http://hyperlamb.azurewebsites.net

In either case, you should see a text box where you can enter a lambda expression.

You might want to start with something simple, like the identity function:

λx.x

Note: if you find it cumbersome to type lambdas, you can use backslash as a poor man's lambdas. So the following is also an acceptable way of writing the identity function:

\x.x

Either way, there's not a whole lot you can do with an expression like that. It is already on normal form, which means it cannot be reduced further. So you might want to try something more involved, like this:

(λn.λf.λx.f (n f x)) (λf.λx.x)

Which can be interpreted as applying the successor function to the Church encoding of the number zero. In general when a lambda expression can be reduced further, there will be a next link available to perform a reduction step. If the evaluation process terminates (as it will in this case), we will eventually end up with an expression on normal form again.

Lambda expressions may be named to make them slightly more wieldy to work with. Adding a name to a lambda expression creates an alias hyperlink for navigating to the expression.

An example should make things clearer. Say we have the expression for the Church encoding of zero:

λf.λx.x

We find it useful to add the name zero for this expression. This adds a hyperlink, /names/zero, that can be used to navigate to the expression (send it to a friend!). In addition, the name will be shown whenever we look at that particular lambda expression. You can also use the name as an expanding text macro in your lambda expressions, by prefixing the name with a dollar sign. For example, you can write $zero in a lambda expression and have it expand to the expression with that name.

If you proceed to add the name succ to the following expression:

λn.λf.λx.f (n f x)

You can now write $succ $zero and have it expand to this:

(λn.λf.λx.f (n f x)) (λf.λx.x)

hyperlamb's People

Contributors

einarwh avatar glorp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

glorp sizzles

hyperlamb's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.