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.
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.
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, 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:Updated.
Oh, this kata is deeply flawed then. I even tried to
unsafeCoerce
everything to Int (even though it is UB) and compare them insidescanl
, it even rejected your solution (both of them, actually), but there are still bogus ones. I'll delete this kata if I don't come up with anything sane then.Oh, that was a blunder. I should have mentioned that Tribonacci sequence should require only one
scanl
. You can't reduce it twice, the second sequence can't be rewritten in terms of itself. At least I didn't see the solution.Fixed.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
You can use
listToMaybe
instead ofheadMay
.I should have known about
filterMap
ormapMaybe
before, it's such a nice function.Can be changed to:
Still clunky but I didn't want to change the structure.
Loading more items...