Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
lungdart3360167dBest practice is to break that expression out into a function and comment the fuck out of the logic with lots of apologies.
-
donkulator2908167dI've just spent several minutes wondering whether you could create booleans with real and imaginary components like complex numbers.
I have concluded that a) you probably can't, and b) I've forgotten how to do maths. -
AleCx0428239167dnow look into prepositional calculus and the kind of logic you can express with things like Prolog or Clingo.
I hate it too -
electrineer30343167d@donkulator
troll && troll -> false
troll || troll -> troll
troll && false -> troll
troll && true -> troll
troll || false -> troll
troll || true -> true -
Demolishun34923167dDivide and conquer. Assign to temp variables with meaningful names of each variable. Create final expression by combining these variables into the expression.
-
cafecortado7881167dI find it entertaining to try to simplify them applying Boole algebra. Truth tables, Karnaugh maps, De Morgan laws... fun stuff.
Although not always useful because the "simplified" version could make conceptually less sense. -
JsonBoa2983167dFinding a way to easily solve loooooong boolean equations is literally the way to solve most of the hardest problems known to humanity.
Not kidding, this sucker is an NP-Complete, offer referred to as "Satisfiability Problem", "SAT", or, more often, "that bitch".
Related Rants
I hate complex boolean logic.
(true||false) && true || false || (true && false) ... etc (continue for at least ten clauses four times as long)
rant
dev-life
frustration
boolean logic