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.
This comment is hidden because it contains spoiler information about the solution
You can encode maybe as well
.
It's fixed now. Please confirm.
Let me check
(I see that you have done it in the original church and his student way, but I think it is somewhat inelegant to use a pair)
You are right. I will fix this soon (currently writing paper, sorry)
Hi,
Thanks for the comment. The reason, I used
Maybe [Int] -> Int
is that I followed the original kata (in C#) which distinguishes betweennull
and empty list. The F# translation created by the author of the Kata usesOption
type i. e. F#'s equivalent ofMaybe
.The
[Int] -> Maybe Int
wouldn't correspond with the description:Regards,
suic
It really doesn't have to be that bad, a slightly more reasonable point-free solution would be:
Edit:
And with the
bool
function found in more recent versions of GHC, you don't even need theBool -> Int -> [Int] -> Maybe Int
hack:actually it's machine-generated code from a stack based idea
I didn't intend to have exta whitespaces, it is a "surprise" of Quickcheck random test cases... To have all things equal through all the languages of this kata I filter them now. Please could you try again and tell me if everything is correct?
I will try to look at that:-( Please could you tell me what is your:
["opu","","","vgsyk","b"]
input string splitted on whitespaces? For now I changed test2 so that the input string be printed, maybe it will permit to see where the mistake is... It comes certainly from extra whitespaces in the input string.Edit: I think that the expected is the good one because of the whitespaces:
".OPU..VGSYK.b"
but I have a doubt about the spaces betweenOPU
andVGSYK
in the expected you gave. Must be there 2 spaces but in your post it seems that there is only one. Here I have put dots instead of spaces.I have been thinking about this. Even I think that
type ErrorString = String
Either ErrorString String
is more idiomatic.But on other hand kata description says that function must be called get_reversed_color and exception should be raised.
Do you suggest to not take a look at this? or change kata description?
Thanks, I think I've applied all those changes, can you check and see if it's ok now?
It is normal. Didn't you see in "Your test cases" or in "Test Cases" that the tests have the following form:
It is a kind of fuzzy test to avoid truncating or rounding problems that happen frequently and cause so much arguing. I didn't put it in the description because I thought it would be obvious for someone seeing the tests but I will write it in the description to please you:-)
Thanks for the feedback.
Loading more items...