aboutsummaryrefslogtreecommitdiff
path: root/languages/b/bruijn/lambda-core.bruijn
blob: f537470eacded3a000eabfde2516886ced1ebafc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# -----
# LOGIC
# -----

true [[1]]

false [[0]]

¬‣ [[[2 0 1]]]

:test (¬true) (false)
:test (¬false) (true)

…⋀… [[0 1 0]]

:test (true ⋀ true) (true)
:test (true ⋀ false) (false)
:test (false ⋀ true) (false)
:test (false ⋀ false) (false)

…⋁… [0 0]

:test (true ⋁ true) (true)
:test (true ⋁ false) (true)
:test (false ⋁ true) (true)
:test (false ⋁ false) (false)

# ------
# CHURCH
# ------

zero [[0]]

++‣ [[[1 (2 1 0)]]]

:test (++(++zero)) ([[1 (1 0)]])

--‣ [[[[0 [0]] (2 [[0 (1 3)]] [1])]]]

:test (--(++zero)) (zero)
:test (--[[1 (1 0)]]) ([[1 0]])
:test (--[[1 (1 (1 0))]]) ([[1 (1 0)]])

# aside from tests: empty program
main [[0]]