From 1013353c0d1e7517faa3a9c42751a11075fbc87a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 9 May 2017 19:16:50 -0400 Subject: - Made a small refactoring to walk around a current optimization error that confounds variables and makes you access the wrong value at run-time. - TODO: Fix said error. --- stdlib/source/lux/data/coll/tree/finger.lux | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'stdlib/source') diff --git a/stdlib/source/lux/data/coll/tree/finger.lux b/stdlib/source/lux/data/coll/tree/finger.lux index e338b551e..ba66abcff 100644 --- a/stdlib/source/lux/data/coll/tree/finger.lux +++ b/stdlib/source/lux/data/coll/tree/finger.lux @@ -1,6 +1,6 @@ (;module: lux - (lux (control monoid) + (lux (control ["m" monoid]) (data text/format))) (type: #export (Node m a) @@ -8,7 +8,7 @@ (#Branch m (Node m a) (Node m a))) (type: #export (Fingers m a) - {#monoid (Monoid m) + {#monoid (m;Monoid m) #tree (Node m a)}) (def: #export (tag fingers) @@ -36,18 +36,17 @@ (def: #export (search pred fingers) (All [m a] (-> (-> m Bool) (Fingers m a) (Maybe a))) - (if (pred (tag fingers)) - (let [(^open "tag/") (get@ #monoid fingers)] - (loop [_tag tag/unit + (let [tag/append (get@ [#monoid #m;append] fingers)] + (if (pred (tag fingers)) + (loop [_tag (get@ [#monoid #m;unit] fingers) _node (get@ #tree fingers)] (case _node (#Leaf _ value) (#;Some value) (#Branch _ left right) - (let [shifted-tag (tag/append _tag - (tag (set@ #tree left fingers)))] + (let [shifted-tag (tag/append _tag (tag (set@ #tree left fingers)))] (if (pred shifted-tag) (recur _tag left) - (recur shifted-tag right)))))) - #;None)) + (recur shifted-tag right))))) + #;None))) -- cgit v1.2.3