diff options
author | Eduardo Julian | 2017-11-29 04:51:04 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-29 04:51:04 -0400 |
commit | 8c5cca122817bc63f4f84cc8351ced3cb67e5eea (patch) | |
tree | 8803dd3ed59ddcc6b964354fd312ab9e62e12cd8 /stdlib/source/lux/type/unit.lux | |
parent | 1ef969c8ce0f1a83ffa8d26d779806190ac3eced (diff) |
- Changed the identifier separator, from the semi-colon (;) to the period/dot (.).
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/type/unit.lux | 76 |
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)) |