Bonus point
You can map lambda functions to digits (as opposed to integers), which will speed up arithmetic immensely. Here is an example that implements base-16 arithmetic (it functions kind of like an odometer). Numbers are cons-lists of digits, least significant first. You can use a (much more verbose) base-256 version to map to byte values. I'm only providing support for adding. The other operations are left as an exercise for the reader.
It's handy if your LC interpreter / compiler maintains function identity like mine does (mine uses closures by default, which helps with this). The UI prints function names for known functions when "pretty" is checked.
You can compile and run this in my evaluator (I'll fix the SSL certificate soon) http://lambdamechanics.com/lcPresentation/evaluator.html by saving the source to a file, clicking "Choose File", and then clicking "Run" on example ex3, ex4, and/or ex5. Sorry for the rough UI, I haven't worked on this for quite a while.
Source:
```
add hex numbers represented as lists of hex digits, least significant first
booleans
t = λa b . a f = λa b . b and = λa b . a b f or = λa b . a t b
Y combinator
Y = λg . (λx . g (x x)) λx . g (x x)
use recursion
rec = λf . f (Y f)
lists -- the evaluator pretty prints lists if these defs are present
cons = λa b . λfun . fun a b head = λl . l λa b . a tail = λl . l λa b . b nil = λa b . 268
b null = λl . l (λa b D . f) t append = rec λappend l1 l2 . l1 (λh t D . cons h (append t l2)) l2 reverse = λl . rec (λrev l res . l (λh t D . rev t (cons h res)) res) l nil
hex digits. A number is a list of digits in least-significant-first order
0 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d0 1 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d1 2 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d2 3 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d3 4 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d4 5 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d5 6 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d6 7 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d7 8 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d8 9 = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . d9 A = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . dA B = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . dB C = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . dC D = λd0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF . 268