Ad
  • Custom User Avatar

    Linked list is a duplicate to a million existing katas.

  • Custom User Avatar

    Tests are incredibly weak: most tests only involve at most 2 nodes. And there are no random tests.

  • Custom User Avatar

    There are two kinds of to_a in the tests: the instance method to_a and the class method to_a. They're redundant.

    There's nothing to stop us from implementing reverse by converting it to array, reversing it as an array, then converting it back.

    And then suddenly you're putting in a Range object into from_a? Isn't the meaning of from_a, well, do something from an array? What's a Range doing here? By this rate I wouldn't be surprised if we'd have to support Strings and Enumerators as well.

    Did you really think through the requirements when you made this kata? Because it's obvious you don't, you just slap together a bunch of stuff about linked lists and expect people to contemplate into what you were thinking about when writing the tests.

    Besides, you didn't really write up any kind of documentation. If you've done that you should've already seen through most of the problems mentioned above.

  • Custom User Avatar

    Needs sample tests

  • Custom User Avatar

    It's not clear how the String representation of a Node object is supporsed to look:

    • In one case the example is: one #=> <Node @name=1, @next=nil>
    • In another case it's: two #=> <Node @name=2, @next=<Node @name=1 @next=nil>>

    Note, how this is inconsistent: For the second case I'd expect a comma between the value of the @nameand ```@nextIn other words:two #=> <Node @name=2, @next=<Node @name=1, @next=nil>>````

    How about fixing this by having the comma in both cases (in fact all cases -- in case of a longer list)?

    Depending on how detailed the test for the this kata are, it can be confusing for users to fail because of this, without adding to the point of the kata (which is understanding a singly linked list).

  • Custom User Avatar

    I, too, really liked this kata and going back to the basics to implement a simple data structure. The couple of comments I have are as follows:

    • Mention that the from_a method actually needs to handle ranges and arrays.
    • It'd be nice if all required methods were listed instead of just the four that are given (reverse, from_a, to_a (class), and to_a (instance)). The complete list of required methods can be gleaned from the given Text Examples, but it'd be nicer to have everything explicitly listed.