https://github.com/phase/lambda
Untyped Lambda Calculus Interpreter
https://github.com/phase/lambda
Last synced: 11 days ago
JSON representation
Untyped Lambda Calculus Interpreter
- Host: GitHub
- URL: https://github.com/phase/lambda
- Owner: phase
- License: mpl-2.0
- Created: 2018-02-14T19:32:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-22T19:53:43.000Z (over 7 years ago)
- Last Synced: 2025-03-18T19:55:16.797Z (over 1 year ago)
- Language: Kotlin
- Size: 28.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Lambda Calculus Interpreter
It is currently untyped. It may get types in the future.
Currently in the process of getting types. (System F; Polymorphic Lambda Calculus)
Here's a preview of what is currently supported:
```
>> 0 := \f.\x.x
0 : /a./b./c./d.((a -> b) -> ((c -> d) -> (c -> d))) = \f.\x.x
```
```
0 := \f.\x.x
1 := \f.\x.f x
2 := \f.\x.f (f x)
3 := \f.\x.f (f (f x))
true := \x.\y.x
false := \x.\y.y
and := \p.\q. p q p
or := \p.\q. p p q
not := \p.p false true
if := \p.\a.\b.p a b
isZero := \n.n (\x.false) true
inc := \n.\f.\x.f (n f x)
dec := \n.\f.\x.n (\g.\h.h (g f)) (\u.x) (\u.u)
plus := \m.\n.m inc n
mult := \m.\n.m (+ n) 0
sub := \m.\n.n (dec m)
(mult (add 2 3)) 2
```