-
Notifications
You must be signed in to change notification settings - Fork 1
/
variables.rkt
57 lines (45 loc) · 1.29 KB
/
variables.rkt
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
#lang racket/base
;;;; This file has been changed from its original dharmatech/mpl version.
(provide variables)
(require (only-in srfi/1 lset-union)
"misc.rkt")
(define (union . lists)
(apply lset-union (cons equal? lists)))
(define (VAR-1 u)
(and (number? u) '()))
(define (VAR-2 u)
(and (power? u) ;; VAR-2
(let ((n (list-ref u 2)))
(and (integer? n)
(> n 1)))
(list (list-ref u 1))))
(define (VAR-3 u)
(and (sum? u)
(apply union
(map
(lambda (operand)
(or (VAR-1 operand)
(VAR-2 operand)
(VAR-4 operand)
(VAR-5 operand)))
(cdr u)))))
(define (VAR-4 u)
(and (product? u)
(apply union
(map
(lambda (operand)
(or (VAR-1 operand)
(VAR-2 operand)
(and (sum? operand) (list operand))
(VAR-5 operand)))
(cdr u)))))
(define (VAR-5 u)
(list u))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (variables u)
(or (VAR-1 u)
(VAR-2 u)
(VAR-3 u)
(VAR-4 u)
(VAR-5 u)))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;