aboutsummaryrefslogtreecommitdiff
path: root/semestr-2/racket/lista5/props.rkt
blob: 204b108706f0a216492c5d588ca094e46d6518d1 (plain)
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
#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))