Skip to content

Commit

Permalink
[mmzk] (feat) 2014 Part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
MMZK1526 committed Dec 6, 2023
1 parent 1ca9f9c commit e572598
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/Year2014/Exam.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,23 @@ showRE' re

lookUp :: Eq a => a -> [(a, b)] -> b
--Pre: There is exactly one occurrence of the item being looked up.
lookUp
= undefined
lookUp x ((x',y):xys)
| x == x' = y
| otherwise = lookUp x xys

simplify :: RE -> RE
simplify
= undefined
simplify (Seq re re')
= Seq (simplify re) (simplify re')
simplify (Alt re re')
= Alt (simplify re) (simplify re')
simplify (Rep re)
= Rep (simplify re)
simplify (Plus re)
= Seq (simplify re) (Rep (simplify re))
simplify (Opt re)
= Alt (simplify re) Null
simplify re
= re

--------------------------------------------------------
-- Part II
Expand Down

0 comments on commit e572598

Please sign in to comment.