Thank you for your submission! I really hoped that I get a Haskell one 🐑
Your first solution is pretty concise, not much to say there. The second one is really cool! Abstracting it as rules is smart and that filter reduces logic duplication.
I think you can make this a bit more readable with making rules a constant and extracting the tester in a helper function that has a good name.
Looking forward to you writing a post on how your process was, implementing the second version of it.
Only comment I have is the question asked for 0 to 100 but the solutions are for 1..100. How does either solution work for 0? Dealing with 0 shouldn't be too difficult, though 0/x is going to be 0 and 0 mod x is also 0. I guess it will/should print FizzBuzz for n=0.
True his solution starts at 1, good catch, here is a tip! But yeah it will work with 0, pretty sure.
Hi @ratticus! You have just received a 0.5 SBD tip from @reggaemuffin!
@tipU quick guide | How to check your pending payouts.
Check this one: http://codepad.org/GPTa3Tgm
I don't know what you mean by
It's already a constant there.
Since the filter phrase used once and it's a short one, I'd argue it's easier to read it this way.
I implemented/borrowed the second one because I wanted to have a generic solution that is easy to expand or change with new
rules
. Now, all you need is to update therules
to get a newFizzBuzz
.