Ad
  • Custom User Avatar
  • Custom User Avatar

    Should be 7 kyu;

  • Custom User Avatar

    can this code be considered as idiomatic C#?; considering todays standards.

  • Custom User Avatar
  • Custom User Avatar

    Yes, thanks for your reply, as far as I know a zipper or a tagging is an approach to create unique identifiers for nodes, but the problem was that I could not wrap my head around how to implement either one when the list contains a cycle. I get now that I should not have thought about the numbers inside nodes as values but as tagging(enumeration), but, by convention, is it not a value that goes inside the circle while it's representing a node? Anyway, it left me wondering, if those numbers were to represent values, how would I implement an identifier for a node(nodes are cycled by 'Tying the Knot'), that's something I will look into.

  • Custom User Avatar

    Thing is, the general idea here is that nodes do not necessarily have to hold any values, and if they do, the values do not necessarily have to be unique. The important part is identity of nodes. The image does not mean to show that nodes hold values, and in many languages they don't. All what is needed to solve this problem is check of "is this node the same node as the other node" which is easy to do in languages with references, but in Haskell, translator decided to go with an implementation of Eq for nodes backed by an internal, non-public, and deliberately undocumented identifier. All what you can do, and all what is actually needed to solve the task, is node1 == node2, which returns True if node1 and node2 hold the same node, and False if not.

    I do not know if it is a good, idiomatic approach for Haskell. It might be, or might be not, no idea. But the idea is that all you need to know to solve the task is equality of nodes, and not values held by the nodes.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I'm sorry for your time, but I'm also glad you liked it. :)

  • Default User Avatar

    I used my precious time to understand this.

    worth it

  • Default User Avatar