When I first started CodeWars I just couldn't do this, and I'm not sure why but I think because I couldn't understand the do notation for monads (I'd read about monads but I think I didn't know how to make it recursive, how to format do blocks, nor how to use control flow)

I had completely forgotten, but when I loaded this kata today I deleted a whole mess of code, re-wrote the kata properly using a few concise lines, and bingo! — Test successful, would you like to submit your code?

It just goes to show that if you train every day, and work on your kata — wax on, wax off — then you can achieve great things. CodeWars has been my Mr. Miyagi!

Note that this definition would not work for Double, e.g. 2.25=1.5^2 would be sent to 2^2=4, because 1.5 gets rounded to 2, although 2.25 is closer to 1 than to 4.

Hi, I know this post was from a while ago, but doesn't this only work for consecutive integers starting from one? For an arbitrary set of integers I believe this method fails.

Sorry if this was only meant for those sets, I just didn't see that pointed out anywhere.

Fair enough, if you have some optimal set of restrictions that allows only the interesting/creative solutions please let me know it and I will change the rules.

This comment is hidden because it contains spoiler information about the solution

This comment is hidden because it contains spoiler information about the solution

impressive infinite list instance ;w;

Hmm, which edge cases that fall into the category "positive, non-zero digits"?

There are edge cases where this doesn't work.

Gosh, it's hilarious.

When I first started CodeWars I just couldn't do this, and I'm not sure why but I think because I couldn't understand the do notation for monads (I'd read about monads but I think I didn't know how to make it recursive, how to format do blocks, nor how to use control flow)

I had completely forgotten, but when I loaded this kata today I deleted a whole mess of code, re-wrote the kata properly using a few concise lines, and bingo! — Test successful, would you like to submit your code?

It just goes to show that if you train every day, and work on your kata — wax on, wax off — then you can achieve great things. CodeWars has been my Mr. Miyagi!

Note that this definition would not work for Double, e.g. 2.25=1.5^2 would be sent to 2^2=4, because 1.5 gets rounded to 2, although 2.25 is closer to 1 than to 4.

That's what you get when you code golf it. 176 chars.

Anyone up to beat that?

The goal of this Kurmite was to disallow the use of

`java.util.stream.Stream`

.If you find a way to use that anyway, let me know.

Hi, I know this post was from a while ago, but doesn't this only work for consecutive integers starting from one? For an arbitrary set of integers I believe this method fails.

Sorry if this was only meant for those sets, I just didn't see that pointed out anywhere.

Yeah, true to your word.

There is no middle ground.

This kata promotes bad coding habits.

`java.util`

is banned.## Loading more items...