Skip to main content

Calchylus 3 - Lambda Calculus with Hy

Project description

Calchylus 3 - Lambda calculus with Hy


``calchylus3`` is a computer installable `Hy`_ module that is used to evaluate,
and furthermore through this documentation, shine light to the basics of Lambda
calculus (also written as λ-calculus).

`Lambda calculus`_ is a formal system in mathematical logic for expressing
computation that is based on function abstraction and application using
variable binding and substitution.

The target audience is those who:

a) are interested in the theory and the history of the programming languages
b) may have or are interested to gain some experience in Python and/or Lisp
c) who wants to narrow the gap between mathematical notation and
programming languages, especially by the means of logic

`Andrew Bayer`_ writes in his blog post about formal proofs and deduction:

*Traditional logic, and to some extent also type theory, hides computation
behind equality.*

Lambda calculus, on the other hand, reveals how the computation in logic is
done by manipulation of the Lambda terms. Manipulation rules are simple and
were originally made with a paper and a pen, but now we rather use computers for
the task. Lambda calculus also addresses the problem, what can be proved and
solved and what cannot be computed in a finite time. Formally these are called
the `decidability`_ and the `halting`_ problems.

Beside evaluating Lambda expressions, ``calchylus3`` module can serve as a
starting point for a mini programming language. Via `custom macros`_
representing well known Lambda forms, ``calchylus3`` provides all necessary
elements for boolean, positive integer, and list data types as well as
conditionals, loops, variable setters, imperative do structure, logical
connectives, and arithmetic operators. You can build upon that, for example
`real numbers`_ , even negative complex numbers if that makes any sense. Your
imagination is really the only limit.

Finally, when investigating the open source ``calchylus3`` implementation that is
hosted on `GitHub`_ , one can expect to get a good understanding of the higher
order functions and the `combinatory logic`_ , not the least of the fixed point
combinator or shortly, ϒ combinator.

Quick start

For people willing to get hands quickly on coding:


.. code-block:: bash

$ pip install calchylus3

**Open Hy**

.. code-block:: bash

$ hy

**Import lambda library**

.. code-block:: hylang

(require [calchylus3.lambdas [*]])

**Initialize lambda macros**

.. code-block:: hylang

(with-macros L)

**Lambda dance**

.. code-block:: hylang

(print* ((L x y [x [x y]]) 'a 'b)) ; output: (a (a b))

.. code-block:: hylang

(print* (FIBONACCI SEVEN 'x 'y)) ; output: (x (x (x (x (x (x (x (x (x (x (x (x (x y)))))))))))))


For full documentation, see: ``_

.. |Output:| replace:: [output]

.. _halting problem:
.. _combinatory logic:
.. _GitHub:
.. _real numbers:
.. _my favorite programming language:
.. _custom macros:
.. _decidability:
.. _Andrew Bayer:
.. _Lambda calculus:
.. _Hy:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for calchylus3, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size calchylus3-0.1.4.tar.gz (10.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page