Viewing a response to: @reggaemuffin/introducing-the-coding-challenge
Two solutions with Haskell: http://codepad.org/tIR16emr 
author | tzs |
---|---|
permlink | re-reggaemuffin-introducing-the-coding-challenge-20170818t022340743z |
category | coding-challenge |
json_metadata | {"tags":["coding-challenge"],"image":["https://steemitimages.com/DQmed9LTNRtgUqf7jqWYbpWGJUWmUaRt4XXJePTmYzSJ6Zd/Screen%20Shot%202017-08-17%20at%209.21.12%20PM.png"],"links":["http://codepad.org/tIR16emr"],"app":"steemit/0.1"} |
created | 2017-08-18 02:23:42 |
last_update | 2017-08-18 02:23:42 |
depth | 1 |
children | 6 |
last_payout | 2017-08-25 02:23:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.585 HBD |
curator_payout_value | 0.193 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 226 |
author_reputation | 66,276,041,146 |
root_title | "Introducing the Coding Challenge" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 12,137,454 |
net_rshares | 226,124,129,786 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
reggaemuffin | 0 | 211,281,983,150 | 2% | ||
benniebanana | 0 | 6,932,388,784 | 100% | ||
tzs | 0 | 7,909,757,852 | 100% |
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.
author | reggaemuffin |
---|---|
permlink | re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t054013756z |
category | coding-challenge |
json_metadata | {"tags":["coding-challenge"],"app":"steemit/0.1"} |
created | 2017-08-18 05:40:15 |
last_update | 2017-08-18 05:40:15 |
depth | 2 |
children | 5 |
last_payout | 2017-08-25 05:40:15 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.020 HBD |
curator_payout_value | 0.006 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 492 |
author_reputation | 37,964,839,695,531 |
root_title | "Introducing the Coding Challenge" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 12,147,892 |
net_rshares | 7,757,166,712 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
tzs | 0 | 7,757,166,712 | 100% |
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.
author | ratticus |
---|---|
permlink | re-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t072036776z |
category | coding-challenge |
json_metadata | {"tags":["coding-challenge"],"app":"steemit/0.1"} |
created | 2017-08-18 07:20:36 |
last_update | 2017-08-18 07:20:36 |
depth | 3 |
children | 3 |
last_payout | 2017-08-25 07:20:36 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.020 HBD |
curator_payout_value | 0.006 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 266 |
author_reputation | 5,793,669,654,286 |
root_title | "Introducing the Coding Challenge" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 12,152,860 |
net_rshares | 7,599,660,789 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
tzs | 0 | 7,599,660,789 | 100% |
True his solution starts at 1, good catch, here is a tip! But yeah it will work with 0, pretty sure.
author | reggaemuffin |
---|---|
permlink | re-ratticus-re-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t101426256z |
category | coding-challenge |
json_metadata | {"tags":["coding-challenge"],"app":"steemit/0.1"} |
created | 2017-08-18 10:14:30 |
last_update | 2017-08-18 10:14:30 |
depth | 4 |
children | 0 |
last_payout | 2017-08-25 10:14:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 100 |
author_reputation | 37,964,839,695,531 |
root_title | "Introducing the Coding Challenge" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 12,161,916 |
net_rshares | 0 |
<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>
author | tipu |
---|---|
permlink | re-re-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t072036776z-20170818t101441 |
category | coding-challenge |
json_metadata | "" |
created | 2017-08-18 10:14:42 |
last_update | 2017-08-18 10:14:42 |
depth | 4 |
children | 0 |
last_payout | 2017-08-25 10:14:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 431 |
author_reputation | 55,914,702,009,771 |
root_title | "Introducing the Coding Challenge" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 12,161,928 |
net_rshares | 0 |
Check this one: [http://codepad.org/GPTa3Tgm](http://codepad.org/GPTa3Tgm)
author | tzs |
---|---|
permlink | re-ratticus-re-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t233814387z |
category | coding-challenge |
json_metadata | {"tags":["coding-challenge"],"links":["http://codepad.org/GPTa3Tgm"],"app":"steemit/0.1"} |
created | 2017-08-18 23:38:12 |
last_update | 2017-08-18 23:38:12 |
depth | 4 |
children | 0 |
last_payout | 2017-08-25 23:38:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 74 |
author_reputation | 66,276,041,146 |
root_title | "Introducing the Coding Challenge" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 12,218,020 |
net_rshares | 0 |
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`.
author | tzs |
---|---|
permlink | re-reggaemuffin-re-tzs-re-reggaemuffin-introducing-the-coding-challenge-20170818t233545415z |
category | coding-challenge |
json_metadata | {"tags":["coding-challenge"],"app":"steemit/0.1"} |
created | 2017-08-18 23:35:42 |
last_update | 2017-08-18 23:35:42 |
depth | 3 |
children | 0 |
last_payout | 2017-08-25 23:35:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 389 |
author_reputation | 66,276,041,146 |
root_title | "Introducing the Coding Challenge" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 12,217,895 |
net_rshares | 0 |