diff options
Diffstat (limited to 'stdlib/source/lux/math.lux')
-rw-r--r-- | stdlib/source/lux/math.lux | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index 4f4270c74..c8cfe89df 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -1,4 +1,4 @@ -(;module: {#;doc "Common mathematical constants and functions."} +(.module: {#.doc "Common mathematical constants and functions."} lux (lux (control monad ["p" parser "p/" Functor<Parser>]) @@ -11,7 +11,7 @@ ## [Values] (do-template [<name> <value> <doc>] [(def: #export <name> - {#;doc <doc>} + {#.doc <doc>} Frac <value>)] @@ -75,14 +75,14 @@ (pow 2.0 catB)))) (def: #export (gcd a b) - {#;doc "Greatest Common Divisor."} + {#.doc "Greatest Common Divisor."} (-> Nat Nat Nat) (case b +0 a _ (gcd b (n/% b a)))) (def: #export (lcm x y) - {#;doc "Least Common Multiple."} + {#.doc "Least Common Multiple."} (-> Nat Nat Nat) (case [x y] (^or [_ +0] [+0 _]) @@ -101,37 +101,37 @@ (def: infix^ (Syntax Infix) - (<| p;rec (function [infix^]) - ($_ p;alt - ($_ p;either - (p/map code;bool s;bool) - (p/map code;nat s;nat) - (p/map code;int s;int) - (p/map code;deg s;deg) - (p/map code;frac s;frac) - (p/map code;text s;text) - (p/map code;symbol s;symbol) - (p/map code;tag s;tag)) - (s;form (p;many s;any)) - (s;tuple (p;seq s;any infix^)) - (s;tuple ($_ p;either - (do p;Monad<Parser> - [_ (s;this (' #and)) + (<| p.rec (function [infix^]) + ($_ p.alt + ($_ p.either + (p/map code.bool s.bool) + (p/map code.nat s.nat) + (p/map code.int s.int) + (p/map code.deg s.deg) + (p/map code.frac s.frac) + (p/map code.text s.text) + (p/map code.symbol s.symbol) + (p/map code.tag s.tag)) + (s.form (p.many s.any)) + (s.tuple (p.seq s.any infix^)) + (s.tuple ($_ p.either + (do p.Monad<Parser> + [_ (s.this (' #and)) init-subject infix^ - init-op s;any + init-op s.any init-param infix^ - steps (p;some (p;seq s;any infix^))] - (wrap (product;right (L/fold (function [[op param] [subject [_subject _op _param]]] + steps (p.some (p.seq s.any infix^))] + (wrap (product.right (L/fold (function [[op param] [subject [_subject _op _param]]] [param [(#Binary _subject _op _param) (` and) (#Binary subject op param)]]) [init-param [init-subject init-op init-param]] steps)))) - (do p;Monad<Parser> + (do p.Monad<Parser> [init-subject infix^ - init-op s;any + init-op s.any init-param infix^ - steps (p;some (p;seq s;any infix^))] + steps (p.some (p.seq s.any infix^))] (wrap (L/fold (function [[op param] [_subject _op _param]] [(#Binary _subject _op _param) op param]) [init-subject init-op init-param] @@ -146,7 +146,7 @@ value (#Call parts) - (code;form parts) + (code.form parts) (#Unary op subject) (` ((~ op) (~ (infix-to-prefix subject)))) @@ -156,7 +156,7 @@ )) (syntax: #export (infix [expr infix^]) - {#;doc (doc "Infix math syntax." + {#.doc (doc "Infix math syntax." (infix [x i/* 10]) (infix [[x i/+ y] i/* [x i/- y]]) (infix [sin [x i/+ y]]) |