blob: 037ac41ae5bb4371952978a850e9cc4c01ddae8a (
plain) (
blame)
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
|
true [[[0]]]
maybe [[[1]]]
false [[[2]]]
¬‣ [0 true maybe false]
:test (¬true) (false)
:test (¬maybe) (maybe)
:test (¬false) (true)
…⋀… [[1 (0 1 1 1) (0 0 0 1) (0 0 0 0)]]
:test (true ⋀ true) (true)
:test (true ⋀ maybe) (maybe)
:test (true ⋀ false) (false)
:test (maybe ⋀ true) (maybe)
:test (maybe ⋀ maybe) (maybe)
:test (maybe ⋀ false) (false)
:test (false ⋀ true) (false)
:test (false ⋀ maybe) (false)
:test (false ⋀ false) (false)
…⋁… [[1 (0 0 0 0) (0 1 0 0) (0 1 1 1)]]
:test (true ⋁ true) (true)
:test (true ⋁ maybe) (true)
:test (true ⋁ false) (true)
:test (maybe ⋁ true) (true)
:test (maybe ⋁ maybe) (maybe)
:test (maybe ⋁ false) (maybe)
:test (false ⋁ true) (true)
:test (false ⋁ maybe) (maybe)
:test (false ⋁ false) (false)
…⊃… [[1 (0 true 0 1) (0 true 1 1) (0 1 1 1)]]
:test (true ⊃ true) (true)
:test (true ⊃ maybe) (true)
:test (true ⊃ false) (true)
:test (maybe ⊃ true) (maybe)
:test (maybe ⊃ maybe) (maybe)
:test (maybe ⊃ false) (true)
:test (false ⊃ true) (false)
:test (false ⊃ maybe) (maybe)
:test (false ⊃ false) (true)
…≡… [[1 (0 true 0 1) (0 1 1 1) (0 0 0 0)]]
:test (true ≡ true) (true)
:test (true ≡ maybe) (maybe)
:test (true ≡ false) (false)
:test (maybe ≡ true) (maybe)
:test (maybe ≡ maybe) (maybe)
:test (maybe ≡ false) (maybe)
:test (false ≡ true) (false)
:test (false ≡ maybe) (maybe)
:test (false ≡ false) (true)
# --- result samples ---
:import std/List .
main [[inp <> "=" <> !res ++ "\n"] <++> (cross3 ops trits trits)]
!‣ [0 "false" "maybe" "true"]
…<>… [[1 ++ " " ++ 0]]
inp 0 [[~1 <> (0 [[!1 <> (0 [[!1]])]])]]
res ^(^0) ^(~0) ^(~(~0))
ops (…⋀… : "and") : ((…⋁… : "or") : ((…⊃… : "if") : {}(…≡… : "equiv")))
trits true : (maybe : {}false)
|