http://qs1969.pair.com?node_id=41305


in reply to Boolean algebra

I'd attempt this, but your specification is inconsistent, and as I was looking at it, I stopped working on it until you clarify. Specifically:
  • The order of variables in the output string had to be the same as the input string.
This specification cannot be used with your sample data because you have the items delivered in different orders in the subexpressions: (abdc) vs (adc-b). So are you saying:
  1. that we're permitted to select a subexpression at random with which to comply, or
  2. that your sample data would never be the actual data, or
  3. that this rule can be tossed out?
(Each of those yields a slightly different solution in my mind, because I can optimize for some things differently in each. {grin})

-- Randal L. Schwartz, Perl hacker