Ad
  • Default User Avatar

    I do apologize, I didn't see that note. What I meant by partial message is, if I receive a space before the first morse token, I have to decide why why that space is in the stream, because sppaces normally come after tokens. I can just assume the first token was delayed, causing the space, or I can more safely think there should have been a token before the space and my message will not be complete. Then I can signal the sender to retry or something like that.

    Great kata though, I'm not at all complaining.

  • Default User Avatar

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

  • Default User Avatar

    It does say that, quite clearly, but I took that to mean that 3 numbers is the "qualifying" metric for a range, i.e. once a canidate range has 3 numbers, you use it as a range. I think it might help to say something like:

    A span of 3 or more consecutive numbers should be formatted as a range, i.e. the starting integer of the span separated from the end integer of the span by a dash.

    Hey, but maybe it's just me, I was blazing through katas yesterday and probably jumped into coding too quickly at the expense of pondering the problem a bit longer. I think it's great kata, quite easy for 4kyu, and I will be wrapping it up now.

  • Default User Avatar

    I must admit my critique was a bit exagerated, but this is the first kata out of a hundred odd that I've struggled this much to grasp. I see now, with Diego's help and diagram, although not really with his explanation, hehe, how this one is supposed to work.

    It seems to me that this kata is explained from the point of view of a consumer of such a list, as then it is abundantly clear. Maybe other people might also benefit from it being more clear that 3 numbers is a minimum size of a range and it should ne more whenever possible.

  • Default User Avatar

    The description for this kata is unclear. It says, It is not considered a range unless it spans at least 3 numbers. For example "12,13,15-17", but then the example solution shows this:

    solution([-10, -9, -8, -6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20]);
    // returns "-10--8,-6,-3-1,3-5,7-11,14,15,17-20"
    

    None of the consecutive elements at positions 0,1, and 2 differ by more than 1, yet the return value shows -10--8 as a range. Yes, the slice [-1, -9, -8] itself spans 3 numbers, but so do [-9, -8, -6]and [-8, -6, -3] etc. Maybe we're supposed to start at "peg" 0 and when index - 0 >= 3 we have the range -10--8. In that case, it only makes sense to resume with index 3, or -6. but then I would expect the next range to be -6--2, or -6--1, depending if the author uses high or low values for of 3.

    • The next range is mysteriously -3-1, with -6 being left all on its ownsome. This one now spans 5 numbers, where my delusion was that ranges spanned 3 numbers.
    • At least 3-5 starts where I expect it to, directly after the previous range, and it spans 3 numbers, as claimed.
    • 7-11 starts out well, 1 position after 3-5, but then it swallows a whole 5 numbers, and abandons 15.
    • The range 17-20 fortunately heralds the end of this hamster wheel of reasoning, but not before mysteriously consuming four numbers.
  • Default User Avatar

    This is not unique to Jaden, but is well known in software as TitleCase, unless I'm missing something.