From 1bc77d75d196f526aa82739da764e932d5421be1 Mon Sep 17 00:00:00 2001 From: tiago Date: Fri, 16 Dec 2022 15:11:00 +0000 Subject: [PATCH] Problem 2 post done, need to verify results --- cp2223t/cp2223t.lhs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cp2223t/cp2223t.lhs b/cp2223t/cp2223t.lhs index 753b2ff..86eb2a8 100644 --- a/cp2223t/cp2223t.lhs +++ b/cp2223t/cp2223t.lhs @@ -1134,13 +1134,19 @@ f a b c (n+3) = a * f a b c (n+2) + b * f a b c (n+1) + c * f a b c n \subsection*{Problema 2} Gene de |tax|: \begin{code} -gene = (id -|- id >< (groupBy (\x y -> countSpaces x >= 0 && countSpaces y > 0) . map (drop 4))) . out +gene = (id -|- (id >< (groupBy (\x y -> countSpaces x >= 0 && countSpaces y > 0) . map (drop 4)))) . out countSpaces = length . takeWhile (== ' ') \end{code} Função de pós-processamento: \begin{code} -post = undefined +post :: Exp String String -> [[String]] +post = cataExp (genepost) + +genepost = (either leftSide rightSide) +leftSide = singl . singl +rightSide = cons . (split (singl . p1) (map cons . lstr . (id >< concat))) + \end{code} \subsection*{Problema 3}