-
Notifications
You must be signed in to change notification settings - Fork 0
/
cons.lambda
36 lines (35 loc) · 1.06 KB
/
cons.lambda
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
nil = false
cons = λx.λy.λf.f x y
car = λp.p true
cdr = λp.p false
null = λp.p (λh.λt.λx.false) true
nthcdr = λn.λl.(n cdr) l
nth = λn.λl.car (nthcdr l)
singleton = λe.(cons e nil)
caar = λl.car (car l)
cadr = λl.car (cdr l)
cdar = λl.cdr (car l)
cddr = λl.cdr (cdr l)
caaar = λl.car (car (car l))
caadr = λl.car (car (cdr l))
cadar = λl.car (cdr (car l))
caddr = λl.car (cdr (cdr l))
cdaar = λl.cdr (car (car l))
cddar = λl.cdr (cdr (car l))
cdddr = λl.cdr (cdr (cdr l))
caaaar = λl.car (car (car (car l)))
caaadr = λl.car (car (car (cdr l)))
caadar = λl.car (car (cdr (car l)))
caaddr = λl.car (car (cdr (cdr l)))
cadaar = λl.car (cdr (car (car l)))
cadadr = λl.car (cdr (car (cdr l)))
caddar = λl.car (cdr (cdr (car l)))
cadddr = λl.car (cdr (cdr (cdr l)))
cdaaar = λl.cdr (car (car (car l)))
cdaadr = λl.cdr (car (car (cdr l)))
cdadar = λl.cdr (car (cdr (car l)))
cdaddr = λl.cdr (car (cdr (cdr l)))
cddaar = λl.cdr (cdr (car (car l)))
cddadr = λl.cdr (cdr (car (cdr l)))
cdddar = λl.cdr (cdr (cdr (car l)))
cddddr = λl.cdr (cdr (cdr (cdr l)))