From 8c5cca122817bc63f4f84cc8351ced3cb67e5eea Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 29 Nov 2017 04:51:04 -0400 Subject: - Changed the identifier separator, from the semi-colon (;) to the period/dot (.). --- stdlib/source/lux/type/unit.lux | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'stdlib/source/lux/type/unit.lux') 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] @@ -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 )])))] - [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 - [numerator s;int - _ (p;assert (format "Numerator must be positive: " (%i numerator)) + (s.Syntax r.Ratio) + (s.tuple (do p.Monad + [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 [ ] @@ -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)) -- cgit v1.2.3