The Ornithomicon is the infamous grimoire of Avian Arithmetic.
Before progressing deeper into the enchanted forests, you should be familiar with the 9 birds of the Bekimet, Becekew and Sekei forests.
Avian Truths & Lies
The Kestrel takes two words and discards the second word. In other words, it always keeps the first one, this is the word for True:
K▲ ◆ •▲ Kxy
The Kite takes two words and discards the first word. In other words, it never keeps the first one, this is the word for False:
KI▲ ◆ •◆ KIxy
The Cardinal swaps the second and third words, it can turn a lie into a truth, and a truth into a lie, this is the word for Not:
C(KI)▲ ◆ •▲ C(KI)(K)(KI)xy
The Mockingbird takes 2 words that can be either True or False, and says True if at least one of them is True, this is the word for Or:
M(KI)(K)▲ ◆ •▲ W(WK)(KI)(K)xy
Two Starlings and a Kestrel can work together to say True, when both words are True, this is the word for And:
SSK(KI)(K)▲ ◆ •◆ SSK(KI)(K)xy
Since the word for True keeps the first of 2 words, and False selects the second, we need a way to pass the second and third words to the first one. The Idiotbird is the equivalent to IfThenElse:
I(KI)▲ ◆ •◆ I(KI)xy
Avian Numerals
Avian numerals are somewhat odd, the value of a number is equal to how many times a word applies itself on another. Considering that numbers are times a word is applied onto another, applying "2 sqr" to a number "3" would give "sqr (sqr 3)", or 81.
0 | KIfx | x | 4 | SB(SB(WB))fx | f(f(f(fx))) |
---|---|---|---|---|---|
1 | Ifx | fx | 5 | SB(SB(SB(WB)))fx | f(f(f(f(fx)))) |
2 | WBfx | f(fx) | 6 | SB(SB(SB(SB(WB))))fx | f(f(f(f(f(fx))))) |
3 | SB(WB)fx | f(f(fx)) | 7 | SB(SB(SB(SB(SB(WB)))))fx | f(f(f(f(f(f(fx)))))) |
It looks like a Starling and Bluebird always give us the succeeding number, since "SB2" is 3 and "SB3" is 4.
SB5 •6 SB(SB(SB(SB(WB))))fx
Among its many talents, the Bluebird can also Multiply numbers, as "2(3f)" is the same as "6f", thus, "B(2)(3)" is the same as "6".
B2 3 •6 B(2)(3)fx
Our old friend the Thrush is capable of calculating the Power of two numbers. The following example is essentially applying the word three (which itself applies a word 3 times) four times.
T3 4 •81 C(WK)(3)(4)fx
As we travel deeper into the forest, we encounter the Nightingale, which applies a word to the result of the second and the fourth, and to the result of the third and the fourth:
N■ ▲ ◆ ● •■ (▲ ● )(◆ ● )B(BS)Bfxyz
The Nightingale allows us to apply the first number onto the second, or effectively Add numbers together:
NB2 3 •5 B(BS)BB(2)(3)fx
Ornithologics is the study of Avian Computing.
WORK IN PROGRESS
const I = a => a; const K = a => b => a; const S = x => (y => (z => x(z)(y(z)))); const KI = a => b => b; const C = f => a => b => f(b)(a); const M = a => a(a); const B = f => g => a => f(g(a)); const TH = a => b => b(a); const V = a => b => f => f(a)(b); const BL = f => g => a => b => f(g(a)(b)); const Y = x => (x(Y(x)));
Stack-machines for Birdwatchers
Operation | Bird | Construction | Result |
---|---|---|---|
Pop | Kite | K(WK) | yz |
Nip | Kestrel | K | xz |
Swap | Thrush | C(WK) | yxz |
Rot | Vireo | BCT | zxy |
Dup | Mockingbird | W(WK) | xxyz |
Over | Warbling Cardinal? | WC | xyxz |
- A universal formal system
- Assembly Implementation
- A Combinatory Compiler
- Combinators and Church Encoding
- SKI Stack Machine
- Javascript REPL
- The Theory of Concatenative Combinators
incoming church encoding