![]() |
|
The stupid question is the question not asked | |
PerlMonks |
Boolean algebraby le (Friar) |
on Nov 13, 2000 at 04:02 UTC ( [id://41235]=perlquestion: print w/replies, xml ) | Need Help?? |
le has asked for the wisdom of the Perl Monks concerning the following question:
Hi, it's been a long time since I posted my last question here, but I've started my studies of CS and don't find a lot of time anymore. Well, one of our first courses at the university is called "Introduction to programming" where we do stuff in Modula-2 (yeah). I always felt like "Hey how easy could this be done in Perl", but I resisted to annotate my thoughts in a comment in the source code :-) One of the first examples we had to solve was the simplification of a boolean expression. The input looks like this which aliases two boolean expressions. The terms inside the expressions are ANDed together, and the two expressions are ORed together (a negation is expressed with "-"), which means that the above string would be
Now boolean algebra says that one can simplify this expression if and only if the two partial expressions differ in just one negated variable, so the solution for the above example would be: The specification for this example was rather strict:
So I want to know if you guys (and ladies of course) can give a quick hack for this. (My Modula-2 programm was 202 lines long, pretty-formatted.)
Back to
Seekers of Perl Wisdom
|
|