Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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.



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

Search: