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 function has been made into a next kata, try it out to see if there is any error
https://www.codewars.com/kata/5fff4fe1ffa782001ea74a3b/
Type safety is ensured by imposing restrictions
the more information you encode in types,
the less ways you can compose solutions(Which for often times, exclude some simpler solutions :(.. ).
Expecially for higher order functions, Haskell need its argument to have consistant typing throughout the proccess,
Maybe recursion scheme would help to do recursion, but that is another topic though.
Thanks for pointing it out, tests improved
You are right. t should be[""].
Shouldn't that be
show makeParen 0 == [""]
?Use
`shouldBe`
instead of==
for random tests. You ( well, solvers :) get useful failure messages for free.OK, I have a solution. :]
Is the lack of elegance a necessary consequence of the type safety? I would have preferred to do something with
foldr
orstimes
, but the types seem to make that impossible. Is there really nothing to be done there?OK, you have me stumped. :]
That's not a problem. What is a problem is I can generate
"()()"
instead of"(())"
, but the example tests don't fail me for that, and the submit tests fail me without telling me what's wrong:Paren
has aShow
instance. Can't you show actual and expected value? That would show me what I'm doing wrong, I guess. ( In this case, I have a nasty suspicion what I'm doing wrong, but generally, I might not. ) And can you make the example test size 2 instead of 1? That should fail me, and that would also be useful. ( I can do it myself, but until I fail the submit test and I know what's wrong, I have no reason to do that. )Thanks for pointing it out. Description added now.
Behavior expected for negative
n
s inmakeNestedParenOfSize
is not defined.I add a new function implementation requirement to better demonstrate the type restricted property.
Now, you can help out by trying the updated version :)
I'd love to help out, but I couldn't - I don't know and understand enough of this stuff! :P
Thank you, I agree the kata is lacking content,
I will try to improve it by requiring the trainner to implement some additional functions that make use of the data implementation.
such as functions @pe200012 mentioned
Thank you
Yes, I will try to make device it into the kata, since the current content is not enough.
Loading more items...