Would be a nice kata otherwise, but with that test setup it's a pain in the ass for all bit shifters....
The fixed one has a call to round on line 87 of the test cases, but for some reason the one I see when I click Show Test Cases is still the old non-fixed one. Do you know if you could check to see if you know how to get the fixed one used? Otherwise, I could try resubmitting it.
Show Test Cases
People are reporting errors with the Swift translation again, can you look into that? Here is a link:
I wasn't sure if I should require a lazy solution like the haskell one so I did
If you don't think this is a good idea, I can remove the requirement
I'm working on it. At this point I've got an array of required letters with corresponding prefixes and sorted it by length of its elements. It's pretty hard to implement sorting in ascending order, didn't figure it out yet. PS. Finally passed all the tests - my solition looks pretty ugly though :). An awesome kata despite its description was a little bit vague to me at first.
I think the description of the sorting should explicitly say that the sorting happens on the entire string with the 1/2/E/= prefix, not just the repeated letters. The current wording doesn't specify this and can easily be interpreted as just applying to the repeated letters.
Looks good, though personally I would have preferred leaving the argument labels in (since it's very hard to tell what's what in areaOfPolygonInsideCircle(3, 3), but it's obvious in areaOfPolygonInsideCircle(radius: 3, sides: 3)), but changing that now would break existing solutions so oh well.
areaOfPolygonInsideCircle(radius: 3, sides: 3)
Swift infers the types of literals based on what you're using them in. This means that you don't need 2.0 (just use 2), and you don't need Double(1000) (just use 1000).
It happens in Ruby at least
Thanks for the translation!
I don't program in Swift, but saw you passed the original kata, and took the effort to adapt it to Swift, including the random testcases and all. I haven't checked the code carefully but still, I trust you did a good a job so I'm approving it.
Thanks for the translation, btw.
Alright, I forked my old test case with a new one. I don't know how to actually switch to it, though. The issue was a double rounding issue, since doubles are great.
Someone just reported an issue with the Swift translation -- can you check it out? Here is the link: http://www.codewars.com/kata/resistor-color-codes-part-2/discuss?utm_campaign=code_challenge_comment_owner&utm_medium=email&utm_source=notifications#5879332254a678c6ff000168