News for hackers. Stuff that matters.
Re:Fizzbuzz, Interviews, And Overthinking by KirinDave on Friday October 05, 2012 @11:41AM (#4617308)
This is another example of someone who I think looked at my code examples but didn't read the post. Fair enough, I guess.

> While of course it is possible to define abstractions that handle fizzbuzzing anything for any number, it's clear that the monoid way is a bad overweight bloated approach.

Why? It is not computationally expensive, and it avoids excess modulo operations. All the dispatching work gets figured out at compile time and you end up with pretty much the same sorts of string concatenation costs you get in every other implementation.

Do you mean to suggest that it is conceptually expensive?

> Lastly functional and procedural programming enable you to work at the highest level of abstraction you can think of, whereas OO tends to lock you at a specific abstraction level, which is pretty low and not adapted to most cases.

I actually agree with this, although I sort of question procedural's place on the totem. I suppose stuff like Forth suggests you're right.

Re:Fizzbuzz, Interviews, And Overthinking by ludovicurbain on Wednesday October 10, 2012 @04:11AM (#4635518)
Bloated, as in, takes way too much space for what it is.

Additionally, it does _not_ avoid excess mod operations, _and_ the implementation is _broken_ because it won't print fizzbuzz for the 15.

Lastly, using lambda's and whatnot's just because you can is yet another form of inefficiency and completely obfuscates what the machine will do.

I mean to suggest that 1) it should be a much shorter read 2) it's inefficient, and wrong 3) one does not simply lambda everything.

Re:Fizzbuzz, Interviews, And Overthinking by KirinDave on Thursday October 11, 2012 @08:47PM (#4643456)
> Bloated, as in, takes way too much space for what it is. > Additionally, it does _not_ avoid excess mod operations, _and_ the implementation is _broken_ because it won't print fizzbuzz for the 15.

If we're talking about the Haskell version here (I can't tell?), you're wrong on all counts.

• It is about as short as any reasonable impl I've seen of FizzBuzzBazz. Not long at all.

• And it does print out correctly for 15.

• And it does NOT do excess operations. It does exactly one modulo per factor.

Do you not understand how it works? I detail it pretty closely in the post; please look again.

The second ruby version _is_ long, but does not perform excess operations (unless you're complaining about Ruby's implementation of lambdas, which is out of scope). As I said both in my article and in this discussion; coding during an interview is tricky and that's not a bad effort.

Fianlly, the naive if-chain extensions are deliberately wrong to extend, but my initial research and experience is that most programmers don't realize that until they try it once. But then, they're lifted right from Rosetta Code so they're hardly unrepresentative of what people consider an "unacceptable" version of Fizzbuzz.