esolang

The Church

Lazy K where every combinator is a Church numeral or a sum on them, written the way you write sums.

Blashyrkh, 2026 · Turing complete: yes · ●●● hard · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello

The idea

Blashyrkh made The Church in 2026. It is Lazy K with a different basis and a different syntax. The basis is addition, multiplication and exponentiation of Church numerals, and the numerals 0 to 9 themselves. So 6*7 is 42, and so is 2^5+2*5. These 13 combinators are enough for everything. The specification writes K as ^**10 and S as +1^*(***1^), and those two alone are complete.

Read the story

Everything is infix. The terms at even places are operators, so 123 is 2 applied to 1 and 3. Digits bind tighter than ^, ^ tighter than *, * tighter than +, and an operator in parentheses is the weakest of all. Numbers stay easy to read. Everything else, the specification says, looks completely mad.

The machine

CombinatorRule
++ m n f x = n f (m f x)
** m n f = n (m f)
^^ m n = n m
0 to 9k f x applies f to x k times

a OP b means OP a b, and every expression has an odd number of terms. Input and output are as in Lazy K. The program is applied to the input, a list of Church numerals with 256 for ever after the last byte, and the result is read back as a list of numerals. The first one of 256 or more ends the output. (***10)1224 is K 256, which the specification offers as the end of a list.

Example

The cat is 1, which hands the input back.

The cat is 1, which hands the input back.

42 is the code of *. (^1a)*(^1b) pairs a with b, so this is a list of 42 followed by K 256. The ^**10 in front is K, which makes the program ignore its input.

Expected: *

The Hello, world! program takes 2,806 reductions and ends with a line feed. Its last terms, 1(9*8), apply all that comes before to 72, the H.

Expected: Hello, world!

The quine is 1,333 characters, most of them digits in nested parentheses, and prints itself after 194,497 reductions. Its looping counter prints a line of one *, then two, then three, and never stops.

Patterns it teaches

Further

Golfing languages

Functional paradigm

Write your own in Run Convert a program from The Church

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: the-church.

Command line

shib run the-church -e '1' --input 'Hello, cat'
shib manual the-church

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/the-church.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org