blob: 2faa761b344c51aabafc6f6440b4e722fff6d233 (
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
|
(.module:
[lux (#- false true or and not)
[data
[number
["." rev ("#@." interval)]]]])
(def: #export true Rev rev@top)
(def: #export false Rev rev@bottom)
(template [<name> <chooser>]
[(def: #export <name>
(-> Rev Rev Rev)
<chooser>)]
[and r/min]
[or r/max]
)
(def: #export (not input)
(-> Rev Rev)
(r/- input ..true))
(def: #export (implies consequent antecedent)
(-> Rev Rev Rev)
(or (not antecedent)
consequent))
(def: #export (includes sub super)
(-> Rev Rev Rev)
(let [-sub (not sub)
sum (r/+ -sub super)
no-overflow? (.and (r/>= -sub sum)
(r/>= super sum))]
(if no-overflow?
sum
..true)))
(def: #export (= left right)
(-> Rev Rev Rev)
(and (or (not left) right)
(or left (not right))))
|