create account

RE: Introducing the Coding Challenge by reggaemuffin

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @tzs/re-reggaemuffin-introducing-the-coding-challenge-20170818t022340743z

· @reggaemuffin ·
$0.03
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.
👍  
properties (23)
authorreggaemuffin
permlinkre-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t054013756z
categorycoding-challenge
json_metadata{"tags":["coding-challenge"],"app":"steemit/0.1"}
created2017-08-18 05:40:15
last_update2017-08-18 05:40:15
depth2
children5
last_payout2017-08-25 05:40:15
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.006 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length492
author_reputation37,964,839,695,531
root_title"Introducing the Coding Challenge"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id12,147,892
net_rshares7,757,166,712
author_curate_reward""
vote details (1)
@ratticus ·
$0.03
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.
👍  
properties (23)
authorratticus
permlinkre-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t072036776z
categorycoding-challenge
json_metadata{"tags":["coding-challenge"],"app":"steemit/0.1"}
created2017-08-18 07:20:36
last_update2017-08-18 07:20:36
depth3
children3
last_payout2017-08-25 07:20:36
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.006 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length266
author_reputation5,793,669,654,286
root_title"Introducing the Coding Challenge"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id12,152,860
net_rshares7,599,660,789
author_curate_reward""
vote details (1)
@reggaemuffin ·
True his solution starts at 1, good catch, here is a tip! But yeah it will work with 0, pretty sure.
properties (22)
authorreggaemuffin
permlinkre-ratticus-re-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t101426256z
categorycoding-challenge
json_metadata{"tags":["coding-challenge"],"app":"steemit/0.1"}
created2017-08-18 10:14:30
last_update2017-08-18 10:14:30
depth4
children0
last_payout2017-08-25 10:14:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length100
author_reputation37,964,839,695,531
root_title"Introducing the Coding Challenge"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id12,161,916
net_rshares0
@tipu ·
<table><tr><td>http://i.imgur.com/IFF4CSc.jpg</td><td><p><strong>Hi @ratticus! You have just received a 0.5 SBD tip from @reggaemuffin!</strong></p><hr><p><a href="https://steemit.com/steemit/@tipu/tipu-quick-guide" rel="noopener">@tipU quick guide</a> |  How to check your <a href="https://steemit.com/steemit/@tipu/cool-steem-tools-check-your-pending-payouts-with-charts" rel="noopener">pending payouts.</a></p></td></tr></table>
properties (22)
authortipu
permlinkre-re-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t072036776z-20170818t101441
categorycoding-challenge
json_metadata""
created2017-08-18 10:14:42
last_update2017-08-18 10:14:42
depth4
children0
last_payout2017-08-25 10:14:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length431
author_reputation55,914,702,009,771
root_title"Introducing the Coding Challenge"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id12,161,928
net_rshares0
@tzs ·
Check this one: [http://codepad.org/GPTa3Tgm](http://codepad.org/GPTa3Tgm)
properties (22)
authortzs
permlinkre-ratticus-re-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t233814387z
categorycoding-challenge
json_metadata{"tags":["coding-challenge"],"links":["http://codepad.org/GPTa3Tgm"],"app":"steemit/0.1"}
created2017-08-18 23:38:12
last_update2017-08-18 23:38:12
depth4
children0
last_payout2017-08-25 23:38:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length74
author_reputation66,276,041,146
root_title"Introducing the Coding Challenge"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id12,218,020
net_rshares0
@tzs ·
I don't know what you mean by
> making rules a constant

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 the `rules` to get a new `FizzBuzz`.
properties (22)
authortzs
permlinkre-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t233545415z
categorycoding-challenge
json_metadata{"tags":["coding-challenge"],"app":"steemit/0.1"}
created2017-08-18 23:35:42
last_update2017-08-18 23:35:42
depth3
children0
last_payout2017-08-25 23:35:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length389
author_reputation66,276,041,146
root_title"Introducing the Coding Challenge"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id12,217,895
net_rshares0