aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/math/modular.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/math/modular.lux')
-rw-r--r--stdlib/source/lux/math/modular.lux23
1 files changed, 11 insertions, 12 deletions
diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux
index 313255d82..2d2c6dee7 100644
--- a/stdlib/source/lux/math/modular.lux
+++ b/stdlib/source/lux/math/modular.lux
@@ -8,8 +8,8 @@
[data
["." error (#+ Error)]
[number
- ["." int ("#;." decimal)]]
- ["." text ("#;." monoid)
+ ["." int ("#@." decimal)]]
+ ["." text ("#@." monoid)
["l" lexer (#+ Lexer)]]]
[type
abstract]
@@ -38,13 +38,13 @@
(exception: #export [m] (incorrect-modulus {modulus (Modulus m)}
{parsed Int})
- (ex.report ["Expected" (int;encode (to-int modulus))]
- ["Actual" (int;encode parsed)]))
+ (ex.report ["Expected" (int@encode (to-int modulus))]
+ ["Actual" (int@encode parsed)]))
(exception: #export [rm sm] (cannot-equalize-moduli {reference (Modulus rm)}
{sample (Modulus sm)})
- (ex.report ["Reference" (int;encode (to-int reference))]
- ["Sample" (int;encode (to-int sample))]))
+ (ex.report ["Reference" (int@encode (to-int reference))]
+ ["Sample" (int@encode (to-int sample))]))
(def: #export (congruent? modulus reference sample)
(All [m] (-> (Modulus m) Int Int Bit))
@@ -64,8 +64,7 @@
(def: intL
(Lexer Int)
(p.codec int.decimal
- (p.either (l.and (l.one-of "-") (l.many l.decimal))
- (l.many l.decimal))))
+ (l.and (l.one-of "-+") (l.many l.decimal))))
(abstract: #export (Mod m)
{#.doc "A number under a modulus."}
@@ -83,17 +82,17 @@
(All [m] (-> (Mod m) [Int (Modulus m)]))
(:representation modular))
- (def: separator Text " mod ")
+ (def: separator " mod ")
(structure: #export (codec modulus)
(All [m] (-> (Modulus m) (Codec Text (Mod m))))
(def: (encode modular)
(let [[remainder modulus] (:representation modular)]
- ($_ text;compose
- (int;encode remainder)
+ ($_ text@compose
+ (int@encode remainder)
separator
- (int;encode (to-int modulus)))))
+ (int@encode (to-int modulus)))))
(def: (decode text)
(<| (l.run text)