4 ms·
With all due respect, digit-wise MIN seems like an unnecessary abstraction in same vein as AbstractManagerFactoryFactory. If the abstraction doesn't have gener
by saynsedit 10y ago
With all due respect, digit-wise MIN seems like an unnecessary abstraction in same vein as AbstractManagerFactoryFactory.
If the abstraction doesn't have generally applicable higher-level properties, it's probably not worth abstracting.
After all, bit-wise AND is only one of 16 possible two-argument bit functions. Shall we create a digit analog for all 16 of them?
- pdpi 10y agoAs other people have said in this thread, the interpretation of AND and OR as MIN and MAX respectively _is_ a useful one, and it sees applications in fuzzy logic. Given that, looking at decimal digit-wise AND under that lens isn't about introducing a new abstraction, it's about applying an existing abstraction to a new domain.
- deleted 10y ago[deleted]
- saynsedit 10y agoOne litmus test to check the usefulness of an abstraction is to see if it conforms to existing laws of the specific case. Let's use distributivity of AND over OR: a & (b | c) = a & b | a & c This also works in the abstraction of Boolean algebra to normal algebra: a * (b + c) = a * b + a * c What about with your digit MIN/MAX abstraction: MIN(a,MAX(b,c)) = MIN(MAX(a,b),MAX(a,c)) Well... No, this does not generally hold. If b and c are both larger than a, then this equality fails. Distributivity is a pretty important property. Without it, your MIN/MAX algebra just has commutivity and associativity which arguably aren't very unique considering all other possible commutive/associative functions. In any case, losing a property dramatically decreases the usefulness of your algebraic abstraction. Another wart in your abstraction is the missing NOT operation, further deteriorating its usefulness. Just because the MIN abstraction works for the AND case, that's not enough to make it a worthwhile abstraction. What happens when you want to do more complex yet natural operations like a & (b | c)? In the same vein, AbstractManagerFactoryFactory may seem elegant now, but it may make it harder for new code to do trivial things down the road.
- jonsen 10y agoI think it works, if you do it right: MIN(a,MAX(b,c)) = MAX(MIN(a,b),MIN(a,c))
- saynsedit 10y agoIt does, I stand corrected.
- jonsen 10y agoAnd so does MAX(a,MIN(b,c)) = MIN(MAX(a,b),MAX(a,c)) so it is even more useful than normal algebra :p
- homegarlic 10y agoFuzzy logic has insane amounts of similar ORs and ANDs that also have to conform some simple laws. Generalization of ANDs and ORs is called t-norms and t-conorms (s-norms). They have to satisfy laws of monotonicity, commutativity and associativity. So all kinds of magical ANDs and ORs spawn to meet the requirements. I'm not really a fan of fuzzy logic but it really is a nice exercise in mathematics.