Anonymous user
Decision tables: Difference between revisions
m
→{{header|J}}: tweak 2nd example, add comment on impl
(+J) |
m (→{{header|J}}: tweak 2nd example, add comment on impl) |
||
Line 49:
N
Solution unknown.
=== Comments ===
Line 56:
Here, we create an array with as many axes (dimensions) as there are rules (questions), plus one. All axes, except the last, have 2 values (to wit: true & false). The last axis contains a boolean vector indicating which actions to try (or not). Thus, J's multidimensional array is leveraged as a tree, and the user's answers provide a path to a leaf (which is accessed arraywise, i.e. all at once).
For large numbers of rules and few actions, J's native support of sparse arrays might provide a performance advantage, particularly in space. A minor note about the implementation here: the verb (function) <tt>troubleshoot</tt> is generalized, and reusable on any set of rule table, questions, and suggested actions. The default is to use those given in the printer troubleshooting table.
=={{header|D}}==
|