Jump to content

Functional coverage tree: Difference between revisions

m
J: add some minor explanations
m (→‎{{header|Haskell}}: (minor functor law fusions))
m (J: add some minor explanations)
Line 589:
weight=: (+ 0=]) ,".wspec
coverage=: ,".cspec</lang>
 
To understand this implementation, it's best to run it and inspect the data.
 
That said:
 
each of the above names is a column variable (with one value for each row in the dataset).
 
level has values 0, 1, 2, 3 or 4 (depending on depth of indent), and the calculation relies on each indent level using the same number of spaces. It might be smarter to use <code>level=: (i.~ ~.) (0 i.~' '&=)"1 hier</code> which only relies on consistent indentation at each level, but ultimately a general case implementation would have to enforce an indentation standard and that sort of mechanism is out of scope for this task.
 
weight fills in the blanks for weights (1 if not otherwise specified). This calculation is simplified because we do not have to worry about any explicitly 0 weights.
 
coverage fills in the blanks for coverage (0 if not otherwise specified).
 
Implementation (translation of leaf coverage to functional coverage):
Line 600 ⟶ 612:
 
Thus, <code>parent_cover</code> propagates coverage to parent nodes based on the weighted average of coverage at the children.
 
Since this is calculation heavy, and tacit code, if you want to see intermediate results, you should run <code>unrooted level</code> and/or <code>weight parent_cover coverage</code> under J's [[j:Vocabulary/Dissect|Dissect]] tool
 
Task example (format and show result):
6,962

edits

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