|
2 | 2 | # Licensed under the MIT License. See LICENCE in the project root. |
3 | 3 | # ------------------------------------------------------------------ |
4 | 4 |
|
5 | | -#abstract type AtMostInf end # 0 |
6 | 5 |
|
7 | | -#multiplier_super = "Inf" |
8 | | -#magnitude_ = "" |
9 | | -#for magnitude in reverse(['n', 'u', 'm', ' ', 'K', 'M', 'G', 'T', 'P', 'E']) |
10 | | -# for multiplier in reverse([1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) |
11 | | -# magnitude_super = multiplier == 512 ? magnitude_ : magnitude |
12 | | -# code = "abstract type AtMost" * string(multiplier) * magnitude * " <: AtMost" * string(multiplier_super) * magnitude_super * " end" |
13 | | -# eval(Meta.parse(code)); println(code) |
14 | | -# multiplier_super = multiplier |
15 | | -# end |
16 | | -# magnitude_ = magnitude |
17 | | -#end |
18 | | -# |
19 | | -#abstract type AtMost0 <: AtMost1n end |
| 6 | +# automated declaration of at-most quantifier types |
| 7 | + |
| 8 | +abstract type AtMostInf end |
| 9 | + |
| 10 | +let mul_super = "Inf" , |
| 11 | + mag_ = "" ; |
| 12 | + for mag in reverse(["n", "u", "m", "", "K", "M", "G", "T", "P", "E"]) |
| 13 | + for mul in reverse([1, 2, 4, 8, 16, 32, 64, 128, 256, 512]) |
| 14 | + mag_super = mul==512 ? mag_ : mag |
| 15 | + nm1 = Symbol("AtMost" * string(mul) * mag) |
| 16 | + nm2 = Symbol("AtMost" * string(mul_super) * mag_super) |
| 17 | + @eval abstract type $nm1 <: $nm2 end |
| 18 | + mul_super = mul |
| 19 | + end |
| 20 | + mag_ = mag |
| 21 | + end |
| 22 | +end |
| 23 | + |
| 24 | +abstract type AtMost0 <: AtMost1n end |
20 | 25 |
|
21 | 26 |
|
22 | | -# abstract quantities of resources (magnitude order) |
23 | 27 |
|
24 | | -abstract type AtMostInf end # ∞ |
25 | 28 |
|
26 | | -# ... |
| 29 | +#= |
| 30 | +
|
| 31 | +abstract type AtMostInf end # ∞ |
27 | 32 |
|
28 | 33 | abstract type AtMost512E <: AtMostInf end # 2^69 |
29 | 34 | abstract type AtMost256E <: AtMost512E end # 2^68 |
@@ -137,3 +142,6 @@ abstract type AtMost1n <: AtMost2n end # 2^-30 |
137 | 142 |
|
138 | 143 | abstract type AtMost0 <: AtMost1n end # 0 |
139 | 144 |
|
| 145 | +=# |
| 146 | + |
| 147 | + |
0 commit comments