Skip to content
Snippets Groups Projects
Commit a92f712c authored by pm3g19's avatar pm3g19
Browse files

Added descriptions for challenges

parent 3384a3fd
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,7 @@ modFst f (a,b) = (f a, b)
modSnd f (a,b) = (a, f b)
-- Challenge 1 --
-- takes in a list of words, the worksearch grid and returns information about whether each word has been found or not
solveWordSearch :: [ String ] -> WordSearchGrid -> [ (String,Maybe Placement) ]
......@@ -165,6 +166,7 @@ inRange l h x = x >= l && x < h
-- Challenge 2 --
-- function takes in list of words, a double for density and returns a random wordsearch based on words, where the density (i.e. the ratio of the total number of letters in the words to the total number of letters in the wordsearch) is strictly lessed than the value specifed.
data Stacking = Top | Side deriving Show
......@@ -370,7 +372,7 @@ printGrid (w:ws) = do putStrLn w
-- Challenge 3 --
-- function takes in a lambda expression with macros and returns a pretty printed string for it
prettyPrint :: LamMacroExpr -> String
......@@ -459,6 +461,7 @@ bracketize s = '(':(s ++ ")")
-- Challenge 4 --
parseLamMacro :: String -> Maybe LamMacroExpr
--the opposite of challenge 3 i.e. takes in string with lambda expression, returns the raw representation of the expression.
-- parse expression
--if output parses and
......@@ -573,10 +576,10 @@ parseBrackets = do
-- Challenge 5
--converts a lambda expression with macros to CPS (Continuation Parsing Style) format
cpsTransform :: LamMacroExpr -> LamMacroExpr
--converts a lambda expression with macros to cps format
cpsTransform lamMacroExpr@(LamDef macroDefs mainExpr) =
{- When we introduce new variable names,
we will start numbering them from one above the highest variable name out of all the expressions
......@@ -690,6 +693,7 @@ sequenceM (x:xs) = do
-- Challenge 6
-- compareInnerOuter takes in a lambda macro expression, a limit, and returns a tuple representing how many reduction steps it took to fully reduce the expression within the limit for leftmost innermost, leftmost outermost, leftmost innermost with CPS and leftmost outermost with CPS respectively. If expression was not fully reduced within the limit, Nothing is returned.
innerRedn1 :: LamMacroExpr -> Maybe LamMacroExpr
outerRedn1 :: LamMacroExpr -> Maybe LamMacroExpr
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment