Ad
  • Default User Avatar

    You are right on the necessary of keeping both parensToTree and treeToParens test. Then my only problem would be droping "" test in the parensToTree part. This will make two test parts totally sysmetry (3 lines t0 3 lines).

    Thank you for this nice kata, anyway.

  • Default User Avatar

    "you still have to deal with all strings"--> We are asked to encode "balanced parentheses", not random string input right? The description claims: "Binary trees can be encoded as strings of balanced parentheses". So, we expect the input should be balanced parentheses. Empty string "" is arguable to be balanced parentheses. Of course, "" could be included as valid input. My point is whether to encode "" to trees should be left optional to people.

  • Default User Avatar

    The empty string "" test case should be drop. Enforce this edge case implies solution had to map "" to Leaf.

    As a counter example, I find maping () to a leaf, and (()()) to leaf :*: leaf is quit reasonable and should be a valid solution.

    How about keeping only the ---parensToTree (treeToParens Tree)--- test cases. This will be enough to cover all possible string presentation.

  • Default User Avatar

    Haskell version raised error:

    "Data constructor not in scope: Number :: (p0 -> p1 -> p1) -> Number"

    So, am I not supposed use Number constructor in the code?