Coder Social home page Coder Social logo

alonzo's Introduction

Alonzo

A simple CLI for working with lambda calculus expressions.

Required Racket to be installed on your system to run. Tested with Racket 6.3.

Examples

~ alonzo -c "(λx.x λz.z)"
OK.
➜  ~ alonzo "(λx.x a)"
a
➜  ~ alonzo -v "((λx.λz.x first) second)"
(λz.first second)
first

Usage

# Syntax check an expression
alonzo -c [expression]

# Simplify an expression
alonzo [expression]

# Simplify an expression, showing each β-reduction step
# (TODO)
alonzo -v [expression]

# Identify free variables in an expression
alonzo -f [expression]

# Identify bound variables in an expression
alonzo -b [expression]

Syntax

Taken from An Introduction to Functional Programming Through Lambda Calculus.

<expression> ::= <name> | <function> | <application>

<name> ::= [a-z]+(-[a-z]+)*

<function> ::= λ <name> . <body>
  <body> ::= <expression>

<application> ::= ( <function expression> <argument expression> )
  <function expression> ::= <expression>
  <argument expression> ::= <expression>

Whitespace is not required except in <application>, to separate the <function expression> from the <argument expression>.

Free variables in the top-level expression will be left as-is. For example, the expression (λx.x b) simplifies to b. b is free in the original expression, and thus is treated as a literal and left as-is.

alonzo's People

Contributors

drautb avatar

Watchers

 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.