aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/type/unit.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/type/unit.lux')
-rw-r--r--stdlib/source/lux/type/unit.lux76
1 files changed, 38 insertions, 38 deletions
diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux
index c124afdaa..262ccf9e4 100644
--- a/stdlib/source/lux/type/unit.lux
+++ b/stdlib/source/lux/type/unit.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux (control [monad #+ do Monad]
["p" parser "p/" Monad<Parser>]
@@ -22,7 +22,7 @@
scale)
(: (All [u] (-> (Qty (s u)) (Qty u)))
de-scale)
- (: r;Ratio
+ (: r.Ratio
ratio))
(type: #export Pure
@@ -61,54 +61,54 @@
(|>> (format "{" kind "@" module "}")
(let [[module kind] (ident-for <tag>)])))]
- [unit-name #;;Unit]
- [scale-name #;;Scale]
+ [unit-name #..Unit]
+ [scale-name #..Scale]
)
-(syntax: #export (unit: [export csr;export]
- [name s;local-symbol]
- [annotations (p;default cs;empty-annotations csr;annotations)])
- (wrap (list (` (type: (~@ (csw;export export)) (~ (code;local-symbol name))
- (~ (csw;annotations annotations))
- (primitive (~ (code;text (unit-name name))))))
- (` (def: (~@ (csw;export export)) (~ (code;local-symbol (format "@" name)))
- (~ (code;local-symbol name))
+(syntax: #export (unit: [export csr.export]
+ [name s.local-symbol]
+ [annotations (p.default cs.empty-annotations csr.annotations)])
+ (wrap (list (` (type: (~@ (csw.export export)) (~ (code.local-symbol name))
+ (~ (csw.annotations annotations))
+ (primitive (~ (code.text (unit-name name))))))
+ (` (def: (~@ (csw.export export)) (~ (code.local-symbol (format "@" name)))
+ (~ (code.local-symbol name))
(:!! [])))
)))
(def: ratio^
- (s;Syntax r;Ratio)
- (s;tuple (do p;Monad<Parser>
- [numerator s;int
- _ (p;assert (format "Numerator must be positive: " (%i numerator))
+ (s.Syntax r.Ratio)
+ (s.tuple (do p.Monad<Parser>
+ [numerator s.int
+ _ (p.assert (format "Numerator must be positive: " (%i numerator))
(i/> 0 numerator))
- denominator s;int
- _ (p;assert (format "Denominator must be positive: " (%i denominator))
+ denominator s.int
+ _ (p.assert (format "Denominator must be positive: " (%i denominator))
(i/> 0 denominator))]
(wrap [(int-to-nat numerator) (int-to-nat denominator)]))))
-(syntax: #export (scale: [export csr;export]
- [name s;local-symbol]
- [(^slots [#r;numerator #r;denominator]) ratio^]
- [annotations (p;default cs;empty-annotations csr;annotations)])
- (let [g!scale (code;local-symbol name)]
- (wrap (list (` (type: (~@ (csw;export export)) ((~ g!scale) (~' u))
- (~ (csw;annotations annotations))
- (primitive (~ (code;text (scale-name name))) [(~' u)])))
- (` (struct: (~@ (csw;export export)) (~ (code;local-symbol (format "@" name)))
- (;;Scale (~ g!scale))
+(syntax: #export (scale: [export csr.export]
+ [name s.local-symbol]
+ [(^slots [#r.numerator #r.denominator]) ratio^]
+ [annotations (p.default cs.empty-annotations csr.annotations)])
+ (let [g!scale (code.local-symbol name)]
+ (wrap (list (` (type: (~@ (csw.export export)) ((~ g!scale) (~' u))
+ (~ (csw.annotations annotations))
+ (primitive (~ (code.text (scale-name name))) [(~' u)])))
+ (` (struct: (~@ (csw.export export)) (~ (code.local-symbol (format "@" name)))
+ (..Scale (~ g!scale))
(def: (~' scale)
- (|>> ;;out
- (i/* (~ (code;int (nat-to-int numerator))))
- (i// (~ (code;int (nat-to-int denominator))))
- (;;in (:! ((~ g!scale) ($ +0)) []))))
+ (|>> ..out
+ (i/* (~ (code.int (nat-to-int numerator))))
+ (i// (~ (code.int (nat-to-int denominator))))
+ (..in (:! ((~ g!scale) ($ +0)) []))))
(def: (~' de-scale)
- (|>> ;;out
- (i/* (~ (code;int (nat-to-int denominator))))
- (i// (~ (code;int (nat-to-int numerator))))
- (;;in (:! ($ +0) []))))
+ (|>> ..out
+ (i/* (~ (code.int (nat-to-int denominator))))
+ (i// (~ (code.int (nat-to-int numerator))))
+ (..in (:! ($ +0) []))))
(def: (~' ratio)
- [(~ (code;nat numerator)) (~ (code;nat denominator))])))
+ [(~ (code.nat numerator)) (~ (code.nat denominator))])))
))))
(do-template [<name> <op>]
@@ -137,7 +137,7 @@
(def: #export (re-scale from to quantity)
(All [si so u] (-> (Scale si) (Scale so) (Qty (si u)) (Qty (so u))))
- (let [[numerator denominator] (|> (:: to ratio) (r;r// (:: from ratio)))]
+ (let [[numerator denominator] (|> (:: to ratio) (r.r// (:: from ratio)))]
(|> quantity out
(i/* (nat-to-int numerator))
(i// (nat-to-int denominator))