Jump to content

Functional coverage tree: Difference between revisions

m
Line 178:
<lang J>unrooted=: ([:;@(({.@[,(+}.)~)&.> [: +/\1,_1}.#@>) <@(_1,$:@}.);.1)^:(1<#)
parent=: unrooted level
parent_cover=: (] (1}.~.parent)}~ 1}. * %&( parent +//. ]) [)^:_</lang>
 
<code>unrooted</code> translates indentation information to a [[Tree_traversal#J:_Alternate_implementation|parent tree structure]]. However, the limitations of recursion require we distinguish the parent node from its children, so we use _1 to denote the parent node of the recursive intermediate result unrooted trees. (This works well with using arithmetic to adjust sub-tree indices based on the lengths of preceding sub-trees.)
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.