blob: d294286367e019cd675711f9508525c61a1d414f (
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
|
(.module:
[lux #*
[data
[text
["%" format]]]
[math
[number
["n" nat]]]])
(type: #export Version
Nat)
(def: range 100)
(def: level
(n.% ..range))
(def: current
(-> Nat Nat)
(|>>))
(def: next
(n./ ..range))
(def: #export patch
(-> Version Nat)
(|>> ..current ..level))
(def: #export minor
(-> Version Nat)
(|>> ..next ..level))
(def: #export major
(-> Version Nat)
(|>> ..next ..next ..level))
(def: separator ".")
(def: (padded value)
(-> Nat Text)
(if (n.< 10 value)
(%.format "0" (%.nat value))
(%.nat value)))
(def: #export (format version)
(%.Format Version)
(%.format (..padded (..major version))
..separator
(..padded (..minor version))
..separator
(..padded (..patch version))))
|