Visualize a tree: Difference between revisions

m
→‎{{header|jq}}: documentation
m (→‎{{header|jq}}: documentation)
Line 2,754:
</pre>
 
<lang jq># Input: aan stringarray representing a prefixtree
# Output: a stream of strings representing $tthe tree
# In this implementation, empty arrays in $tthe tree are simply ignored.
def printTree:
 
Line 2,763:
| sub("├─"; "| ") ;
 
# Input: a string prefix
def print($tree):
if $tree|type != "array" then . + ($tree|tostring)
2,492

edits