6 kyu

Binding of Algebraic Data Types

Description
Loading description...
Functional Programming
Algorithms
  • Please sign in or sign up to leave a comment.
  • Kacarott Avatar

    Python Fork

    • Fixes typo in description
    • Explicitely imports from solution and preloaded
    • Slightly restructures tests to add @it blocks (this makes it look like lots changed in full tests, but that is mostly just indent)
    • Added one simple fixed test for product types with more than 2 subtypes (since both I and TFeld below ran into problems with this, only in the random tests)

    Very nice kata btw :)

    • dfhwze Avatar

      approved, one thing remained unclear to me from description, an "implicit conversion" is a "from -> to" from bindings (I would say this is an "explicit conversion"). Also "from -> to" and "to -> from" are two different kinds of conversions.

      Suggestion marked resolved by dfhwze 7 months ago
  • TFeld Avatar

    How does this random test makes sense? If both A and B are product types, all A's should be mappable to all B's? (which they are)

    Binding (a8 & a9 & a4 & a7 & a1) to (a0 & a8 & a3 & a2) given {(a1, a7), (a8, a9), (a4, a4), (a2, a1), (a9, a6), (a5, a3), (a8, a2), (a8, a3), (a4, a1), (a8, a7), (a3, a1), (a9, a8), (a3, a9), (a7, a0), (a2, a7), (a8, a4), (a1, a6), (a5, a9), (a8, a8), (a7, a1), (a2, a9), (a9, a7), (a9, a0), (a6, a0), (a4, a0), (a5, a6), (a7, a6), (a3, a2), (a9, a9), (a3, a7), (a7, a7), (a2, a0), (a5, a2), (a1, a2), (a9, a1), (a2, a6), (a4, a9), (a4, a3), (a7, a2), (a6, a6), (a8, a1), (a7, a8), (a2, a8), (a1, a4), (a3, a4), (a5, a7), (a1, a8), (a4, a6), (a5, a4), (a9, a4), (a4, a8), (a2, a3), (a6, a7), (a8, a0), (a5, a0), (a6, a3), (a2, a5), (a9, a3), (a8, a6), (a6, a9), (a1, a0), (a6, a5), (a7, a9), (a9, a5), (a7, a3), (a1, a5), (a4, a2), (a9, a2), (a1, a9), (a6, a2), (a5, a5), (a3, a0), (a3, a5), (a2, a2), (a5, a1), (a2, a4), (a3, a3), (a6, a8), (a1, a1), (a4, a5), (a6, a4), (a5, a8), (a7, a4), (a3, a6), (a3, a8), (a6, a1), (a7, a5), (a1, a3), (a8, a5), (a4, a7)}: True should equal False
    
    • TFeld Avatar

      Maybe I'm reading the rules wrong, but I pass all of the fixed tests, but a lot of the random tests fail (and I cannot see why, when checking them manually)

    • G_kuldeep Avatar

      if a and b are product types (a1&a2 and b1&b2) then

      a1 must be bindable to b1, a2 to b2 and so on..

      remember:subtypes may have more than 2 types or may be different, so check for length

    • TFeld Avatar

      Ah, I see..

      I Thought that all A_n should be mappable to all B_m (not the same index)

  • G_kuldeep Avatar

    Approved

  • Voile Avatar

    What is the format of bindings? From the fixed tests apparently each element is in the form of (from_type, to_type), but it's not mentioned anywhere.

    • Dr Gabo Avatar

      It's mentioned at the end of the description (also the type Set[Tuple[ADT, ADT]] implies it, anyways). Should I rewrite to make it more clear?

    • Voile Avatar

      also the type Set[Tuple[ADT, ADT]] implies it, anyways

      It's actually kind of ambiguous until (from, to) is mentioned. Also putting this information at where it is right now is kind of sub-optimal since it's very easy to miss it.

    • Dr Gabo Avatar

      I updated the description to give an example of binding set. I hope it's more clear now :)

      Issue marked resolved by Dr Gabo 5 years ago