Skip to content
Snippets Groups Projects
Commit ce586cba authored by Ali Sinan Köksal's avatar Ali Sinan Köksal
Browse files

Curry testcases

parent 279dcc2b
No related branches found
No related tags found
No related merge requests found
...@@ -42,4 +42,5 @@ isRBT t = (blackBalanced t) && (redNodesHaveBlackChildren t) ...@@ -42,4 +42,5 @@ isRBT t = (blackBalanced t) && (redNodesHaveBlackChildren t)
valuesWithin :: Tree -> Int -> Bool valuesWithin :: Tree -> Int -> Bool
valuesWithin Empty _ = True valuesWithin Empty _ = True
valuesWithin (Node _ v l r) bound = 0 <= v && v <= bound && (valuesWithin l bound) && (valuesWithin r bound) valuesWithin (Node _ v l r) bound =
0 <= v && v <= bound && (valuesWithin l bound) && (valuesWithin r bound)
module SortedList
(isSorted, size
) where
isSorted :: [Int] -> Bool
isSorted [] = True
isSorted [_] = True
isSorted (x:y:ys) = x <= y && (isSorted (y:ys))
size :: [Int] -> Int
size [] = 0
size (_:xs) = 1 + (size xs)
contains :: [Int] -> Int -> Bool
contains [] _ = False
contains (x:xs) e = (x == e) || (contains xs e)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment