Skip to main content

Calchylus - Lambda Calculus with Hy

Project description

Calchylus is a Hy module that is used to evaluate, and furthermore, to understand 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. -wikipedia.org

Intended audience is those who:

  1. are interested of the theory and the history of the programming languages,

  2. may have some experience in Python and/or Lisp,

  3. but also those, who wants to narrow the gap between mathematical notation and programming languages, especially in terms of logics.

Andrew Bayer writes in his blog post in 2016/08:

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

Lambda calculus, on the other hand, reveals how the computation is made by manipulation of objects.

Calchylus can also serve as a starting point for a mini programming language. Via custom macros representing well known Lambda forms, Calchylus provides all necessary elements for boolean, integer and list data types as well as conditionals, loops, variable setters, mathematical operators and exemplary arithmetic functions like, summation, factorial, and fibonacci.

Quick start

$ pip install hy calchylus
$ hy
(require [calchylus.lambdas [*]])
(with-alpha-conversion-and-macros L ,)
(L x y , (x (x (x (x (x y))))) a b)
; (a (a (a (a (a b)))))
(FIBONACCI FIVE)
; (x (x (x (x (x (x (x (x (x (x (x (x (x y)))))))))))))

Project details


Download files

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

Source Distribution

calchylus-0.1.3.tar.gz (9.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page