combinators.scm is a very small combinator calculus evaluator written in Scheme. To run it, you will need to have Chez Scheme installed on your machine.
Running an expression
$ ./combinators.scm "S K K 1" => 1
Running an expression and converting it to an integer
$ ./combinators.scm "SUCC ZERO" as number => 1
Here is a list of supported combinators. Please ensure that their names are CAPITALIZED in the expression.
- S
- K
- I
- Y
- C1
- C2
- PAIR
- ZERO
- SUCC
- ADD
- MUL
- FIRST
- SECOND
- M
- I2
- ONE
- FAC
Additionally, users can use (TO-CHURCH <integer>)
to get the church numeral representation of a number.
$ ./combinators.scm "ADD (SUCC ONE) (TO-CHURCH 1)" as number => 3
The church numeral to number conversion fails for some expressions due to type errors.
I primarily used this lecture’s slides for the definitions of the advanced combinators.
This program is licensed under GPL v3 or later. © 2023 Sarthak Shah (cel7t)