aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/text.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/text.lux21
1 files changed, 11 insertions, 10 deletions
diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux
index 8a4b8a02a..dce88022b 100644
--- a/stdlib/source/lux/data/text.lux
+++ b/stdlib/source/lux/data/text.lux
@@ -11,7 +11,8 @@
[data
["." maybe]
[number
- ["." i64]]
+ ["." i64]
+ ["n" nat]]
[collection
["." list ("#@." fold)]]]])
@@ -44,7 +45,7 @@
(def: #export (nth idx input)
(-> Nat Text (Maybe Char))
- (if (n/< ("lux text size" input) idx)
+ (if (n.< ("lux text size" input) idx)
(#.Some ("lux text char" idx input))
#.None))
@@ -96,8 +97,8 @@
(-> Text Text Bit)
(case (last-index-of postfix x)
(#.Some n)
- (n/= (size x)
- (n/+ (size postfix) n))
+ (n.= (size x)
+ (n.+ (size postfix) n))
_
false))
@@ -113,15 +114,15 @@
(def: #export (clip from to input)
(-> Nat Nat Text (Maybe Text))
- (if (and (n/<= to from)
- (n/<= ("lux text size" input) to))
+ (if (and (n.<= to from)
+ (n.<= ("lux text size" input) to))
(#.Some ("lux text clip" from to input))
#.None))
(def: #export (clip' from input)
(-> Nat Text (Maybe Text))
(let [size ("lux text size" input)]
- (if (n/<= size from)
+ (if (n.<= size from)
(#.Some ("lux text clip" from size input))
#.None)))
@@ -206,12 +207,12 @@
(let [length ("lux text size" input)]
(loop [idx 0
hash 0]
- (if (n/< length idx)
+ (if (n.< length idx)
(recur (inc idx)
(|> hash
(i64.left-shift 5)
- (n/- hash)
- (n/+ ("lux text char" idx input))))
+ (n.- hash)
+ (n.+ ("lux text char" idx input))))
hash)))))))
(def: #export concat