aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2018-07-28 15:51:48 -0400
committerEduardo Julian2018-07-28 15:51:48 -0400
commit168d36d07b48d2d936de24aa69b8464e68992075 (patch)
tree522a5ef5077eb4cf10e083a9feec042476626f7b /stdlib
parent395f3bf37ab370c985bd253ee32ea242d2ebedad (diff)
Covered some missing bits.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/lux.lux2
-rw-r--r--stdlib/source/lux/compiler/default/syntax.lux14
-rw-r--r--stdlib/source/lux/data/collection/list.lux2
-rw-r--r--stdlib/test/test/lux/data/number.lux6
4 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 109a590e3..34ceb43ba 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -2560,7 +2560,7 @@
(let' [loop ("lux check" (-> Nat Text Text)
(function' recur [input output]
(if (n/= 0 input)
- (text/compose "|" output)
+ output
(recur (n// 10 input)
(text/compose (|> input (n/% 10) digit-to-text)
output)))))]
diff --git a/stdlib/source/lux/compiler/default/syntax.lux b/stdlib/source/lux/compiler/default/syntax.lux
index 0497f55a2..5b20dcff5 100644
--- a/stdlib/source/lux/compiler/default/syntax.lux
+++ b/stdlib/source/lux/compiler/default/syntax.lux
@@ -184,7 +184,7 @@
"u"
(do p.Monad<Parser>
[code (l.between 1 4 l.hexadecimal)]
- (wrap (case (|> code (format "+") (:: number.Hex@Codec<Text,Nat> decode))
+ (wrap (case (:: number.Hex@Codec<Text,Nat> decode code)
(#.Right value)
[(n/+ 2 (text.size code)) (text.from-code value)]
@@ -207,6 +207,8 @@
(l.and l.decimal
(l.some rich-digit)))
+(def: sign^ (l.one-of "+-"))
+
(do-template [<name> <tag> <lexer> <codec>]
[(def: #export (<name> where)
(-> Cursor (l.Lexer [Cursor Code]))
@@ -221,8 +223,7 @@
[where (<tag> value)]]))))]
[int #.Int
- (l.and (p.default "" (l.one-of "-"))
- rich-digits^)
+ (l.and sign^ rich-digits^)
number.Codec<Text,Int>]
[rev #.Rev
@@ -259,8 +260,7 @@
(def: (normal-nat where)
(-> Cursor (l.Lexer [Cursor Code]))
(do p.Monad<Parser>
- [chunk (l.and (l.one-of "+")
- rich-digits^)]
+ [chunk rich-digits^]
(case (:: number.Codec<Text,Nat> decode chunk)
(#.Left error)
(p.fail error)
@@ -278,14 +278,14 @@
(-> Cursor (l.Lexer [Cursor Code]))
(do p.Monad<Parser>
[chunk ($_ l.and
- (p.default "" (l.one-of "-"))
+ sign^
rich-digits^
(l.one-of ".")
rich-digits^
(p.default ""
($_ l.and
(l.one-of "eE")
- (p.default "" (l.one-of "+-"))
+ sign^
rich-digits^)))]
(case (:: number.Codec<Text,Frac> decode chunk)
(#.Left error)
diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux
index 09328def9..bbc649fb9 100644
--- a/stdlib/source/lux/data/collection/list.lux
+++ b/stdlib/source/lux/data/collection/list.lux
@@ -403,7 +403,7 @@
output' ("lux text concat" digit output)
input' (n// 10 input)]
(if (n/= 0 input')
- ("lux text concat" "+" output')
+ output'
(recur input' output')))))
(macro: #export (zip tokens state)
diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux
index 36bc9a3f9..b5cf8e414 100644
--- a/stdlib/test/test/lux/data/number.lux
+++ b/stdlib/test/test/lux/data/number.lux
@@ -179,7 +179,7 @@
(r/= (oct ".615243") (oct ".615_243"))
(f/= (oct "+6152.43") (oct "+615_2.43"))))
(test "Hexadecimal."
- (and (n/= (hex "|deadBEEF") (hex "|dead_BEEF"))
- (i/= (hex "deadBEEF") (hex "dead_BEEF"))
+ (and (n/= (hex "deadBEEF") (hex "dead_BEEF"))
+ (i/= (hex "+deadBEEF") (hex "+dead_BEEF"))
(r/= (hex ".deadBEEF") (hex ".dead_BEEF"))
- (f/= (hex "deadBE.EF") (hex "dead_BE.EF"))))))
+ (f/= (hex "+deadBE.EF") (hex "+dead_BE.EF"))))))