Hacker News new | past | comments | ask | show | jobs | submit login

    "Well", Harry said, "If you are asked to add 
    two employees, return the guy who is older. But 
    if both of them are the same age, then return the 
    guy who has been with the company  the longest. 
    But if both guys have been working for us for the 
    same number of years, then return the guy with the 
    lowest salary. But if they both earn the same as 
    well, then just randomly pick one over the other"
I didn't think that was very hard to understand or verify.



Except the obvious: why the hell is he "adding" employees, and what does that even mean?


Who knew there was such a bias against mathematics on Hacker News?

The basics of abstract algebra need to be disseminated more widely. These are not hard concepts.

Adding employees means exactly what it was defined to mean in the article. It's an associative binary operation.


Since my point obviously flew straight over your head: the problem is not whether we understand monoids, or even that "Harry" used monoids to solve the problem, but that he's using completely inappropriate terminology to try to explain his solution to non-technical people.


Actually, he's using completely appropriate terminology. Your mathematical education is just sufficiently limited that you don't know that. Rather than getting angry, you'd think your reaction would be to absorb the new information.

To me, your complaint is like someone saying it's inappropriate terminology to discuss time complexity in big-Oh notation, because we're programmers, not mathematicians.


It still doesn't make sense to call it 'add'. Please tone down the condescension.


I apologize for the condescension. I just think these are concepts worth knowing and that they shouldn't be looked down on so much. A lot of people are never going to learn this stuff if they dismiss it so quickly. And that holds back not just themselves but anybody they work with who does understand this stuff.

One of my favorite quotes about software development is that the hardest part of it is not being clever. The flip side, though, is that even the simplest things can seem clever to those who don't have the same breadth of knowledge. In this case, Harry had a solution that seemed clever, but really wasn't that crazy at all. None of his colleagues understood it, but they should have, because it was actually extremely simple.

What's ludicrous about Harry's account isn't his solution or his notion of "adding" employees. It's that he understood these concepts and still took a day to put it together (or that he completely glossed over the more obvious approaches). He wasn't productive at all.

Anyway, as for the terminology, it's just a common name for an associative binary operation on a set with an identity element. If you've never seen it used in this way, I agree that it can seem bizarre, but the more you think about it the more you'll realize it is in line with a generalization of the sort of addition you do on integers.


Haha, poor choice of words there. When he says "adding", he really means "apply a binary operation A • B, which returns A if ....".

The key point is: Once you can define a binary operation which is associative, and an identity element I for which A • I = A, you can consider using monoids.


Well, lets say you have 3 elements (1,2,3) with 2 being 0. So since 2 is 0, 1+2=1=2+1, 2+2=2, 3+2=3=2+3. With me so far ? So what's 1+3 ? Well, it cannot be 1 because you could then cancel the 1's and 3 would become 0, but 3 isn't 0, its 2, because we just said so. 1+3 is obviously not 3, because by the same reasoning of cancellation, you'd end up with 1 equals 0, which it ain't cause 2 is 0. So by the weird magic of Niels Abel, 1+3 must indeed be 2. Because it just can't be anything else, yeah ? You only have 3 elements to play with, and 1+3 better be one of those. Similarly, you can work it out that 1+1=3, 3+1=2 and 3+3 =1. That completes your Cayley table and you can collect your paycheck and go home to wife and kids, because with 3 elements your Cayley has 9 slots. But when you have 10,001 employees, your Cayley will have 100 million slots. Unless you have a rule to fill those slots, you won't be able to fill the Cayley. "Adding employees" is simply a rule to fill the Cayley. HTH :)


This is where scala and C++ differ. In C++, if you overload operator+ to do something, the typical response is "what does that even mean???". In scala, when you write a function called plus that returns one of its arguments, the response is "oh, of course, that's a really cool great idea."


That part is actually a good layman's explanation of how the monoid here works. But then he goes on to talk about seeding a catamorphism with an identity employee.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: