diff options
author | Eduardo Julian | 2021-07-30 01:12:05 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-07-30 01:12:05 -0400 |
commit | 9f039e8a0a09e0278547d697efa018cd3fd68672 (patch) | |
tree | 0b2298edfae39efa7195fc5152d267cc25dd7fc1 /stdlib/source/library/lux/data/collection/tree.lux | |
parent | 54b28c1caeda08965c258411a32229be1766d47f (diff) |
More renamings.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/collection/tree.lux | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux index 7a14946c5..23a957fb7 100644 --- a/stdlib/source/library/lux/data/collection/tree.lux +++ b/stdlib/source/library/lux/data/collection/tree.lux @@ -17,14 +17,16 @@ ["." code]]]]) (type: #export (Tree a) + {#.doc (doc "A generic tree data-structure.")} {#value a #children (List (Tree a))}) -(def: #export (flatten tree) +(def: #export (flat tree) + {#.doc (doc "All the leaf values of the tree, in order.")} (All [a] (-> (Tree a) (List a))) (|> tree (get@ #children) - (list\map flatten) + (list\map flat) list\join (#.Item (get@ #value tree)))) @@ -49,16 +51,16 @@ <>.rec <>.some <code>.record - (<>.default (list)) + (<>.else (list)) (<>.and <code>.any))) (syntax: #export (tree {root tree^}) {#.doc (doc "Tree literals." (: (Tree Nat) - (tree 10 - {20 {} - 30 {} - 40 {}})))} + (tree 12 + {34 {} + 56 {} + 78 {90 {}}})))} (in (list (` (~ (loop [[value children] root] (` {#value (~ value) #children (list (~+ (list\map recur children)))}))))))) |