Ad
  • Custom User Avatar

    A few suggestions, at least for the Clojure version:

    1. Since you refer to the kind of input in the description as "stocklist", the name of the function we must define should be different, to show that the function transforms the "stocklist" from the description into something else.

    2. As others have suggested, I think it doesn't make sense to return an empty vector when the "stocklist" is empty, but the "categories" input is not.

    3. Why not use a map from strings to numbers for the "stocklist" input, instead of a vector of strings with implicit structure provided by spaces?

    4. Why not use a vector of characters for the "categories" input, instead of a vector of strings, since the categories are defined by single capital letters anyway?

    I think it would be better to leave the need to handle messy input data to our day-to-day jobs, and provide a cleaner interface in Kata so we can focus on solving the puzzle. I came up with an algorithmic solution to this Kata very quickly, but had to needlessly struggle with splitting strings, parsing strings as integers, matching strings to characters etc.

  • Custom User Avatar

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

  • Custom User Avatar

    Are you trying to use JavaScript like Haskell? :)

  • Custom User Avatar

    Please include stddef.h in C, so we don't have to.