Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Go version is missing package declaration
While this solution is clever I cannot see how it warrants the best practice up votes as this problem can easily be solved without any conversions between strings and integers.
The go version returns an error as the second value and imports the
errors
package -- both of these are unnecessary. First, if you don't use theerrors
package the code fails to compile. Second, I see no reason for theerror
value as the tests don't test for it and there are no requirements to return errors. In fact it's so useless you can change the signature toDative(word string) string
and the tests still pass.I experienced a similar issue but it was because I was modifiying the input slice with an in-place filter. When I switched to a secondary slice for the return values the problem went away as you would expect.
The description has a link to the wikipedia article on summation at the bottom which should help. This kata is far easier than the level suggests so don't over think it.
The description for this kata could do with expanding.
It does state that everything other than the phone number and name may contain erroneous non-alphanumeric characters but it doesn't state which characters are erroneous nor does it state that erroneous characters in the address should be replaced with a space.
The example does cover it but it would be helpful if the requirements were more clearly defined.
It's already been reported but the go version is missing the package statment, i.e it should have the statement
package kata
as the first line.