blob: 336ab6035d16086a693a31f8e2fa135747d16ac2 (
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
(.using
[library
[lux (.except Type for static has)
[abstract
["[0]" equivalence (.only Equivalence)]]
[control
["[0]" try (.only Try) (.open: "[1]#[0]" functor)]]
[data
[format
[binary (.only Writer)]]
[collection
["[0]" list (.open: "[1]#[0]" functor mix)]]]
[math
[number
["n" nat]]]
[type
[primitive (.except)]]]]
["[0]" /////
[encoding
["[1][0]" unsigned (.only U1 U2)]]
["[1][0]" type (.only Type)
[category (.only Method)]
["[1]/[0]" parser]]])
(type: .public Register
U1)
(def: normal 1)
(def: wide 2)
(primitive: .public Registry
U2
(def: .public registry
(-> U2 Registry)
(|>> abstraction))
(def: (minimal type)
(-> (Type Method) Nat)
(let [[type_variables inputs output exceptions] (/////type/parser.method type)]
(|> inputs
(list#each (function (_ input)
(if (or (same? /////type.long input)
(same? /////type.double input))
..wide
..normal)))
(list#mix n.+ 0))))
(template [<start> <name>]
[(def: .public <name>
(-> (Type Method) (Try Registry))
(|>> ..minimal
(n.+ <start>)
/////unsigned.u2
(try#each ..registry)))]
[0 static]
[1 virtual]
)
(def: .public equivalence
(Equivalence Registry)
(at equivalence.functor each
(|>> representation)
/////unsigned.equivalence))
(def: .public writer
(Writer Registry)
(|>> representation /////unsigned.writer/2))
(def: .public (has needed)
(-> Registry Registry Registry)
(|>> representation
(/////unsigned.max/2 (representation needed))
abstraction))
(template [<name> <extra>]
[(def: .public <name>
(-> Register Registry)
(let [extra (|> <extra> /////unsigned.u2 try.trusted)]
(|>> /////unsigned.lifted/2
(/////unsigned.+/2 extra)
try.trusted
abstraction)))]
[for ..normal]
[for_wide ..wide]
)
)
(def: .public length
/////unsigned.bytes/2)
|