Skip to content
Snippets Groups Projects
Commit e78a1cc1 authored by ik1g19's avatar ik1g19
Browse files

minor changes

parent edc500bb
No related branches found
No related tags found
No related merge requests found
......@@ -171,7 +171,7 @@ addStrsToGrid rg gen (s:ss) = addStrsToGrid newGrid newGen ss
--| returns a list of valid orientations for the |--
--| string at that position |--}
validDirs :: RandGrid -> String -> Posn -> [Orientation]
validDirs rg s (x,y) = map fst $ filter (\b -> snd b == True) (zipF ( checkDir rg s (x,y) ) dirs)
validDirs rg s (x,y) = map fst $ filter ((True==) . snd) (zipF ( checkDir rg s (x,y) ) dirs)
where dirs = [Forward,Back,Up,Down,UpForward,UpBack,DownForward,DownBack]
......@@ -330,15 +330,13 @@ closedParse :: Parser LamExpr -> Parser LamExpr
closedParse p = do e <- p
if free e then empty else return e
{--| finds if an expression contains free variables |--
--| |--}
{--| finds if an expression contains free variables |--}
free :: LamExpr -> Bool
free (LamVar _) = True
free (LamAbs x e ) = freeVar x e
free (LamApp e1 e2) = free e1 && free e2
{--| finds if a given variable is free in an expr |--
--| |--}
{--| finds if a given variable is free in an expr |--}
freeVar :: Int -> LamExpr -> Bool
freeVar x (LamVar y) = not $ x == y
freeVar x (LamAbs y e) | x == y = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment