Either I'm not back or I never left. This place is toxic and I'm sorry I looked. I just wanted to put the code where I could find it again later. You guys don't even know what you are looking at.

Like the other guy, you miss the point. On any given day I may fabricate a decision tree consisting of one wacky question after another. Does the key FOO exist? If so, is it defined? If so, is its value not less than 42? If so, is the value of key BAR some true value? After passing all these checks I take an action. Then I decide to look for when FOO exists but is undefined and when BAR not exists. These trees sometimes grow in complexity over time and must be refactored.

The refactoring I show here consists of pulling all the conditionals out of the tree itself and setting explicit boolean flags. Then there are exactly 2^N outcomes possible, ever; and when the tree itself is written out it's easy to verify by eye that every case is exhausted.

The specific details of this one application of the approach are utterly without importance.

Death only closes a Man's Reputation, and determines it as good or bad. —Joseph Addison

In reply to Re^2: Case Exhaustion Tree by Xiong
in thread Case Exhaustion Tree by Xiong

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.