---
# System prepended metadata

title: Lambda Calculus

---

# Lambda Calculus

## Boolean logic
```
TRUE  := λt. λf. t
FALSE := λt. λf. f
IF_THEN_ELSE := λl. λm. λn. l m n

OR  := λl. λr. l l r
AND := λl. λr. l r l

IS_ZERO := λn. n (λx. FALSE) TRUE
LEQ     := λm. λn. IS_ZERO (SUB m n)
```

## Arithmetic

```
c_0 := λs. λz. z
c_1 := λs. λz. s z
c_2 := λs. λz. s (s z)

SUCC := λn. λs. λz. s (n s z)
PLUS := λm. λn. λs. λz. m s (n s z)
PRED := λn. λf. λx. n (λg. λh. h (g f)) (λu. x) (λu. u)
SUB  := λm. λn. n PRED m
mult := λm. λn. m (PLUS n) c0
POW  := λm. λn. n m
```

## Data Structures

```
PAIR   := λx. λy. λf. f x y
FIRST  := λp. p TRUE
SECOND := λp. p FALSE
```



# Racket

- [Quick: An Introduction to Racket with Pictures](https://docs.racket-lang.org/quick/)

# Haskell

- [CodeWorld](https://code.world/haskell)
- [CodeWorld Docs](https://code.world/doc.html?shelf=help/haskell.shelf)


# Prolog

- [SWISH](https://swish.swi-prolog.org/)
- [SWISH Docs](https://www.swi-prolog.org/pldoc/man?section=builtin)
- 

```prolog
```

# Miscellaneous

True or false? Racket expressions are evaluated using call-by-value strategy.
??