79101232

Date: 2024-10-18 08:33:33
Score: 0.5
Natty:
Report link
        val childArgument = Argument(Right("child"), Some(Argument(Left(a._1._1.toInt), None)))
        val optionalArgument = if (a._2.nonEmpty) {
          Some(Argument(Left(if (a._2.get._2) 1 else 0), None))
        } else
          None
        if (optionalArgument.nonEmpty) {
          List(childArgument, optionalArgument.get)
        } else {
          List(childArgument)
        }
      }
    ```

def booleanLit: Parser[Boolean] = "true" ^^ { _ => true } | "false" ^^ { _ => false}


this is how it was solved. there were three cases child(1), child(1);false and child(1);true
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Muhammad Daniyal Danish