Skip to content

Commit 32c5ab0

Browse files
author
Filippo Costa
committed
Minor adjustments
1 parent 323d94f commit 32c5ab0

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

lambda.lambda

+39-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,45 @@
1+
/** Style conventions
2+
* -----------------
3+
*
4+
* t ::=
5+
* - x
6+
* // Variable
7+
* - (x. t)
8+
* // Abstraction
9+
* - (t t)
10+
* // Application
11+
*/
12+
13+
114
// Combinators
2-
$ID: (x.x)
3-
$OMEGA: ((x.xx) (x.xx))
15+
ID: (x. x)
16+
CLONE: (x. x x)
17+
FORK-BOMB: (CLONE CLONE CLONE)
18+
19+
20+
// Algebraic data structures
21+
N-TUPLE: (x. ID x)
22+
23+
0-TUPLE: UNIT: ID
24+
1-TUPLE: (N-TUPLE 0-TUPLE)
25+
2-TUPLE: (N-TUPLE 1-TUPLE)
26+
3-TUPLE: (N-TUPLE 2-TUPLE)
427

5-
// Boolean values
6-
$TRUE: (t.f.t)
7-
$FALSE: (t.$ID)
828

9-
// Logical operators
10-
$AND: (b1.b2.(b1 b2 $FALSE))
11-
$OR: (b1.b2.(b1 $TRUE b2))
12-
$NOT: (b.(b $FALSE $TRUE))
13-
$XOR: (b1.b2.(b1 ($NOT b2) b2))
29+
// Boolean logic
30+
TRUE: (xy. x)
31+
FALSE: (xy. y)
32+
33+
BOOL-NOT: (p. p FALSE TRUE)
34+
BOOL-AND: (pq. p q FALSE)
35+
BOOL-OR: (pq. p TRUE q)
36+
BOOL-XOR: (pq. p (NOT q) q)
37+
38+
39+
// While
40+
FIXED-POINT-COMBINATOR: (f. (x. f (y. x x y)) (x. f (y. x x y)))
1441

1542
// Church numerals
1643
$ZERO: $FALSE
44+
$SUCCESSOR: (nsz. s (n s z))
45+

0 commit comments

Comments
 (0)