Giter VIP home page Giter VIP logo

lambda-calculus-presentation's Introduction

lambda-calculus-presentation

This is the code behind my slides for the Lambda Pi Meetup talks about the Lambda Calculus.

How does it work?

The slides are written in Emacs org-mode. That's were most of the code (except some additional tests) resides, too.

The Makefile uses a "headless" emacs to export (tangle) the code and to export the slides as Tex files. Then the tests are executed with stack and the Tex files are build with XeTeX.

This technique is called Literate Programming. It makes sure that the code examples in documents compile and can be tested.

Because this setup needs some dependencies (Tex, Emacs, Graphviz, ...) I added a Nix file. Using the Nix package manager I can easily setup the needed environment on different machines.

The init.el file does the same for the "Emacs World". Because every Emacs installation differs, this file provides the minimal needed config to build the project and installs the needed packages.

How to use it?

Most likely you attended to the Lambda Pi Meetup and want to play around with the code. In this case you can ignore all the Emacs related stuff and regard this project as an ordinary stack project:

stack build
stack test

If you want to use the Emacs exporting and slide creation stuff, you can use Nix and make:

nix-shell
make

Beware: The Tex build stage isn't rock solid! If there was a XeTex error, you'll likely need to run:

make clean

Warning

This "publishing pipeline" for Literate Programming "works for me". I didn't create it to be a general solution. There are some rough edges and if you want to use it you should know make, Nix, Emacs and stack.

Bugs

The evaluator (UntypedEval) doesn't care about ambiguous variable / parameter names.

For example:

(λx. λy. x + y) y

There are two different ys in this expression. Reducing the expression to (λy. y + y) would be wrong, because it looses the information of the outer y. Reducing the expression to (λy. x + y) would be wrong, because x is now free (even though it was previously bound) and we again lose the information of y.

There are different solutions to this problem:

  • Do a renaming phase before any evaluation to get rid of the ambiguities.

    • After renaming: (λx0. λy1. x0 + y1) y0
  • De Bruijn Indices - A clever technique that replaces the variable names with an index that describes where they were bound.

Kudos & Thanks to @pheymann for spotting this bug!

lambda-calculus-presentation's People

Contributors

supersven avatar

Watchers

 avatar  avatar  avatar

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.