Ad
  • Custom User Avatar

    Thanks for the explanation. I was trying to work out a formula to simplify my solution but gave up.

  • Custom User Avatar

    I loved this Kata. Had to rewrite my code 3 times to get it working hahaha. Learned a lot!

  • Custom User Avatar

    L and M are not referring to categories. They are referring to your input variables. So if no books are given or no categories to return in a Haskell string format, then return and empty string.

  • Custom User Avatar

    Thank you for the reply!

    I remain a little confused..

    So, as you describe it, category W should be 0 because there are no codes associated with it right? However, you also say that if a category (L or M) is empty (in other words no codes are associated with it) then an empty string should be returned?

    I get it now! My mind heuristically associated uppercase L and M with categories A-Z, so I thought that by L or M being empty you were referring to the categories being empty rather than a or b (or list_of_art or list_of_cat being empty).

    Is my new understanding correct?

    You are more experienced than me so I'd hate to overreach. However, one suggestion that I may give is that instead of referring to the input variables as L or M in your description, you give them meaningful names such as 'booklist' (L) and 'report_categories' (M)?

    Thanks again! Great kata. Got my mind working!

  • Default User Avatar

    I am afraid you have not read (or badly read) the entire description.
    First:

     ...to sum their quantity according to each category.
    
    For the lists L and M of example you have to return the string (in Haskell/Clojure/Racket/Prolog a list of pairs):
    
    (A : 20) - (B : 114) - (C : 50) - (W : 0)
    where A, B, C, W are the categories, 20 is the sum of the unique book of category A, 114 the sum corresponding to "BKWRK" and "BTSQZ", 50 corresponding to "CDXEF" and 0 to category 'W' since there are no code beginning with W.
    

    Second:

    If L or M are empty return string is ""
    

    Do you confound an empty list/array with a count of 0 for some category?

    Last:
    You are new at CW but before posting "Issue" (which should rather be "Question") 1) look at the top of the page to see how many people passed the kata, 2) read some of the comments before writing yours, 3) note for the future that "Issues" are for problems in the kata.
    Good luck at CW and cheers!

  • Custom User Avatar

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