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.
Hints to define
isoUnMaybe
I'm writing this comment since this is the function I had the most problems defining.
I hope these hints help someone in my situation get into the mindset necessary to solve this on their own.
Hint 1
The resulting function is total, even though it uses a non-total function in the code. It's up to the developer to prove (independently) that the result is total since the type-checker can't verify it on it's own.
Hint 2
Consider the relationship between the value
Just a
that the forward function (:: Maybe a -> Maybe b
) sends toNothing
and the backward function (:: Maybe b -> Maybe a
). Remember that both functions are supposed to form an isomorphism. What kind of relationship would the Null spaces of eitherGiven the fact that the forward (
:: Maybe a -> Maybe b
) and backward (:: Maybe b -> Maybe a
) form an isomorphism, consider the relationship between the value (Just a
) which the forward function sends to Nothing and the backward function.Hint 3
You might want to look into implementing the following special case:
Got this one first try, really I just had to follow whatever error message my IDE was saying ^^
But the comments are better than for isomorphism IMO, and I know what was the mindset of the kata, so I can't complain x) and it's always satifaying to go from red to green ^^
[solved in rust]
I did this kata by just writing the simplest code I could to make it compile, and then understand the little tricks about
iso_un_option
,iso_eu
.I must say I don't really understand what's this kata supposed to teach you... I did learn stuffs though, being new to rust, I understood the concept "catpuring" closures / move + closure, which seems really useful.
But besides that I don't really get it. Ok, if you have a bijection between A U {None} and B U {None}, then you have a bijection between A and B. But I can prove that pen & paper in 3 minutes, no need to sratch my head writing un-readable code just guided by the IDE/rust-analyser error messages...
My conclusion is that: you should write what's the purpose of the kata in the description.
Is it to prove some (failrly basic) isomorphisms' properties using code/type systems?
For me, "We will walk through the definition of isomorphism and define some common isomorphisms" is too vague, and personnaly it generates frustration. Please write of few more lines of description.
Also, the comment "Going the other way is hard (and is generally impossible) ... You need this to prove some cases are impossible." felt fairly confusing. Something like "Nothing forbids Some(a) to map to None" would have been much clearer (without give it away).
Same for "inf + 1 = inf + 0", you need to be somewhat aware of specific ways of "building integers" to understand this, which feels a bit sad for people who don't.
Sorry to be harsh, I know you've spent time on this.
Now that I have understand the mindset, I might try the follonw ones, and even enjoy it. But that would have helped to get that from the description.
Marking Resolved as of Jauttaro Coudjau.
this is now untrue, isomorphism is available :) https://www.codewars.com/kata/isomorphism
Should be marked as resolved
I can't see your comment, it's hidden
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Great and rewarding challenge, so much fun
The Rust translation of this kata depends on having solved the Rust version of the Isomorphism kata, which no longer exists.
Hi I was wondering, are there any missing exercises/functions for the rust type?
This is smart but extremely slow!
A bijection is an isomorphism in the category of sets, meaning that it is just an invertible one-to-one mapping between two sets.Many categories can be thought of as sets with additional structure (e.g. groups, rings, differentiable functions etc.) and an isomorphism requires the structure of the category to be preserved. For example if you are mapping in the category of groups, then you need to map the identity element of the first group to the identity of the second group and you need to preserve the group law so that f(a*b) = f(a).f(b) where * is the group operation of the first group and . is the operation in the second group.
The fact that there is a hint in the instructions to look at the wikipedia page for a bijection rather than the category theory definition of an isomorphism is actually a fairly subtle clue how to solve one of the parts of the kata which can only be solved by possibly breaking the isomorphism structure.
this stuff seems to be broken, not sure if it's currently solvable. TraceshowID doesn't show any evaluation.
You can encode maybe as well
Loading more items...