-
Notifications
You must be signed in to change notification settings - Fork 2
/
rewrite-rules.lisp
92 lines (81 loc) · 2.65 KB
/
rewrite-rules.lisp
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
(in-package :modf)
(define-modf-rewrite funcall (expr)
(cons (cadadr expr) (cddr expr)))
(define-modf-rewrite caar (expr)
`(car (car ,(second expr))))
(define-modf-rewrite cadr (expr)
`(car (cdr ,(second expr))))
(define-modf-rewrite cdar (expr)
`(cdr (car ,(second expr))))
(define-modf-rewrite cddr (expr)
`(cdr (cdr ,(second expr))))
(define-modf-rewrite caaar (expr)
`(car (caar ,(second expr))))
(define-modf-rewrite caadr (expr)
`(car (cadr ,(second expr))))
(define-modf-rewrite cadar (expr)
`(car (cdar ,(second expr))))
(define-modf-rewrite cdaar (expr)
`(cdr (caar ,(second expr))))
(define-modf-rewrite caddr (expr)
`(car (cddr ,(second expr))))
(define-modf-rewrite cdadr (expr)
`(cdr (cadr ,(second expr))))
(define-modf-rewrite cddar (expr)
`(cdr (cdar ,(second expr))))
(define-modf-rewrite cdddr (expr)
`(cdr (cddr ,(second expr))))
(define-modf-rewrite caaaar (expr)
`(car (caaar ,(second expr))))
(define-modf-rewrite caaadr (expr)
`(car (caadr ,(second expr))))
(define-modf-rewrite caadar (expr)
`(car (cadar ,(second expr))))
(define-modf-rewrite cadaar (expr)
`(car (cdaar ,(second expr))))
(define-modf-rewrite cdaaar (expr)
`(cdr (caaar ,(second expr))))
(define-modf-rewrite caaddr (expr)
`(car (caddr ,(second expr))))
(define-modf-rewrite cadadr (expr)
`(car (cdadr ,(second expr))))
(define-modf-rewrite cdaadr (expr)
`(cdr (caadr ,(second expr))))
(define-modf-rewrite caddar (expr)
`(car (cddar ,(second expr))))
(define-modf-rewrite cdadar (expr)
`(cdr (cadar ,(second expr))))
(define-modf-rewrite cddaar (expr)
`(cdr (cdaar ,(second expr))))
(define-modf-rewrite cdddar (expr)
`(cdr (cddar ,(second expr))))
(define-modf-rewrite cddadr (expr)
`(cdr (cdadr ,(second expr))))
(define-modf-rewrite cdaddr (expr)
`(cdr (caddr ,(second expr))))
(define-modf-rewrite cadddr (expr)
`(car (cdddr ,(second expr))))
(define-modf-rewrite cddddr (expr)
`(cdr (cdddr ,(second expr))))
(define-modf-rewrite first (expr)
`(car ,(second expr)))
(define-modf-rewrite second (expr)
`(cadr ,(second expr)))
(define-modf-rewrite third (expr)
`(caddr ,(second expr)))
(define-modf-rewrite fourth (expr)
`(cadddr ,(second expr)))
(define-modf-rewrite fifth (expr)
`(car (cddddr ,(second expr))))
(define-modf-rewrite sixth (expr)
`(cadr (cddddr ,(second expr))))
(define-modf-rewrite seventh (expr)
`(caddr (cddddr ,(second expr))))
(define-modf-rewrite eighth (expr)
`(cadddr (cddddr ,(second expr))))
(define-modf-rewrite ninth (expr)
`(car (cddddr (cddddr ,(second expr)))))
(define-modf-rewrite tenth (expr)
`(cadr (cddddr (cddddr ,(second expr)))))
(define-modf-rewrite rest (expr)
`(cdr ,(second expr)))