aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/collection/row.lux
diff options
context:
space:
mode:
authorEduardo Julian2018-07-13 20:17:21 -0400
committerEduardo Julian2018-07-13 20:17:21 -0400
commit6acf4ffc362c0f8ef77d96f8cfe991adb2d9a0eb (patch)
tree9346abfd3cca6e7ea9a97be4ba76a26e6d8b5c4f /stdlib/source/lux/data/collection/row.lux
parente8f99539a71febaca6013d72d30f6afc33059b4e (diff)
- Re-named "lux/data/bit" to "lux/data/number/i64".
Diffstat (limited to 'stdlib/source/lux/data/collection/row.lux')
-rw-r--r--stdlib/source/lux/data/collection/row.lux23
1 files changed, 12 insertions, 11 deletions
diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux
index 1dce1d4c5..3b3b080eb 100644
--- a/stdlib/source/lux/data/collection/row.lux
+++ b/stdlib/source/lux/data/collection/row.lux
@@ -10,8 +10,9 @@
["p" parser]]
[data
[maybe]
- [bit]
[product]
+ [number
+ [i64]]
[collection
[list ("list/" Fold<List> Functor<List> Monoid<List>)]
[array ("array/" Functor<Array> Fold<Array>)]]]
@@ -51,7 +52,7 @@
(def: full-node-size
Nat
- (bit.left-shift branching-exponent +1))
+ (i64.left-shift branching-exponent +1))
(def: branch-idx-mask
Nat
@@ -59,7 +60,7 @@
(def: branch-idx
(-> Index Index)
- (bit.and branch-idx-mask))
+ (i64.and branch-idx-mask))
(def: (new-hierarchy _)
(All [a] (-> Any (Hierarchy a)))
@@ -70,8 +71,8 @@
(if (n/< full-node-size vec-size)
+0
(|> (dec vec-size)
- (bit.logical-right-shift branching-exponent)
- (bit.left-shift branching-exponent))))
+ (i64.logical-right-shift branching-exponent)
+ (i64.left-shift branching-exponent))))
(def: (new-path level tail)
(All [a] (-> Level (Base a) (Node a)))
@@ -88,7 +89,7 @@
(def: (push-tail size level tail parent)
(All [a] (-> Nat Level (Base a) (Hierarchy a) (Hierarchy a)))
- (let [sub-idx (branch-idx (bit.logical-right-shift level (dec size)))
+ (let [sub-idx (branch-idx (i64.logical-right-shift level (dec size)))
## If we're currently on a bottom node
sub-node (if (n/= branching-exponent level)
## Just add the tail to it
@@ -117,7 +118,7 @@
(def: (put' level idx val hierarchy)
(All [a] (-> Level Index a (Hierarchy a) (Hierarchy a)))
- (let [sub-idx (branch-idx (bit.logical-right-shift level idx))]
+ (let [sub-idx (branch-idx (i64.logical-right-shift level idx))]
(case (array.read sub-idx hierarchy)
(#.Some (#Hierarchy sub-node))
(|> (array.clone hierarchy)
@@ -135,7 +136,7 @@
(def: (pop-tail size level hierarchy)
(All [a] (-> Nat Level (Hierarchy a) (Maybe (Hierarchy a))))
- (let [sub-idx (branch-idx (bit.logical-right-shift level (n/- +2 size)))]
+ (let [sub-idx (branch-idx (i64.logical-right-shift level (n/- +2 size)))]
(cond (n/= +0 sub-idx)
#.None
@@ -202,8 +203,8 @@
## Otherwise, push tail into the tree
## --------------------------------------------------------
## Will the root experience an overflow with this addition?
- (|> (if (n/> (bit.left-shift (get@ #level vec) +1)
- (bit.logical-right-shift branching-exponent vec-size))
+ (|> (if (n/> (i64.left-shift (get@ #level vec) +1)
+ (i64.logical-right-shift branching-exponent vec-size))
## If so, a brand-new root must be established, that is
## 1-level taller.
(|> vec
@@ -233,7 +234,7 @@
(loop [level (get@ #level vec)
hierarchy (get@ #root vec)]
(case [(n/> branching-exponent level)
- (array.read (branch-idx (bit.logical-right-shift level idx)) hierarchy)]
+ (array.read (branch-idx (i64.logical-right-shift level idx)) hierarchy)]
[true (#.Some (#Hierarchy sub))]
(recur (level-down level) sub)