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.
You probably want the
<details>
/<summary>
HTML tags.For some reason fixing the
Countable
instance forConst
got rid of the problem. I wouldn't have thought the two were related.The tests seem to be saying that
((), Void)
has a count of 1 (expected S Z, got Z
). Unless I'm mistaken, there is no instance of((), Void)
.I've also had my code fail on
((), Bool)
, stating that the count should be 3. But there should only be two instances of this type:((), True)
and((), False)
.Edit: This is in the tests for
Listable
.Fixed by
@dram
Needs update to
GHC 9.2.x
Compilation now gives type errors
Needs updating to
GHC 9.2.x
.Compilation now fails with horrible type errors. I can't fix it, sorry :/
TL;DR: Look at the lambda calculus definition of
church_pow
-(ce cb) f x
.Functions inside brackets are composed ; functions on the outside are just parameters for the previous function.
You can translate this definition into this resulting call
ce(cb)(f)(x)
.You can leave out each parameter that is not included inside brackets.
The same goes for
church_mul
:c1 (c2 f) x
becomesc1(c2(f))(x)
, meaning you can leave out thex
.Hi - as someone who also discovered this area recently and who found it really interesting, I can highly recommend the following 2 videos that were linked to me in the Codewars Discord:
https://www.youtube.com/watch?v=3VQ382QG-y4
and
https://www.youtube.com/watch?v=pAnLQ9jwN-E
They use JavaScript rather than Python but it's very understandable.
Why were you able to leave out (f)(x) on church_pow and it still worked? Still trying to fully wrap my head around this concept, thx.
Ugh. This is such a "what was the author thinking?" type of problem. Yes, yes, now that I have already figured out what the author was thinking, I can see how it makes sense. But there is no information at all about what all this Count machinery is about. The description flat out gives up and just says "(see code)" and then the code just spews a bunch of declarations in comments without explaining what they are intended to mean. The given classes could just as well be implemented as
count = Count 42
for all we can tell. The fact that those definitions are actually incorrect (classes are missing type params), and the real definitions are hidden in a module that we cannot read, makes it even worse. So then you look at the test cases, in hopes they might explain what was intended. But no, the test case there just says thatchallenge1
should becount1
, without any explanation of what either one means.I understand there are interesting ideas embedded in this kata. But at some point, you do have to tell people something about what they are supposed to be trying to accomplish!
I don't know if CW used to not have a dark mode, but currently the image in the description is very hard to see (Black on Grey).
This comment is hidden because it contains spoiler information about the solution
Added it, btw is there something like spoiler tag to make it collapsed initially and not clutter up description?
Please put the full Preloaded in the description instead ;-)
Loading more items...