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.
I'm so confused.
My solution passes all the test cases but gives the error:
All of my answers were one line calls to scanl so I'm not sure what it's upset about. It possible to fix this one? It's a pretty fun problem.
This is actually best practice rather than clever (ok maybe clever) cuz it's O(1).
You should lookup what infix operators other than composition are provided in prelude.
Well, I just can't manage it!
Are you supposed to make this pointfree or not, I wonder... I'm a character off, and nothing I try does it.
Could really do with more rigorous testing.
I'd allow one extra character for at least some variability in possible solutions, and they would still require firm grasp of the concept
Seems like a necroposting but it still does not account for edge cases.
https://www.codewars.com/kata/reviews/5de92cff10dfae00012aa8ff/groups/5e083ebf8c89df0001c5b680
They do not conflict, the second function is simply more general then the first one. Try to squeeze in one more type variable into your definition.
What's the type of
foldRoseTree
? According to the simple test cases I implemented thefoldRoseTree
with type(a -> [b] -> b) -> (b -> [b] -> [b]) -> [b] -> RoseTree a -> b
, but there is a functionroseDepth = foldRoseTree (const (+ 1)) max 0
in truly test cases, which is conflict with simple test cases.I guess for now.
I can constraint type signature of
scanl
and check inside what exactly is passed to it, the only thing is it will break almost all solutions, is it fine?Oh yeah,
foldr
also assumes the fold is associative.Speaking of that, you should add some random tests and more complicated fixed tests. You can use
QuickCheck
to help you with the random tests ;-)Oh, nice, thank you! Your solution only passed because of my poorly written tests (which I hope I fixed by now). The thing is you get a bunch of
Endo . LeafNode
combined one after another (as if we had a list), instead of our previous proper structure.Here what
base
says about it:Loading more items...