aboutsummaryrefslogtreecommitdiff
path: root/semestr-2/racket/lista5/props.rkt
diff options
context:
space:
mode:
Diffstat (limited to 'semestr-2/racket/lista5/props.rkt')
-rw-r--r--semestr-2/racket/lista5/props.rkt52
1 files changed, 52 insertions, 0 deletions
diff --git a/semestr-2/racket/lista5/props.rkt b/semestr-2/racket/lista5/props.rkt
new file mode 100644
index 0000000..204b108
--- /dev/null
+++ b/semestr-2/racket/lista5/props.rkt
@@ -0,0 +1,52 @@
+#lang racket
+
+(provide conj conj-left conj-right conj?
+ disj disj-left disj-right disj?
+ neg neg-subf neg?
+ var?)
+
+
+(define (conj p q)
+ (list 'conj p q))
+
+(define (conj-left f)
+ (second f))
+
+(define (conj-right f)
+ (third f))
+
+(define (conj? t)
+ (and (list? t)
+ (= 3 (length t))
+ (eq? 'conj (car t))))
+
+
+(define (disj p q)
+ (list 'disj p q))
+
+(define (disj-left f)
+ (second f))
+
+(define (disj-right f)
+ (third f))
+
+(define (disj? t)
+ (and (list? t)
+ (= 3 (length t))
+ (eq? 'disj (car t))))
+
+
+(define (neg x)
+ (list 'neg x))
+
+(define (neg-subf x)
+ (second x))
+
+(define (neg? t)
+ (and (list? t)
+ (= 2 (length t))
+ (eq? 'neg (car t))))
+
+
+(define (var? t)
+ (symbol? t))