diff options
author | Eduardo Julian | 2018-05-01 22:13:07 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-05-01 22:13:07 -0400 |
commit | 9906f649d26adfed5126065082fb4a7d5e4696bb (patch) | |
tree | 1a0fa34a6fdb90479cc679580384321c58830a68 | |
parent | bdf674249b993b1135d59420033a92ba39278fea (diff) |
- Re-organized "lux/data/coll/tree/*" modules.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/coll/tree/rose/parser.lux (renamed from stdlib/source/lux/data/coll/tree/parser.lux) | 32 | ||||
-rw-r--r-- | stdlib/source/lux/data/coll/tree/rose/zipper.lux (renamed from stdlib/source/lux/data/coll/tree/zipper.lux) | 0 | ||||
-rw-r--r-- | stdlib/test/test/lux/data/coll/tree/rose/zipper.lux (renamed from stdlib/test/test/lux/data/coll/tree/zipper.lux) | 32 | ||||
-rw-r--r-- | stdlib/test/tests.lux | 6 |
4 files changed, 35 insertions, 35 deletions
diff --git a/stdlib/source/lux/data/coll/tree/parser.lux b/stdlib/source/lux/data/coll/tree/rose/parser.lux index e5881d097..bee1e07f9 100644 --- a/stdlib/source/lux/data/coll/tree/parser.lux +++ b/stdlib/source/lux/data/coll/tree/rose/parser.lux @@ -3,14 +3,14 @@ (lux (control ["p" parser] ["ex" exception #+ exception:]) (data ["E" error])) - (// ["T" rose] - ["Z" zipper])) + [// #+ Tree] + (// [zipper #+ Zipper])) (type: #export (Parser t a) - (p.Parser (Z.Zipper t) a)) + (p.Parser (Zipper t) a)) (def: #export (run-zipper zipper parser) - (All [t a] (-> (Z.Zipper t) (Parser t a) (E.Error a))) + (All [t a] (-> (Zipper t) (Parser t a) (E.Error a))) (case (p.run zipper parser) (#E.Success [zipper output]) (#E.Success output) @@ -19,13 +19,13 @@ (#E.Error error))) (def: #export (run tree parser) - (All [t a] (-> (T.Tree t) (Parser t a) (E.Error a))) - (run-zipper (Z.zip tree) parser)) + (All [t a] (-> (Tree t) (Parser t a) (E.Error a))) + (run-zipper (zipper.zip tree) parser)) (def: #export value (All [t] (Parser t t)) (function (_ zipper) - (#E.Success [zipper (Z.value zipper)]))) + (#E.Success [zipper (zipper.value zipper)]))) (exception: #export Cannot-Move-Further) @@ -38,13 +38,13 @@ (ex.throw Cannot-Move-Further []) (#E.Success [next []])))))] - [up Z.up] - [down Z.down] - [left Z.left] - [right Z.right] - [root Z.root] - [rightmost Z.rightmost] - [leftmost Z.leftmost] - [next Z.next] - [prev Z.prev] + [up zipper.up] + [down zipper.down] + [left zipper.left] + [right zipper.right] + [root zipper.root] + [rightmost zipper.rightmost] + [leftmost zipper.leftmost] + [next zipper.next] + [prev zipper.prev] ) diff --git a/stdlib/source/lux/data/coll/tree/zipper.lux b/stdlib/source/lux/data/coll/tree/rose/zipper.lux index 845dd4c4c..845dd4c4c 100644 --- a/stdlib/source/lux/data/coll/tree/zipper.lux +++ b/stdlib/source/lux/data/coll/tree/rose/zipper.lux diff --git a/stdlib/test/test/lux/data/coll/tree/zipper.lux b/stdlib/test/test/lux/data/coll/tree/rose/zipper.lux index 7b182a918..ff52e706d 100644 --- a/stdlib/test/test/lux/data/coll/tree/zipper.lux +++ b/stdlib/test/test/lux/data/coll/tree/rose/zipper.lux @@ -3,9 +3,9 @@ (lux [io] (control [monad #+ do Monad] pipe) - (data (coll [list "L/" Fold<List> Functor<List>] - (tree ["&" zipper] - [rose])) + (data (coll [list "list/" Fold<List> Functor<List>] + (tree [rose] + (rose ["&" zipper]))) [text] text/format [number] @@ -37,7 +37,7 @@ pre-val r.nat post-val r.nat #let [(^open "tree/") (rose.Eq<Tree> number.Eq<Nat>) - (^open "L/") (list.Eq<List> number.Eq<Nat>)]] + (^open "list/") (list.Eq<List> number.Eq<Nat>)]] ($_ seq (test "Trees can be converted to/from zippers." (|> sample @@ -98,20 +98,20 @@ (|> sample &.zip (&.set new-val) &.value (n/= new-val))) (test "Zipper traversal follows the outline of the tree depth-first." - (L/= (rose.flatten sample) - (loop [zipper (&.zip sample)] - (if (&.end? zipper) - (list (&.value zipper)) - (#.Cons (&.value zipper) - (recur (&.next zipper))))))) + (list/= (rose.flatten sample) + (loop [zipper (&.zip sample)] + (if (&.end? zipper) + (list (&.value zipper)) + (#.Cons (&.value zipper) + (recur (&.next zipper))))))) (test "Backwards zipper traversal yield reverse tree flatten." - (L/= (list.reverse (rose.flatten sample)) - (loop [zipper (to-end (&.zip sample))] - (if (&.root? zipper) - (list (&.value zipper)) - (#.Cons (&.value zipper) - (recur (&.prev zipper))))))) + (list/= (list.reverse (rose.flatten sample)) + (loop [zipper (to-end (&.zip sample))] + (if (&.root? zipper) + (list (&.value zipper)) + (#.Cons (&.value zipper) + (recur (&.prev zipper))))))) (test "Can remove nodes (except root nodes)." (let [zipper (&.zip sample)] diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux index a25d419bc..71317af18 100644 --- a/stdlib/test/tests.lux +++ b/stdlib/test/tests.lux @@ -53,8 +53,8 @@ ["_." set/ordered] ["_." queue] (queue ["_." priority]) - (tree ["tree_." rose] - ["tree_." zipper])) + (tree ["_." rose] + (rose ["_." zipper]))) (text ["_." format] ["_." lexer] ["_." regex])) @@ -90,7 +90,7 @@ (format [context] [html] [css]) - (coll (tree ["tree_." parser]))) + (coll (tree ["_." rose/parser]))) [macro] (macro (poly [json])) (type [unit] |