Felienne Hermans
Felienne Hermans
December 12th, 2021

Code Reading Club Reading Countdown - 12

Article cover photo

Countdown - Snippet 12

Today's code reading countdown in Haskell.

Snippet

CRCRC-12

Snippet in text

printSolutions [] = do
   putStrLn "false.\n"
printSolutions (u:us) = do
   if null u
      then putStr "true"
      else putStr $ intercalate ",\n" [ show k ++ " = " ++ show v | (k,v) <- u ]
   c <- getChar
   case c of
      ' ' -> do putStrLn ";"
                printSolutions us;
      _   -> do putStrLn ""

Question

Given a non-empty list of solutions, what does this output?

Submission

Submit your answer in our form.